aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2002-02-08 06:46:14 +0000
committerAlexandre Oliva <aoliva@redhat.com>2002-02-08 06:46:14 +0000
commit3c74c164ab22de0030a992fee9b41846dfc14d35 (patch)
tree5eeccb91cec1b572270aa5103aa9d7afcf0f2578 /gas
parent2d92cb7d27c686aafda2ebae33fe131f035896d7 (diff)
downloadgdb-3c74c164ab22de0030a992fee9b41846dfc14d35.zip
gdb-3c74c164ab22de0030a992fee9b41846dfc14d35.tar.gz
gdb-3c74c164ab22de0030a992fee9b41846dfc14d35.tar.bz2
Contribute sh64-elf.
2002-02-01 Alexandre Oliva <aoliva@redhat.com> * gas/sh/sh64/syntax-1.s: Remove `-4' from @(expr-4,pc). 2002-01-28 Alexandre Oliva <aoliva@redhat.com> * gas/sh/sh64/crange1-1.d: Formatting changes to match the current output of objdump. * gas/sh/sh64/crange1-2.d: Likewise. * gas/sh/sh64/crange2-2.d: Likewise. * gas/sh/sh64/crange3-1.d: Likewise. * gas/sh/sh64/crange4-1.d: Likewise. * gas/sh/sh64/datal-2.d: Likewise. * gas/sh/sh64/datal32-1.d: Likewise. * gas/sh/sh64/datal32-3.d: Likewise. * gas/sh/sh64/localcom-1.d: Likewise. * gas/sh/sh64/mix-1.d: Likewise. * gas/sh/sh64/pt32-1.d: Likewise. * gas/sh/sh64/rel32-1.d: Likewise. * gas/sh/sh64/rel32-2.d: Likewise. * gas/sh/sh64/rel32-3.d: Likewise. * gas/sh/sh64/rel32-4.d: Likewise. * gas/sh/sh64/rel32-5.d: Likewise. * gas/sh/sh64/ua32-1.d: Likewise. 2001-03-14 DJ Delorie <dj@redhat.com> * gas/sh/sh64/endian-1.d: New test - Little Endianness. * gas/sh/sh64/endian-1.s: New test - Little Endianness. * gas/sh/sh64/endian-2.d: New test - Big Endianness. * gas/sh/sh64/endian-2.s: New test - Big Endianness. 2001-03-12 DJ Delorie <dj@redhat.com> * gas/sh/sh64/syntax-1.d: New test - basic syntax. * gas/sh/sh64/syntax-1.s: New test - basic syntax. * gas/sh/sh64/syntax-2.d: New test - basic syntax, pseudos. * gas/sh/sh64/syntax-2.s: New test - basic syntax, pseudos. 2001-03-06 DJ Delorie <dj@redhat.com> * gas/sh/sh64/lineno.d: New, test dwarf2 line numbers vs macros. * gas/sh/sh64/lineno.s: Ditto. 2001-01-14 Hans-Peter Nilsson <hpn@cygnus.com> * gas/sh/sh64/err-dsp.s: New test. 2001-01-13 Hans-Peter Nilsson <hpn@cygnus.com> * gas/sh/sh64/err-abi-64.s, gas/sh/sh64/err-abi-32.s, gas/sh/sh64/abi-64.s, gas/sh/sh64/abi-64.d, gas/sh/sh64/abi-32.s, gas/sh/sh64/abi-32.d, gas/sh/sh64/crange3.s, gas/sh/sh64/crange3-1.d, gas/sh/sh64/crange4.s, gas/sh/sh64/crange4-1.d, gas/sh/sh64/crange5.s, gas/sh/sh64/crange5-1.d: New tests. 2001-01-07 Hans-Peter Nilsson <hpn@cygnus.com> * gas/sh/sh64/relax-1.s, gas/sh/sh64/relax-1.d: New test. * gas/sh/sh64/err-pt-1.s: New test. * gas/sh/sh64/relax-2.s, gas/sh/sh64/relax-2.d: New test. * gas/sh/sh64/localcom-1.s, gas/sh/sh64/localcom-1.d: New test. * gas/sh/sh64/movi-3.s, gas/sh/sh64/movi-3.d: New test. * gas/sh/sh64/relax-3.s, gas/sh/sh64/relax-3.d: New test. 2001-01-05 Hans-Peter Nilsson <hpn@cygnus.com> * gas/sh/sh64/case-noexp-1.d: Adjust to changed GAS output for check-PTA/PTB / perhaps-change-to-PTB bit in target field. * gas/sh/sh64/case-noexp-1.d: Ditto. * gas/sh/sh64/mix-noexp-1.d: Ditto. * gas/sh/sh64/pt32-noexp-2.d: Ditto. * gas/sh/sh64/pt64-noexp-2.d: Ditto. * gas/sh/sh64/ptc32-noexp-1.d: Ditto. * gas/sh/sh64/ptc64-noexp-1.d: Ditto. * gas/sh/sh64/ptext32-noexp-1.d: Ditto. * gas/sh/sh64/ptext64-noexp-1.d: Ditto. 2000-12-31 Hans-Peter Nilsson <hpn@cygnus.com> * gas/sh/sh64/shift64-3.d: Fix typo. * gas/sh/sh64/shift64-noexp-3.d, gas/sh/sh64/shift32-noexp-3.d, gas/sh/sh64/ptext64-noexp-1.d, gas/sh/sh64/ptext64-32-1.d, gas/sh/sh64/ptext32-noexp-1.d, gas/sh/sh64/ptc64-noexp-1.d, gas/sh/sh64/ptc64-32-1.d, gas/sh/sh64/ptc32-noexp-1.d, gas/sh/sh64/pt64-noexp-2.d, gas/sh/sh64/pt64-32-2.d, gas/sh/sh64/pt64-32-1.d, gas/sh/sh64/pt32-noexp-2.d, gas/sh/sh64/pt-noexp-1.d, gas/sh/sh64/movi64-noexp-2.d, gas/sh/sh64/movi32-noexp-2.d, gas/sh/sh64/mix-noexp-1.d, gas/sh/sh64/err-ptb-2.s, gas/sh/sh64/err-ptb-1.s, gas/sh/sh64/err-pt32-cmd3.s, gas/sh/sh64/err-pt32-cmd2.s, gas/sh/sh64/err-pt32-cmd1.s, gas/sh/sh64/err-noexp-cmd1.s, gas/sh/sh64/err-movi-noexp-1.s, gas/sh/sh64/crange2.s, gas/sh/sh64/crange2-noexp-1.d, gas/sh/sh64/crange2-2.d, gas/sh/sh64/crange2-1.d, gas/sh/sh64/case-noexp-1.d: New tests. 2000-12-18 Hans-Peter Nilsson <hpn@cygnus.com> * gas/sh/sh64/err-4.s: Use option -no-mix to see errors. Adjust for errors not being emitted at the .mode directives anymore. * gas/sh/sh64/crange1.s, gas/sh/sh64/crange1-2.d, gas/sh/sh64/crange1-1.d: New tests for .cranges section. 2000-12-12 Hans-Peter Nilsson <hpn@cygnus.com> * gas/sh/sh64/err-3.s: New test. * gas/sh/sh64/immexpr1.s, gas/sh/sh64/immexpr32-1.d, gas/sh/sh64/immexpr64-1.d: New tests. * gas/sh/sh64/immexpr2.s, gas/sh/sh64/immexpr32-2.d, gas/sh/sh64/immexpr64-2.d: New tests. 2000-12-11 Hans-Peter Nilsson <hpn@cygnus.com> * gas/sh/sh64/rel-1.s, gas/sh/sh64/rel-2.s, gas/sh/sh64/rel-3.s, gas/sh/sh64/rel-4.s, gas/sh/sh64/rel-5.s, gas/sh/sh64/rel32-1.d, gas/sh/sh64/rel32-2.d, gas/sh/sh64/rel32-3.d, gas/sh/sh64/rel32-4.d, gas/sh/sh64/rel32-5.d, gas/sh/sh64/rel64-1.d, gas/sh/sh64/rel64-2.d, gas/sh/sh64/rel64-3.d, gas/sh/sh64/rel64-4.d, gas/sh/sh64/rel64-5.d: New tests. 2000-12-07 Hans-Peter Nilsson <hpn@cygnus.com> * gas/sh/sh64/case-1.d, gas/sh/sh64/mix-1.d, gas/sh/sh64/pt32-1.d, gas/sh/sh64/pt64-1.d, gas/sh/sh64/ptc32-1.d, gas/sh/sh64/ptc64-1.d, gas/sh/sh64/ptext32-1.d, gas/sh/sh64/ptext64-1.d: Correct offsets in PT/PTA/PTB expansion. 2000-12-05 Hans-Peter Nilsson <hpn@cygnus.com> * gas/sh/sh64/datal-3.s, gas/sh/sh64/datal32-3.d, gas/sh/sh64/datal64-3.d: New tests. 2000-11-27 Hans-Peter Nilsson <hpn@cygnus.com> * gas/sh/sh64/datal-1.s: Remove whitespace at end of line. * gas/sh/sh64/datal32-1.d, gas/sh/sh64/datal64-1.d, gas/sh/sh64/movi32-1.d, gas/sh/sh64/movi32-2.d, gas/sh/sh64/movi64-1.d, gas/sh/sh64/movi64-3.d: Correct register. * gas/sh/sh64/mix-1.s, gas/sh/sh64/mix-1.d, gas/sh/sh64/err-4.s: New tests. 2000-11-26 Hans-Peter Nilsson <hpn@cygnus.com> * gas/macros/macros.exp: Import xfail sh*-*-* from net binutils. * gas/sh/sh64/case-1.d: Correct offsets in PT/PTA/PTB expansion. gas/sh/sh64/pt32-1.d, gas/sh/sh64/pt64-1.d: Ditto. gas/sh/sh64/ptc32-1.d, gas/sh/sh64/ptc64-1.d: Ditto. gas/sh/sh64/ptext32-1.d, gas/sh/sh64/ptext64-1.d: Ditto. 2000-11-25 Hans-Peter Nilsson <hpn@cygnus.com> * gas/sh/sh64/ptc32-1.d, gas/sh/sh64/ptc64-1.d: Correct. * gas/sh/sh64/datal-1.s, gas/sh/sh64/datal32-1.d, gas/sh/sh64/datal64-1.d: New test. * gas/sh/sh64/datal-2.s, gas/sh/sh64/datal-2.d: New test. * gas/sh/sh64/creg-1.d, gas/sh/sh64/creg-1.s: New test. * gas/sh/sh64/creg-2.d, gas/sh/sh64/creg-2.s: New test. 2000-11-24 Hans-Peter Nilsson <hpn@cygnus.com> * gas/sh/sh64: New testsuite.
Diffstat (limited to 'gas')
-rw-r--r--gas/testsuite/ChangeLog130
-rw-r--r--gas/testsuite/gas/sh/sh64/abi-32.d10
-rw-r--r--gas/testsuite/gas/sh/sh64/abi-32.s7
-rw-r--r--gas/testsuite/gas/sh/sh64/abi-64.d9
-rw-r--r--gas/testsuite/gas/sh/sh64/abi-64.s7
-rw-r--r--gas/testsuite/gas/sh/sh64/basic-1.d234
-rw-r--r--gas/testsuite/gas/sh/sh64/basic-1.s233
-rw-r--r--gas/testsuite/gas/sh/sh64/case-1.d23
-rw-r--r--gas/testsuite/gas/sh/sh64/case-1.s12
-rw-r--r--gas/testsuite/gas/sh/sh64/case-noexp-1.d18
-rw-r--r--gas/testsuite/gas/sh/sh64/crange1-1.d105
-rw-r--r--gas/testsuite/gas/sh/sh64/crange1-2.d109
-rw-r--r--gas/testsuite/gas/sh/sh64/crange1.s210
-rw-r--r--gas/testsuite/gas/sh/sh64/crange2-1.d43
-rw-r--r--gas/testsuite/gas/sh/sh64/crange2-2.d23
-rw-r--r--gas/testsuite/gas/sh/sh64/crange2-noexp-1.d43
-rw-r--r--gas/testsuite/gas/sh/sh64/crange2.s34
-rw-r--r--gas/testsuite/gas/sh/sh64/crange3-1.d25
-rw-r--r--gas/testsuite/gas/sh/sh64/crange3.s34
-rw-r--r--gas/testsuite/gas/sh/sh64/crange4-1.d20
-rw-r--r--gas/testsuite/gas/sh/sh64/crange4.s8
-rw-r--r--gas/testsuite/gas/sh/sh64/crange5-1.d13
-rw-r--r--gas/testsuite/gas/sh/sh64/crange5.s26
-rw-r--r--gas/testsuite/gas/sh/sh64/creg-1.d77
-rw-r--r--gas/testsuite/gas/sh/sh64/creg-1.s79
-rw-r--r--gas/testsuite/gas/sh/sh64/creg-2.d17
-rw-r--r--gas/testsuite/gas/sh/sh64/creg-2.s14
-rw-r--r--gas/testsuite/gas/sh/sh64/datal-1.s41
-rw-r--r--gas/testsuite/gas/sh/sh64/datal-2.d44
-rw-r--r--gas/testsuite/gas/sh/sh64/datal-2.s46
-rw-r--r--gas/testsuite/gas/sh/sh64/datal-3.s48
-rw-r--r--gas/testsuite/gas/sh/sh64/datal32-1.d45
-rw-r--r--gas/testsuite/gas/sh/sh64/datal32-3.d95
-rw-r--r--gas/testsuite/gas/sh/sh64/datal64-1.d50
-rw-r--r--gas/testsuite/gas/sh/sh64/datal64-3.d124
-rw-r--r--gas/testsuite/gas/sh/sh64/endian-1.d9
-rw-r--r--gas/testsuite/gas/sh/sh64/endian-1.s7
-rw-r--r--gas/testsuite/gas/sh/sh64/endian-2.d10
-rw-r--r--gas/testsuite/gas/sh/sh64/endian-2.s7
-rw-r--r--gas/testsuite/gas/sh/sh64/err-1.s47
-rw-r--r--gas/testsuite/gas/sh/sh64/err-2.s16
-rw-r--r--gas/testsuite/gas/sh/sh64/err-3.s36
-rw-r--r--gas/testsuite/gas/sh/sh64/err-4.s27
-rw-r--r--gas/testsuite/gas/sh/sh64/err-abi-32.s10
-rw-r--r--gas/testsuite/gas/sh/sh64/err-abi-64.s10
-rw-r--r--gas/testsuite/gas/sh/sh64/err-dsp.s15
-rw-r--r--gas/testsuite/gas/sh/sh64/err-movi-noexp-1.s24
-rw-r--r--gas/testsuite/gas/sh/sh64/err-noexp-cmd1.s10
-rw-r--r--gas/testsuite/gas/sh/sh64/err-pt-1.s18
-rw-r--r--gas/testsuite/gas/sh/sh64/err-pt32-cmd1.s10
-rw-r--r--gas/testsuite/gas/sh/sh64/err-pt32-cmd2.s10
-rw-r--r--gas/testsuite/gas/sh/sh64/err-pt32-cmd3.s10
-rw-r--r--gas/testsuite/gas/sh/sh64/err-ptb-1.s34
-rw-r--r--gas/testsuite/gas/sh/sh64/err-ptb-2.s34
-rw-r--r--gas/testsuite/gas/sh/sh64/err.exp9
-rw-r--r--gas/testsuite/gas/sh/sh64/immexpr1.s85
-rw-r--r--gas/testsuite/gas/sh/sh64/immexpr2.s16
-rw-r--r--gas/testsuite/gas/sh/sh64/immexpr32-1.d67
-rw-r--r--gas/testsuite/gas/sh/sh64/immexpr32-2.d11
-rw-r--r--gas/testsuite/gas/sh/sh64/immexpr64-1.d68
-rw-r--r--gas/testsuite/gas/sh/sh64/immexpr64-2.d11
-rw-r--r--gas/testsuite/gas/sh/sh64/lineno.d19
-rw-r--r--gas/testsuite/gas/sh/sh64/lineno.s7
-rw-r--r--gas/testsuite/gas/sh/sh64/localcom-1.d30
-rw-r--r--gas/testsuite/gas/sh/sh64/localcom-1.s26
-rw-r--r--gas/testsuite/gas/sh/sh64/mix-1.d42
-rw-r--r--gas/testsuite/gas/sh/sh64/mix-1.s21
-rw-r--r--gas/testsuite/gas/sh/sh64/mix-noexp-1.d33
-rw-r--r--gas/testsuite/gas/sh/sh64/movi-1.s20
-rw-r--r--gas/testsuite/gas/sh/sh64/movi-2.s28
-rw-r--r--gas/testsuite/gas/sh/sh64/movi-3.d18
-rw-r--r--gas/testsuite/gas/sh/sh64/movi-3.s10
-rw-r--r--gas/testsuite/gas/sh/sh64/movi32-1.d35
-rw-r--r--gas/testsuite/gas/sh/sh64/movi32-2.d36
-rw-r--r--gas/testsuite/gas/sh/sh64/movi32-noexp-2.d28
-rw-r--r--gas/testsuite/gas/sh/sh64/movi64-1.d44
-rw-r--r--gas/testsuite/gas/sh/sh64/movi64-2.d30
-rw-r--r--gas/testsuite/gas/sh/sh64/movi64-2.s10
-rw-r--r--gas/testsuite/gas/sh/sh64/movi64-3.d52
-rw-r--r--gas/testsuite/gas/sh/sh64/movi64-noexp-2.d28
-rw-r--r--gas/testsuite/gas/sh/sh64/pt-1.d26
-rw-r--r--gas/testsuite/gas/sh/sh64/pt-1.s17
-rw-r--r--gas/testsuite/gas/sh/sh64/pt-2.s22
-rw-r--r--gas/testsuite/gas/sh/sh64/pt-noexp-1.d27
-rw-r--r--gas/testsuite/gas/sh/sh64/pt32-1.d39
-rw-r--r--gas/testsuite/gas/sh/sh64/pt32-noexp-2.d34
-rw-r--r--gas/testsuite/gas/sh/sh64/pt64-1.d47
-rw-r--r--gas/testsuite/gas/sh/sh64/pt64-32-1.d27
-rw-r--r--gas/testsuite/gas/sh/sh64/pt64-32-2.d39
-rw-r--r--gas/testsuite/gas/sh/sh64/pt64-noexp-2.d34
-rw-r--r--gas/testsuite/gas/sh/sh64/ptc-1.s5
-rw-r--r--gas/testsuite/gas/sh/sh64/ptc32-1.d15
-rw-r--r--gas/testsuite/gas/sh/sh64/ptc32-noexp-1.d12
-rw-r--r--gas/testsuite/gas/sh/sh64/ptc64-1.d19
-rw-r--r--gas/testsuite/gas/sh/sh64/ptc64-32-1.d15
-rw-r--r--gas/testsuite/gas/sh/sh64/ptc64-noexp-1.d13
-rw-r--r--gas/testsuite/gas/sh/sh64/ptext-1.s8
-rw-r--r--gas/testsuite/gas/sh/sh64/ptext32-1.d40
-rw-r--r--gas/testsuite/gas/sh/sh64/ptext32-noexp-1.d22
-rw-r--r--gas/testsuite/gas/sh/sh64/ptext64-1.d64
-rw-r--r--gas/testsuite/gas/sh/sh64/ptext64-32-1.d40
-rw-r--r--gas/testsuite/gas/sh/sh64/ptext64-noexp-1.d22
-rw-r--r--gas/testsuite/gas/sh/sh64/rel-1.s137
-rw-r--r--gas/testsuite/gas/sh/sh64/rel-2.s138
-rw-r--r--gas/testsuite/gas/sh/sh64/rel-3.s137
-rw-r--r--gas/testsuite/gas/sh/sh64/rel-4.s138
-rw-r--r--gas/testsuite/gas/sh/sh64/rel-5.s48
-rw-r--r--gas/testsuite/gas/sh/sh64/rel32-1.d86
-rw-r--r--gas/testsuite/gas/sh/sh64/rel32-2.d86
-rw-r--r--gas/testsuite/gas/sh/sh64/rel32-3.d86
-rw-r--r--gas/testsuite/gas/sh/sh64/rel32-4.d86
-rw-r--r--gas/testsuite/gas/sh/sh64/rel32-5.d30
-rw-r--r--gas/testsuite/gas/sh/sh64/rel64-1.d111
-rw-r--r--gas/testsuite/gas/sh/sh64/rel64-2.d111
-rw-r--r--gas/testsuite/gas/sh/sh64/rel64-3.d111
-rw-r--r--gas/testsuite/gas/sh/sh64/rel64-4.d111
-rw-r--r--gas/testsuite/gas/sh/sh64/rel64-5.d40
-rw-r--r--gas/testsuite/gas/sh/sh64/relax-1.d30
-rw-r--r--gas/testsuite/gas/sh/sh64/relax-1.s18
-rw-r--r--gas/testsuite/gas/sh/sh64/relax-2.d30
-rw-r--r--gas/testsuite/gas/sh/sh64/relax-2.s23
-rw-r--r--gas/testsuite/gas/sh/sh64/relax-3.d43
-rw-r--r--gas/testsuite/gas/sh/sh64/relax-3.s32
-rw-r--r--gas/testsuite/gas/sh/sh64/sh64.exp27
-rw-r--r--gas/testsuite/gas/sh/sh64/shift-1.s42
-rw-r--r--gas/testsuite/gas/sh/sh64/shift-2.s34
-rw-r--r--gas/testsuite/gas/sh/sh64/shift-3.s7
-rw-r--r--gas/testsuite/gas/sh/sh64/shift32-1.d58
-rw-r--r--gas/testsuite/gas/sh/sh64/shift32-3.d14
-rw-r--r--gas/testsuite/gas/sh/sh64/shift32-noexp-3.d14
-rw-r--r--gas/testsuite/gas/sh/sh64/shift64-1.d58
-rw-r--r--gas/testsuite/gas/sh/sh64/shift64-2.d42
-rw-r--r--gas/testsuite/gas/sh/sh64/shift64-3.d14
-rw-r--r--gas/testsuite/gas/sh/sh64/shift64-noexp-3.d14
-rw-r--r--gas/testsuite/gas/sh/sh64/syntax-1.d157
-rw-r--r--gas/testsuite/gas/sh/sh64/syntax-1.s199
-rw-r--r--gas/testsuite/gas/sh/sh64/syntax-2.d11
-rw-r--r--gas/testsuite/gas/sh/sh64/syntax-2.s10
-rw-r--r--gas/testsuite/gas/sh/sh64/ua-1.s16
-rw-r--r--gas/testsuite/gas/sh/sh64/ua32-1.d25
-rw-r--r--gas/testsuite/gas/sh/sh64/ua64-1.d25
141 files changed, 6170 insertions, 0 deletions
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 6624ee8..b4871c4 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,133 @@
+2002-02-08 Alexandre Oliva <aoliva@redhat.com>
+
+ Contribute sh64-elf.
+ 2002-02-01 Alexandre Oliva <aoliva@redhat.com>
+ * gas/sh/sh64/syntax-1.s: Remove `-4' from @(expr-4,pc).
+ 2002-01-28 Alexandre Oliva <aoliva@redhat.com>
+ * gas/sh/sh64/crange1-1.d: Formatting changes to match the current
+ output of objdump.
+ * gas/sh/sh64/crange1-2.d: Likewise.
+ * gas/sh/sh64/crange2-2.d: Likewise.
+ * gas/sh/sh64/crange3-1.d: Likewise.
+ * gas/sh/sh64/crange4-1.d: Likewise.
+ * gas/sh/sh64/datal-2.d: Likewise.
+ * gas/sh/sh64/datal32-1.d: Likewise.
+ * gas/sh/sh64/datal32-3.d: Likewise.
+ * gas/sh/sh64/localcom-1.d: Likewise.
+ * gas/sh/sh64/mix-1.d: Likewise.
+ * gas/sh/sh64/pt32-1.d: Likewise.
+ * gas/sh/sh64/rel32-1.d: Likewise.
+ * gas/sh/sh64/rel32-2.d: Likewise.
+ * gas/sh/sh64/rel32-3.d: Likewise.
+ * gas/sh/sh64/rel32-4.d: Likewise.
+ * gas/sh/sh64/rel32-5.d: Likewise.
+ * gas/sh/sh64/ua32-1.d: Likewise.
+ 2001-03-14 DJ Delorie <dj@redhat.com>
+ * gas/sh/sh64/endian-1.d: New test - Little Endianness.
+ * gas/sh/sh64/endian-1.s: New test - Little Endianness.
+ * gas/sh/sh64/endian-2.d: New test - Big Endianness.
+ * gas/sh/sh64/endian-2.s: New test - Big Endianness.
+ 2001-03-12 DJ Delorie <dj@redhat.com>
+ * gas/sh/sh64/syntax-1.d: New test - basic syntax.
+ * gas/sh/sh64/syntax-1.s: New test - basic syntax.
+ * gas/sh/sh64/syntax-2.d: New test - basic syntax, pseudos.
+ * gas/sh/sh64/syntax-2.s: New test - basic syntax, pseudos.
+ 2001-03-06 DJ Delorie <dj@redhat.com>
+ * gas/sh/sh64/lineno.d: New, test dwarf2 line numbers vs macros.
+ * gas/sh/sh64/lineno.s: Ditto.
+ 2001-01-14 Hans-Peter Nilsson <hpn@cygnus.com>
+ * gas/sh/sh64/err-dsp.s: New test.
+ 2001-01-13 Hans-Peter Nilsson <hpn@cygnus.com>
+ * gas/sh/sh64/err-abi-64.s, gas/sh/sh64/err-abi-32.s,
+ gas/sh/sh64/abi-64.s, gas/sh/sh64/abi-64.d, gas/sh/sh64/abi-32.s,
+ gas/sh/sh64/abi-32.d, gas/sh/sh64/crange3.s,
+ gas/sh/sh64/crange3-1.d, gas/sh/sh64/crange4.s,
+ gas/sh/sh64/crange4-1.d, gas/sh/sh64/crange5.s,
+ gas/sh/sh64/crange5-1.d: New tests.
+ 2001-01-07 Hans-Peter Nilsson <hpn@cygnus.com>
+ * gas/sh/sh64/relax-1.s, gas/sh/sh64/relax-1.d: New test.
+ * gas/sh/sh64/err-pt-1.s: New test.
+ * gas/sh/sh64/relax-2.s, gas/sh/sh64/relax-2.d: New test.
+ * gas/sh/sh64/localcom-1.s, gas/sh/sh64/localcom-1.d: New test.
+ * gas/sh/sh64/movi-3.s, gas/sh/sh64/movi-3.d: New test.
+ * gas/sh/sh64/relax-3.s, gas/sh/sh64/relax-3.d: New test.
+ 2001-01-05 Hans-Peter Nilsson <hpn@cygnus.com>
+ * gas/sh/sh64/case-noexp-1.d: Adjust to changed GAS output for
+ check-PTA/PTB / perhaps-change-to-PTB bit in target field.
+ * gas/sh/sh64/case-noexp-1.d: Ditto.
+ * gas/sh/sh64/mix-noexp-1.d: Ditto.
+ * gas/sh/sh64/pt32-noexp-2.d: Ditto.
+ * gas/sh/sh64/pt64-noexp-2.d: Ditto.
+ * gas/sh/sh64/ptc32-noexp-1.d: Ditto.
+ * gas/sh/sh64/ptc64-noexp-1.d: Ditto.
+ * gas/sh/sh64/ptext32-noexp-1.d: Ditto.
+ * gas/sh/sh64/ptext64-noexp-1.d: Ditto.
+ 2000-12-31 Hans-Peter Nilsson <hpn@cygnus.com>
+ * gas/sh/sh64/shift64-3.d: Fix typo.
+ * gas/sh/sh64/shift64-noexp-3.d, gas/sh/sh64/shift32-noexp-3.d,
+ gas/sh/sh64/ptext64-noexp-1.d, gas/sh/sh64/ptext64-32-1.d,
+ gas/sh/sh64/ptext32-noexp-1.d, gas/sh/sh64/ptc64-noexp-1.d,
+ gas/sh/sh64/ptc64-32-1.d, gas/sh/sh64/ptc32-noexp-1.d,
+ gas/sh/sh64/pt64-noexp-2.d, gas/sh/sh64/pt64-32-2.d,
+ gas/sh/sh64/pt64-32-1.d, gas/sh/sh64/pt32-noexp-2.d,
+ gas/sh/sh64/pt-noexp-1.d, gas/sh/sh64/movi64-noexp-2.d,
+ gas/sh/sh64/movi32-noexp-2.d, gas/sh/sh64/mix-noexp-1.d,
+ gas/sh/sh64/err-ptb-2.s, gas/sh/sh64/err-ptb-1.s,
+ gas/sh/sh64/err-pt32-cmd3.s, gas/sh/sh64/err-pt32-cmd2.s,
+ gas/sh/sh64/err-pt32-cmd1.s, gas/sh/sh64/err-noexp-cmd1.s,
+ gas/sh/sh64/err-movi-noexp-1.s, gas/sh/sh64/crange2.s,
+ gas/sh/sh64/crange2-noexp-1.d, gas/sh/sh64/crange2-2.d,
+ gas/sh/sh64/crange2-1.d, gas/sh/sh64/case-noexp-1.d: New tests.
+ 2000-12-18 Hans-Peter Nilsson <hpn@cygnus.com>
+ * gas/sh/sh64/err-4.s: Use option -no-mix to see errors. Adjust
+ for errors not being emitted at the .mode directives anymore.
+ * gas/sh/sh64/crange1.s, gas/sh/sh64/crange1-2.d,
+ gas/sh/sh64/crange1-1.d: New tests for .cranges section.
+ 2000-12-12 Hans-Peter Nilsson <hpn@cygnus.com>
+ * gas/sh/sh64/err-3.s: New test.
+ * gas/sh/sh64/immexpr1.s, gas/sh/sh64/immexpr32-1.d,
+ gas/sh/sh64/immexpr64-1.d: New tests.
+ * gas/sh/sh64/immexpr2.s, gas/sh/sh64/immexpr32-2.d,
+ gas/sh/sh64/immexpr64-2.d: New tests.
+ 2000-12-11 Hans-Peter Nilsson <hpn@cygnus.com>
+ * gas/sh/sh64/rel-1.s, gas/sh/sh64/rel-2.s, gas/sh/sh64/rel-3.s,
+ gas/sh/sh64/rel-4.s, gas/sh/sh64/rel-5.s, gas/sh/sh64/rel32-1.d,
+ gas/sh/sh64/rel32-2.d, gas/sh/sh64/rel32-3.d,
+ gas/sh/sh64/rel32-4.d, gas/sh/sh64/rel32-5.d,
+ gas/sh/sh64/rel64-1.d, gas/sh/sh64/rel64-2.d,
+ gas/sh/sh64/rel64-3.d, gas/sh/sh64/rel64-4.d,
+ gas/sh/sh64/rel64-5.d: New tests.
+ 2000-12-07 Hans-Peter Nilsson <hpn@cygnus.com>
+ * gas/sh/sh64/case-1.d, gas/sh/sh64/mix-1.d, gas/sh/sh64/pt32-1.d,
+ gas/sh/sh64/pt64-1.d, gas/sh/sh64/ptc32-1.d,
+ gas/sh/sh64/ptc64-1.d, gas/sh/sh64/ptext32-1.d,
+ gas/sh/sh64/ptext64-1.d: Correct offsets in PT/PTA/PTB expansion.
+ 2000-12-05 Hans-Peter Nilsson <hpn@cygnus.com>
+ * gas/sh/sh64/datal-3.s, gas/sh/sh64/datal32-3.d,
+ gas/sh/sh64/datal64-3.d: New tests.
+ 2000-11-27 Hans-Peter Nilsson <hpn@cygnus.com>
+ * gas/sh/sh64/datal-1.s: Remove whitespace at end of line.
+ * gas/sh/sh64/datal32-1.d, gas/sh/sh64/datal64-1.d,
+ gas/sh/sh64/movi32-1.d, gas/sh/sh64/movi32-2.d,
+ gas/sh/sh64/movi64-1.d, gas/sh/sh64/movi64-3.d: Correct register.
+ * gas/sh/sh64/mix-1.s, gas/sh/sh64/mix-1.d, gas/sh/sh64/err-4.s:
+ New tests.
+ 2000-11-26 Hans-Peter Nilsson <hpn@cygnus.com>
+ * gas/macros/macros.exp: Import xfail sh*-*-* from net binutils.
+ * gas/sh/sh64/case-1.d: Correct offsets in PT/PTA/PTB expansion.
+ gas/sh/sh64/pt32-1.d, gas/sh/sh64/pt64-1.d: Ditto.
+ gas/sh/sh64/ptc32-1.d, gas/sh/sh64/ptc64-1.d: Ditto.
+ gas/sh/sh64/ptext32-1.d, gas/sh/sh64/ptext64-1.d: Ditto.
+ 2000-11-25 Hans-Peter Nilsson <hpn@cygnus.com>
+ * gas/sh/sh64/ptc32-1.d, gas/sh/sh64/ptc64-1.d: Correct.
+ * gas/sh/sh64/datal-1.s, gas/sh/sh64/datal32-1.d,
+ gas/sh/sh64/datal64-1.d: New test.
+ * gas/sh/sh64/datal-2.s, gas/sh/sh64/datal-2.d: New test.
+ * gas/sh/sh64/creg-1.d, gas/sh/sh64/creg-1.s: New test.
+ * gas/sh/sh64/creg-2.d, gas/sh/sh64/creg-2.s: New test.
+ 2000-11-24 Hans-Peter Nilsson <hpn@cygnus.com>
+ * gas/sh/sh64: New testsuite.
+
2002-02-06 Alexandre Oliva <aoliva@redhat.com>
* gas/sh/pic.d, gas/sh/pic.s: New test.
diff --git a/gas/testsuite/gas/sh/sh64/abi-32.d b/gas/testsuite/gas/sh/sh64/abi-32.d
new file mode 100644
index 0000000..d9814cb
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/abi-32.d
@@ -0,0 +1,10 @@
+#as: --abi=32
+#objdump: -dr
+#name: Assertion .abi 32.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+[0]+ <start>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+
diff --git a/gas/testsuite/gas/sh/sh64/abi-32.s b/gas/testsuite/gas/sh/sh64/abi-32.s
new file mode 100644
index 0000000..85d9807
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/abi-32.s
@@ -0,0 +1,7 @@
+! Check successful .abi assertion for 32-bit ABI.
+
+ .text
+ .abi 32
+ .mode SHmedia
+start:
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/abi-64.d b/gas/testsuite/gas/sh/sh64/abi-64.d
new file mode 100644
index 0000000..03f1ba4
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/abi-64.d
@@ -0,0 +1,9 @@
+#as: --abi=64
+#objdump: -dr
+#name: Assertion .abi 64.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+[0]+ <start>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
diff --git a/gas/testsuite/gas/sh/sh64/abi-64.s b/gas/testsuite/gas/sh/sh64/abi-64.s
new file mode 100644
index 0000000..8daa31b
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/abi-64.s
@@ -0,0 +1,7 @@
+! Check successful .abi assertion for 64-bit ABI.
+
+ .text
+ .abi 64
+
+start:
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/basic-1.d b/gas/testsuite/gas/sh/sh64/basic-1.d
new file mode 100644
index 0000000..289ec9c
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/basic-1.d
@@ -0,0 +1,234 @@
+#as: --isa=shmedia
+#objdump: -dr
+#name: Basic SHmedia instructions.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+[0]+ <start>:
+[ ]+0:[ ]+003966b0[ ]+add r3,r25,r43
+[ ]+4:[ ]+00d80be0[ ]+add\.l r13,r2,r62
+[ ]+8:[ ]+d2c7d210[ ]+addi r44,500,r33
+[ ]+c:[ ]+d55832b0[ ]+addi\.l r21,-500,r43
+[ ]+10:[ ]+033ca9e0[ ]+addz\.l r51,r42,r30
+[ ]+14:[ ]+e1347bf0[ ]+alloco r19,960
+[ ]+18:[ ]+048be4c0[ ]+and r8,r57,r12
+[ ]+1c:[ ]+070f8d20[ ]+andc r48,r35,r18
+[ ]+20:[ ]+d987f660[ ]+andi r24,509,r38
+[ ]+24:[ ]+65719620[ ]+beq/l r23,r37,tr2
+[ ]+28:[ ]+65716e40[ ]+beq/l r23,r27,tr4
+[ ]+2c:[ ]+6431bc60[ ]+beq/u r3,r47,tr6
+[ ]+30:[ ]+e4417a50[ ]+beqi/l r4,30,tr5
+[ ]+34:[ ]+e4418600[ ]+beqi/l r4,-31,tr0
+[ ]+38:[ ]+e761a420[ ]+beqi/u r54,-23,tr2
+[ ]+3c:[ ]+6403fe70[ ]+bge/l r0,r63,tr7
+[ ]+40:[ ]+64a31a40[ ]+bge/l r10,r6,tr4
+[ ]+44:[ ]+64b39010[ ]+bge/u r11,r36,tr1
+[ ]+48:[ ]+65ebae30[ ]+bgeu/l r30,r43,tr3
+[ ]+4c:[ ]+64ab6a50[ ]+bgeu/l r10,r26,tr5
+[ ]+50:[ ]+673b9020[ ]+bgeu/u r51,r36,tr2
+[ ]+54:[ ]+6617b270[ ]+bgt/l r33,r44,tr7
+[ ]+58:[ ]+6517fa40[ ]+bgt/l r17,r62,tr4
+[ ]+5c:[ ]+64f71810[ ]+bgt/u r15,r6,tr1
+[ ]+60:[ ]+662f6e60[ ]+bgtu/l r34,r27,tr6
+[ ]+64:[ ]+65cffa00[ ]+bgtu/l r28,r62,tr0
+[ ]+68:[ ]+652f6450[ ]+bgtu/u r18,r25,tr5
+[ ]+6c:[ ]+4411fe60[ ]+blink tr1,r38
+[ ]+70:[ ]+67e5be00[ ]+bne/l r62,r47,tr0
+[ ]+74:[ ]+65d55a10[ ]+bne/l r29,r22,tr1
+[ ]+78:[ ]+6675bc60[ ]+bne/u r39,r47,tr6
+[ ]+7c:[ ]+e4e5ce70[ ]+bnei/l r14,-13,tr7
+[ ]+80:[ ]+e5857e30[ ]+bnei/l r24,31,tr3
+[ ]+84:[ ]+e765a820[ ]+bnei/u r54,-22,tr2
+[ ]+88:[ ]+6ff5fff0[ ]+brk
+[ ]+8c:[ ]+015ffcc0[ ]+byterev r21,r12
+[ ]+90:[ ]+00a12d50[ ]+cmpeq r10,r11,r21
+[ ]+94:[ ]+01e37f30[ ]+cmpgt r30,r31,r51
+[ ]+98:[ ]+017786d0[ ]+cmpgtu r23,r33,r45
+[ ]+9c:[ ]+22010ec0[ ]+cmveq r32,r3,r44
+[ ]+a0:[ ]+20d5f040[ ]+cmvne r13,r60,r4
+[ ]+a4:[ ]+19615be0[ ]+fabs\.d dr22,dr62
+[ ]+a8:[ ]+1bb0ed90[ ]+fabs\.s fr59,fr25
+[ ]+ac:[ ]+3681f140[ ]+fadd\.d dr40,dr60,dr20
+[ ]+b0:[ ]+3690ed30[ ]+fadd\.s fr41,fr59,fr19
+[ ]+b4:[ ]+3049cb90[ ]+fcmpeq\.d dr4,dr50,r57
+[ ]+b8:[ ]+32f87910[ ]+fcmpeq\.s fr47,fr30,r17
+[ ]+bc:[ ]+32cfd140[ ]+fcmpge\.d dr44,dr52,r20
+[ ]+c0:[ ]+325e5e00[ ]+fcmpge\.s fr37,fr23,r32
+[ ]+c4:[ ]+314d7330[ ]+fcmpgt\.d dr20,dr28,r51
+[ ]+c8:[ ]+32fc5560[ ]+fcmpgt\.s fr47,fr21,r22
+[ ]+cc:[ ]+320beaf0[ ]+fcmpun\.d dr32,dr58,r47
+[ ]+d0:[ ]+315aa8c0[ ]+fcmpun\.s fr21,fr42,r12
+[ ]+d4:[ ]+3a87a150[ ]+fcnv\.ds dr40,fr21
+[ ]+d8:[ ]+3ab6ae00[ ]+fcnv\.sd fr43,dr32
+[ ]+dc:[ ]+3625e140[ ]+fdiv\.d dr34,dr56,dr20
+[ ]+e0:[ ]+34d46930[ ]+fdiv\.s fr13,fr26,fr19
+[ ]+e4:[ ]+1ff2fe70[ ]+fgetscr fr39
+[ ]+e8:[ ]+14062270[ ]+fipr\.s fv0,fv8,fr39
+[ ]+ec:[ ]+9df3eb00[ ]+fld\.d r31,2000,dr48
+[ ]+f0:[ ]+9b5a2660[ ]+fld\.p r53,-3000,fp38
+[ ]+f4:[ ]+9757f750[ ]+fld\.s r53,2036,fr53
+[ ]+f8:[ ]+1d79a820[ ]+fldx\.d r23,r42,dr2
+[ ]+fc:[ ]+1c2d5a00[ ]+fldx\.p r2,r22,fp32
+[ ]+100:[ ]+1db8e8c0[ ]+fldx\.s r27,r58,fr12
+[ ]+104:[ ]+385e15c0[ ]+float\.ld fr5,dr28
+[ ]+108:[ ]+3b7cde40[ ]+float\.ls fr55,fr36
+[ ]+10c:[ ]+3acdb100[ ]+float\.qd dr44,dr16
+[ ]+110:[ ]+39ef78b0[ ]+float\.qs dr30,fr11
+[ ]+114:[ ]+368e9440[ ]+fmac\.s fr40,fr37,fr4
+[ ]+118:[ ]+38812280[ ]+fmov\.d dr8,dr40
+[ ]+11c:[ ]+33a1ea20[ ]+fmov\.dq dr58,r34
+[ ]+120:[ ]+1d90ff40[ ]+fmov\.ls r25,fr52
+[ ]+124:[ ]+1ed1ff20[ ]+fmov\.qd r45,dr50
+[ ]+128:[ ]+38401370[ ]+fmov\.s fr4,fr55
+[ ]+12c:[ ]+30e038f0[ ]+fmov\.sl fr14,r15
+[ ]+130:[ ]+3587eaa0[ ]+fmul\.d dr24,dr58,dr42
+[ ]+134:[ ]+35b68220[ ]+fmul\.s fr27,fr32,fr34
+[ ]+138:[ ]+18230800[ ]+fneg\.d dr2,dr0
+[ ]+13c:[ ]+18020210[ ]+fneg\.s fr0,fr33
+[ ]+140:[ ]+32c2b3f0[ ]+fputscr fr44
+[ ]+144:[ ]+39e57ac0[ ]+fsqrt\.d dr30,dr44
+[ ]+148:[ ]+38340d70[ ]+fsqrt\.s fr3,fr23
+[ ]+14c:[ ]+bc37d020[ ]+fst\.d r3,4000,dr2
+[ ]+150:[ ]+bb682cc0[ ]+fst\.p r54,-4008,fp12
+[ ]+154:[ ]+b5282570[ ]+fst\.s r18,-2012,fr23
+[ ]+158:[ ]+3d29b8c0[ ]+fstx\.d r18,r46,dr12
+[ ]+15c:[ ]+3e6d6b40[ ]+fstx\.p r38,r26,fp52
+[ ]+160:[ ]+3c785da0[ ]+fstx\.s r7,r23,fr26
+[ ]+164:[ ]+3403b200[ ]+fsub\.d dr0,dr44,dr32
+[ ]+168:[ ]+3432f830[ ]+fsub\.s fr3,fr62,fr3
+[ ]+16c:[ ]+3a6b9b50[ ]+ftrc\.dl dr38,fr53
+[ ]+170:[ ]+3ba8eb10[ ]+ftrc\.sl fr58,fr49
+[ ]+174:[ ]+38e939a0[ ]+ftrc\.dq dr14,dr26
+[ ]+178:[ ]+3bcaf160[ ]+ftrc\.sq fr60,dr22
+[ ]+17c:[ ]+150e81c0[ ]+ftrv\.s mtrx16,fv32,fv28
+[ ]+180:[ ]+c05fd7e0[ ]+getcfg r5,-11,r62
+[ ]+184:[ ]+274ffd00[ ]+getcon cr52,r16
+[ ]+188:[ ]+4465fda0[ ]+gettr tr6,r26
+[ ]+18c:[ ]+e3058bf0[ ]+icbi r48,-960
+[ ]+190:[ ]+83200fe0[ ]+ld\.b r50,3,r62
+[ ]+194:[ ]+885da560[ ]+ld\.l r5,-604,r22
+[ ]+198:[ ]+8e3cdea0[ ]+ld\.q r35,-1608,r42
+[ ]+19c:[ ]+935cdc20[ ]+ld\.ub r53,-201,r2
+[ ]+1a0:[ ]+b17cdea0[ ]+ld\.uw r23,-402,r42
+[ ]+1a4:[ ]+86e25cb0[ ]+ld\.w r46,302,r11
+[ ]+1a8:[ ]+c0668a90[ ]+ldhi\.l r6,-30,r41
+[ ]+1ac:[ ]+c2477df0[ ]+ldhi\.q r36,31,r31
+[ ]+1b0:[ ]+c1325300[ ]+ldlo\.l r19,20,r48
+[ ]+1b4:[ ]+c09381d0[ ]+ldlo\.q r9,-32,r29
+[ ]+1b8:[ ]+40500ef0[ ]+ldx\.b r5,r3,r47
+[ ]+1bc:[ ]+4192ace0[ ]+ldx\.l r25,r43,r14
+[ ]+1c0:[ ]+40c3f290[ ]+ldx\.q r12,r60,r41
+[ ]+1c4:[ ]+40d40010[ ]+ldx\.ub r13,r0,r1
+[ ]+1c8:[ ]+40d50910[ ]+ldx\.uw r13,r2,r17
+[ ]+1cc:[ ]+40a15bc0[ ]+ldx\.w r10,r22,r60
+[ ]+1d0:[ ]+287afe10[ ]+mabs\.l r7,r33
+[ ]+1d4:[ ]+2a59fe20[ ]+mabs\.w r37,r34
+[ ]+1d8:[ ]+0a228070[ ]+madd\.l r34,r32,r7
+[ ]+1dc:[ ]+0971d510[ ]+madd\.w r23,r53,r17
+[ ]+1e0:[ ]+09865c90[ ]+madds\.l r24,r23,r9
+[ ]+1e4:[ ]+0a245f10[ ]+madds\.ub r34,r23,r49
+[ ]+1e8:[ ]+08450bb0[ ]+madds\.w r4,r2,r59
+[ ]+1ec:[ ]+2960e1f0[ ]+mcmpeq\.b r22,r56,r31
+[ ]+1f0:[ ]+2952b7d0[ ]+mcmpeq\.l r21,r45,r61
+[ ]+1f4:[ ]+2a01d810[ ]+mcmpeq\.w r32,r54,r1
+[ ]+1f8:[ ]+28361130[ ]+mcmpgt\.l r3,r4,r19
+[ ]+1fc:[ ]+2a24d8d0[ ]+mcmpgt\.ub r34,r54,r13
+[ ]+200:[ ]+29751430[ ]+mcmpgt\.w r23,r5,r3
+[ ]+204:[ ]+4be3c9e0[ ]+mcmv r62,r50,r30
+[ ]+208:[ ]+4c2d1400[ ]+mcnvs\.lw r2,r5,r0
+[ ]+20c:[ ]+4d581ca0[ ]+mcnvs\.wb r21,r7,r10
+[ ]+210:[ ]+4d7cbcd0[ ]+mcnvs\.wub r23,r47,r13
+[ ]+214:[ ]+2847a470[ ]+mextr1 r4,r41,r7
+[ ]+218:[ ]+2a0b12f0[ ]+mextr2 r32,r4,r47
+[ ]+21c:[ ]+299fb9b0[ ]+mextr3 r25,r46,r27
+[ ]+220:[ ]+2f431820[ ]+mextr4 r52,r6,r2
+[ ]+224:[ ]+2d574150[ ]+mextr5 r21,r16,r21
+[ ]+228:[ ]+2d8bfaa0[ ]+mextr6 r24,r62,r42
+[ ]+22c:[ ]+2f9fb970[ ]+mextr7 r57,r46,r23
+[ ]+230:[ ]+48511020[ ]+mmacfx\.wl r5,r4,r2
+[ ]+234:[ ]+48b5b160[ ]+mmacnfx\.wl r11,r44,r22
+[ ]+238:[ ]+4d6286c0[ ]+mmul\.l r22,r33,r44
+[ ]+23c:[ ]+4cc18ef0[ ]+mmul\.w r12,r35,r47
+[ ]+240:[ ]+4fd69700[ ]+mmulfx\.l r61,r37,r48
+[ ]+244:[ ]+4c151c50[ ]+mmulfx\.w r1,r7,r5
+[ ]+248:[ ]+4ca99720[ ]+mmulfxrp\.w r10,r37,r50
+[ ]+24c:[ ]+4c0e1f70[ ]+mmulhi\.wl r0,r7,r55
+[ ]+250:[ ]+4caa6e30[ ]+mmullo\.wl r10,r27,r35
+[ ]+254:[ ]+4a998250[ ]+mmulsum\.wq r41,r32,r37
+[ ]+258:[ ]+cffe16b0[ ]+movi -123,r43
+[ ]+25c:[ ]+2b9d8040[ ]+mperm\.w r57,r32,r4
+[ ]+260:[ ]+48505d40[ ]+msad\.ubq r5,r23,r20
+[ ]+264:[ ]+0e363140[ ]+mshalds\.l r35,r12,r20
+[ ]+268:[ ]+0eb5d1e0[ ]+mshalds\.w r43,r52,r30
+[ ]+26c:[ ]+0c4a5e80[ ]+mshard\.l r4,r23,r40
+[ ]+270:[ ]+0d89f8a0[ ]+mshard\.w r24,r62,r10
+[ ]+274:[ ]+0c2b4320[ ]+mshards\.q r2,r16,r50
+[ ]+278:[ ]+2ea41bc0[ ]+mshfhi\.b r42,r6,r60
+[ ]+27c:[ ]+2f464bb0[ ]+mshfhi\.l r52,r18,r59
+[ ]+280:[ ]+2c857ee0[ ]+mshfhi\.w r8,r31,r46
+[ ]+284:[ ]+2dc09e90[ ]+mshflo\.b r28,r39,r41
+[ ]+288:[ ]+2dd29ab0[ ]+mshflo\.l r29,r38,r43
+[ ]+28c:[ ]+2de196c0[ ]+mshflo\.w r30,r37,r44
+[ ]+290:[ ]+0df292e0[ ]+mshlld\.l r31,r36,r46
+[ ]+294:[ ]+0e018ef0[ ]+mshlld\.w r32,r35,r47
+[ ]+298:[ ]+0e1e8b10[ ]+mshlrd\.l r33,r34,r49
+[ ]+29c:[ ]+0e2d8720[ ]+mshlrd\.w r34,r33,r50
+[ ]+2a0:[ ]+0a3a8340[ ]+msub\.l r35,r32,r52
+[ ]+2a4:[ ]+0a497f50[ ]+msub\.w r36,r31,r53
+[ ]+2a8:[ ]+0a5e7b70[ ]+msubs\.l r37,r30,r55
+[ ]+2ac:[ ]+0a6c7780[ ]+msubs\.ub r38,r29,r56
+[ ]+2b0:[ ]+0a7d73a0[ ]+msubs\.w r39,r28,r58
+[ ]+2b4:[ ]+03dea5a0[ ]+mulu\.l r61,r41,r26
+[ ]+2b8:[ ]+6ff0fff0[ ]+nop
+[ ]+2bc:[ ]+03cdfea0[ ]+nsb r60,r42
+[ ]+2c0:[ ]+e2b987f0[ ]+ocbi r43,-992
+[ ]+2c4:[ ]+e28883f0[ ]+ocbp r40,-1024
+[ ]+2c8:[ ]+e2cc7ff0[ ]+ocbwb r44,992
+[ ]+2cc:[ ]+07b90e80[ ]+or r59,r3,r40
+[ ]+2d0:[ ]+dfa4e680[ ]+ori r58,313,r40
+[ ]+2d4:[ ]+e391fff0[ ]+prefi r57,-32
+[ ]+2d8:[ ]+6bf1e260[ ]+ptabs/l r56,tr6
+[ ]+2dc:[ ]+6bf1fe60[ ]+ptabs/l r63,tr6
+[ ]+2e0:[ ]+6bf1f060[ ]+ptabs/u r60,tr6
+[ ]+2e4:[ ]+6bf5de30[ ]+ptrel/l r55,tr3
+[ ]+2e8:[ ]+6bf53e30[ ]+ptrel/l r15,tr3
+[ ]+2ec:[ ]+6bf5fc30[ ]+ptrel/u r63,tr3
+[ ]+2f0:[ ]+e29fd7e0[ ]+putcfg r41,-11,r62
+[ ]+2f4:[ ]+6e8ffde0[ ]+putcon r40,cr30
+[ ]+2f8:[ ]+6ff3fff0[ ]+rte
+[ ]+2fc:[ ]+0727a930[ ]+shard r50,r42,r19
+[ ]+300:[ ]+0746a540[ ]+shard\.l r52,r41,r20
+[ ]+304:[ ]+c757a150[ ]+shari r53,40,r21
+[ ]+308:[ ]+c7769d60[ ]+shari\.l r55,39,r22
+[ ]+30c:[ ]+07819970[ ]+shlld r56,r38,r23
+[ ]+310:[ ]+07909580[ ]+shlld\.l r57,r37,r24
+[ ]+314:[ ]+c7c19190[ ]+shlli r60,36,r25
+[ ]+318:[ ]+c7d07da0[ ]+shlli\.l r61,31,r26
+[ ]+31c:[ ]+07f389b0[ ]+shlrd r63,r34,r27
+[ ]+320:[ ]+040285c0[ ]+shlrd\.l r0,r33,r28
+[ ]+324:[ ]+c42381d0[ ]+shlri r2,32,r29
+[ ]+328:[ ]+c4327de0[ ]+shlri\.l r3,31,r30
+[ ]+32c:[ ]+cbff70d0[ ]+shori 65500,r13
+[ ]+330:[ ]+6ff7fff0[ ]+sleep
+[ ]+334:[ ]+a057d5d0[ ]+st\.b r5,501,r29
+[ ]+338:[ ]+a867cdf0[ ]+st\.l r6,1996,r31
+[ ]+33c:[ ]+ac77d600[ ]+st\.q r7,4008,r32
+[ ]+340:[ ]+a497d610[ ]+st\.w r9,1002,r33
+[ ]+344:[ ]+e0a6b2b0[ ]+sthi\.l r10,-20,r43
+[ ]+348:[ ]+e0c75ec0[ ]+sthi\.q r12,23,r44
+[ ]+34c:[ ]+e0d296d0[ ]+stlo\.l r13,-27,r45
+[ ]+350:[ ]+e0f356e0[ ]+stlo\.q r15,21,r46
+[ ]+354:[ ]+610076f0[ ]+stx\.b r16,r29,r47
+[ ]+358:[ ]+6112cb00[ ]+stx\.l r17,r50,r48
+[ ]+35c:[ ]+6133c710[ ]+stx\.q r19,r49,r49
+[ ]+360:[ ]+61413f20[ ]+stx\.w r20,r15,r50
+[ ]+364:[ ]+016b7730[ ]+sub r22,r29,r51
+[ ]+368:[ ]+017a7340[ ]+sub\.l r23,r28,r52
+[ ]+36c:[ ]+21936f50[ ]+swap\.q r25,r27,r53
+[ ]+370:[ ]+6ff2fff0[ ]+synci
+[ ]+374:[ ]+6ff6fff0[ ]+synco
+[ ]+378:[ ]+6da1fff0[ ]+trapa r26
+[ ]+37c:[ ]+05cd6b60[ ]+xor r28,r26,r54
+[ ]+380:[ ]+c5dd7f70[ ]+xori r29,31,r55
+[ ]+384:[ ]+047ed510[ ]+muls\.l r7,r53,r17
diff --git a/gas/testsuite/gas/sh/sh64/basic-1.s b/gas/testsuite/gas/sh/sh64/basic-1.s
new file mode 100644
index 0000000..057667e
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/basic-1.s
@@ -0,0 +1,233 @@
+! Various straightforward insn tests, one per insns basic insn format.
+! No insns with strange relocs. The insns are from the alphabetical list
+! in SH-5/ST50-023-04.
+
+ .text
+start:
+ add r3,r25,r43
+ add.l r13,r2,r62
+ addi r44,500,r33
+ addi.l r21,-500,r43
+ addz.l r51,r42,r30
+ alloco r19,960
+ and r8,r57,r12
+ andc r48,r35,r18
+ andi r24,509,r38
+ beq r23,r37,tr2
+ beq/l r23,r27,tr4
+ beq/u r3,r47,tr6
+ beqi r4,30,tr5
+ beqi/l r4,-31,tr0
+ beqi/u r54,-23,tr2
+ bge r0,r63,tr7
+ bge/l r10,r6,tr4
+ bge/u r11,r36,tr1
+ bgeu r30,r43,tr3
+ bgeu/l r10,r26,tr5
+ bgeu/u r51,r36,tr2
+ bgt r33,r44,tr7
+ bgt/l r17,r62,tr4
+ bgt/u r15,r6,tr1
+ bgtu r34,r27,tr6
+ bgtu/l r28,r62,tr0
+ bgtu/u r18,r25,tr5
+ blink tr1,r38
+ bne r62,r47,tr0
+ bne/l r29,r22,tr1
+ bne/u r39,r47,tr6
+ bnei r14,-13,tr7
+ bnei/l r24,31,tr3
+ bnei/u r54,-22,tr2
+ brk
+ byterev r21,r12
+ cmpeq r10,r11,r21
+ cmpgt r30,r31,r51
+ cmpgtu r23,r33,r45
+ cmveq r32,r3,r44
+ cmvne r13,r60,r4
+ fabs.d dr22,dr62
+ fabs.s fr59,fr25
+ fadd.d dr40,dr60,dr20
+ fadd.s fr41,fr59,fr19
+ fcmpeq.d dr4,dr50,r57
+ fcmpeq.s fr47,fr30,r17
+ fcmpge.d dr44,dr52,r20
+ fcmpge.s fr37,fr23,r32
+ fcmpgt.d dr20,dr28,r51
+ fcmpgt.s fr47,fr21,r22
+ fcmpun.d dr32,dr58,r47
+ fcmpun.s fr21,fr42,r12
+ fcnv.ds dr40,fr21
+ fcnv.sd fr43,dr32
+ fdiv.d dr34,dr56,dr20
+ fdiv.s fr13,fr26,fr19
+ fgetscr fr39
+ fipr.s fv0,fv8,fr39
+ fld.d r31,2000,dr48
+ fld.p r53,-3000,fp38
+ fld.s r53,2036,fr53
+ fldx.d r23,r42,dr2
+ fldx.p r2,r22,fp32
+ fldx.s r27,r58,fr12
+ float.ld fr5,dr28
+ float.ls fr55,fr36
+ float.qd dr44,dr16
+ float.qs dr30,fr11
+ fmac.s fr40,fr37,fr4
+ fmov.d dr8,dr40
+ fmov.dq dr58,r34
+ fmov.ls r25,fr52
+ fmov.qd r45,dr50
+ fmov.s fr4,fr55
+ fmov.sl fr14,r15
+ fmul.d dr24,dr58,dr42
+ fmul.s fr27,fr32,fr34
+ fneg.d dr2,dr0
+ fneg.s fr0,fr33
+ fputscr fr44
+ fsqrt.d dr30,dr44
+ fsqrt.s fr3,fr23
+ fst.d r3,4000,dr2
+ fst.p r54,-4008,fp12
+ fst.s r18,-2012,fr23
+ fstx.d r18,r46,dr12
+ fstx.p r38,r26,fp52
+ fstx.s r7,r23,fr26
+ fsub.d dr0,dr44,dr32
+ fsub.s fr3,fr62,fr3
+ ftrc.dl dr38,fr53
+ ftrc.sl fr58,fr49
+ ftrc.dq dr14,dr26
+ ftrc.sq fr60,dr22
+ ftrv.s mtrx16,fv32,fv28
+ getcfg r5,-11,r62
+ getcon cr52,r16
+ gettr tr6,r26
+ icbi r48,-960
+ ld.b r50,3,r62
+ ld.l r5,-604,r22
+ ld.q r35,-1608,r42
+ ld.ub r53,-201,r2
+ ld.uw r23,-402,r42
+ ld.w r46,302,r11
+ ldhi.l r6,-30,r41
+ ldhi.q r36,31,r31
+ ldlo.l r19,20,r48
+ ldlo.q r9,-32,r29
+ ldx.b r5,r3,r47
+ ldx.l r25,r43,r14
+ ldx.q r12,r60,r41
+ ldx.ub r13,r0,r1
+ ldx.uw r13,r2,r17
+ ldx.w r10,r22,r60
+ mabs.l r7,r33
+ mabs.w r37,r34
+ madd.l r34,r32,r7
+ madd.w r23,r53,r17
+ madds.l r24,r23,r9
+ madds.ub r34,r23,r49
+ madds.w r4,r2,r59
+ mcmpeq.b r22,r56,r31
+ mcmpeq.l r21,r45,r61
+ mcmpeq.w r32,r54,r1
+ mcmpgt.l r3,r4,r19
+ mcmpgt.ub r34,r54,r13
+ mcmpgt.w r23,r5,r3
+ mcmv r62,r50,r30
+ mcnvs.lw r2,r5,r0
+ mcnvs.wb r21,r7,r10
+ mcnvs.wub r23,r47,r13
+ mextr1 r4,r41,r7
+ mextr2 r32,r4,r47
+ mextr3 r25,r46,r27
+ mextr4 r52,r6,r2
+ mextr5 r21,r16,r21
+ mextr6 r24,r62,r42
+ mextr7 r57,r46,r23
+ mmacfx.wl r5,r4,r2
+ mmacnfx.wl r11,r44,r22
+ mmul.l r22,r33,r44
+ mmul.w r12,r35,r47
+ mmulfx.l r61,r37,r48
+ mmulfx.w r1,r7,r5
+ mmulfxrp.w r10,r37,r50
+ mmulhi.wl r0,r7,r55
+ mmullo.wl r10,r27,r35
+ mmulsum.wq r41,r32,r37
+ movi -123,r43
+ mperm.w r57,r32,r4
+ msad.ubq r5,r23,r20
+ mshalds.l r35,r12,r20
+ mshalds.w r43,r52,r30
+ mshard.l r4,r23,r40
+ mshard.w r24,r62,r10
+ mshards.q r2,r16,r50
+ mshfhi.b r42,r6,r60
+ mshfhi.l r52,r18,r59
+ mshfhi.w r8,r31,r46
+ mshflo.b r28,r39,r41
+ mshflo.l r29,r38,r43
+ mshflo.w r30,r37,r44
+ mshlld.l r31,r36,r46
+ mshlld.w r32,r35,r47
+ mshlrd.l r33,r34,r49
+ mshlrd.w r34,r33,r50
+ msub.l r35,r32,r52
+ msub.w r36,r31,r53
+ msubs.l r37,r30,r55
+ msubs.ub r38,r29,r56
+ msubs.w r39,r28,r58
+ mulu.l r61,r41,r26
+ nop
+ nsb r60,r42
+ ocbi r43,-992
+ ocbp r40,-1024
+ ocbwb r44,992
+ or r59,r3,r40
+ ori r58,313,r40
+ prefi r57,-32
+! Note: pta, ptb are not here.
+ ptabs r56,tr6
+ ptabs/l r63,tr6
+ ptabs/u r60,tr6
+ ptrel r55,tr3
+ ptrel/l r15,tr3
+ ptrel/u r63,tr3
+ putcfg r41,-11,r62
+ putcon r40,cr30
+ rte
+ shard r50,r42,r19
+ shard.l r52,r41,r20
+ shari r53,40,r21
+ shari.l r55,39,r22
+ shlld r56,r38,r23
+ shlld.l r57,r37,r24
+ shlli r60,36,r25
+ shlli.l r61,31,r26
+ shlrd r63,r34,r27
+ shlrd.l r0,r33,r28
+ shlri r2,32,r29
+ shlri.l r3,31,r30
+ shori 65500,r13
+ sleep
+ st.b r5,501,r29
+ st.l r6,1996,r31
+ st.q r7,4008,r32
+ st.w r9,1002,r33
+ sthi.l r10,-20,r43
+ sthi.q r12,23,r44
+ stlo.l r13,-27,r45
+ stlo.q r15,21,r46
+ stx.b r16,r29,r47
+ stx.l r17,r50,r48
+ stx.q r19,r49,r49
+ stx.w r20,r15,r50
+ sub r22,r29,r51
+ sub.l r23,r28,r52
+ swap.q r25,r27,r53
+ synci
+ synco
+ trapa r26
+ xor r28,r26,r54
+ xori r29,31,r55
+ muls.l r7,r53,r17
diff --git a/gas/testsuite/gas/sh/sh64/case-1.d b/gas/testsuite/gas/sh/sh64/case-1.d
new file mode 100644
index 0000000..4692356
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/case-1.d
@@ -0,0 +1,23 @@
+#as: --abi=32
+#objdump: -dr
+#name: Case-insensitive registers and opcodes.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+[ ]+4:[ ]+6ff0fff0[ ]+nop
+[ ]+8:[ ]+cc000190[ ]+movi 0,r25
+[ ]+8:[ ]+R_SH_IMM_MEDLOW16_PCREL foo\+0xf*ff8
+[ ]+c:[ ]+c8000190[ ]+shori 0,r25
+[ ]+c:[ ]+R_SH_IMM_LOW16_PCREL foo\+0xf*ffc
+[ ]+10:[ ]+6bf56440[ ]+ptrel/u r25,tr4
+[ ]+14:[ ]+cc000190[ ]+movi 0,r25
+[ ]+14:[ ]+R_SH_IMM_MEDLOW16_PCREL bar\+0xf*ff8
+[ ]+18:[ ]+c8000190[ ]+shori 0,r25
+[ ]+18:[ ]+R_SH_IMM_LOW16_PCREL bar\+0xf*ffc
+[ ]+1c:[ ]+6bf56630[ ]+ptrel/l r25,tr3
+[ ]+20:[ ]+cc00a820[ ]+movi 42,r2
+[ ]+24:[ ]+ebffde20[ ]+pta/l 0 <start>,tr2
diff --git a/gas/testsuite/gas/sh/sh64/case-1.s b/gas/testsuite/gas/sh/sh64/case-1.s
new file mode 100644
index 0000000..b9757bc
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/case-1.s
@@ -0,0 +1,12 @@
+! Tests that opcodes and common registers are recognized case-insensitive,
+! and also that the option --isa=shmedia is optional.
+
+ .mode SHmedia
+ .text
+start:
+ nOp
+ NOP
+ pt/U foo,tr4
+ PTA/l bar,Tr3
+ MOVI 42,R2
+ PTA/L start,TR2
diff --git a/gas/testsuite/gas/sh/sh64/case-noexp-1.d b/gas/testsuite/gas/sh/sh64/case-noexp-1.d
new file mode 100644
index 0000000..a2070ac
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/case-noexp-1.d
@@ -0,0 +1,18 @@
+#as: --abi=32 -no-expand
+#objdump: -dr
+#source: case-1.s
+#name: Case-insensitive registers and opcodes with -no-expand.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+[ ]+4:[ ]+6ff0fff0[ ]+nop
+[ ]+8:[ ]+e8000040[ ]+pta/u 8 <start\+0x8>,tr4
+[ ]+8:[ ]+R_SH_PT_16 foo
+[ ]+c:[ ]+e8000630[ ]+pta/l 10 <start\+0x10>,tr3
+[ ]+c:[ ]+R_SH_PT_16 bar
+[ ]+10:[ ]+cc00a820[ ]+movi 42,r2
+[ ]+14:[ ]+ebffee20[ ]+pta/l 0 <start>,tr2
diff --git a/gas/testsuite/gas/sh/sh64/crange1-1.d b/gas/testsuite/gas/sh/sh64/crange1-1.d
new file mode 100644
index 0000000..3dcbceb
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/crange1-1.d
@@ -0,0 +1,105 @@
+#as: --abi=32
+#objdump: -sr
+#source: crange1.s
+#name: .cranges descriptors.
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.cranges\]:
+OFFSET *TYPE *VALUE
+0+00 R_SH_DIR32 \.text\.shmediaanddata
+0+0a R_SH_DIR32 \.text\.codemix
+0+14 R_SH_DIR32 \.text\.codemixconst
+0+1e R_SH_DIR32 \.text\.codemixconst
+0+28 R_SH_DIR32 \.text\.codemixconst2
+0+32 R_SH_DIR32 \.text\.codemixconst2
+0+3c R_SH_DIR32 \.text\.codemixconst2
+0+46 R_SH_DIR32 \.text\.codemixconst2
+0+50 R_SH_DIR32 \.text\.codemixconst2
+0+5a R_SH_DIR32 \.text\.shmediaanddata
+0+64 R_SH_DIR32 \.text\.codemix
+0+6e R_SH_DIR32 \.text\.codemixconst
+0+78 R_SH_DIR32 \.text\.codemixconst2
+
+
+Contents of section \.text:
+ 0000 6ff0fff0 cc00aad0 cc0022e0 6ff0fff0 .*
+Contents of section \.data:
+Contents of section \.text\.compact:
+ 0000 0009e02a 89000009 0009 .*
+Contents of section \.text\.shmediaanddata:
+ 0000 cc00aad0 cc0022e0 6ff0fff0 00000014 .*
+ 0010 00000032 .*
+Contents of section \.cranges:
+ 0000 00000000 00000008 00030000 00000000 .*
+ 0010 00180003 00000000 0000001c 00030000 .*
+ 0020 001c0000 00200001 00000000 00000024 .*
+ 0030 00030000 00240000 00280001 0000004c .*
+ 0040 000000e8 00020000 01340000 002c0003 .*
+ 0050 00000160 0000001a 00010000 00080000 .*
+ 0060 000c0001 00000018 0000000e 00020000 .*
+ 0070 003c0000 007e0002 0000017a 00000156 .*
+ 0080 0002 .*
+Contents of section \.text\.codemix:
+ 0000 cc00aad0 6ff0fff0 6ff0fff0 cc0062e0 .*
+ 0010 6ff0fff0 6ff0fff0 0009e028 00090009 .*
+ 0020 89000009 0009 .*
+Contents of section \.text\.codemixconst:
+ 0000 6ff0fff0 cc00aad0 6ff0fff0 6ff0fff0 .*
+ 0010 cc00e2e0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0020 6ff0fff0 6ff00000 0000fff0 6ff0fff0 .*
+ 0030 6ff0fff0 00000000 000000b1 0009e02b .*
+ 0040 00090009 89020009 00090009 00090000 .*
+ 0050 00000000 00000000 00000000 00000000 .*
+ 0060 00000000 00000000 00000000 00000000 .*
+ 0070 00000000 00000000 00000000 00000000 .*
+ 0080 00000000 00000000 00000000 00000000 .*
+ 0090 00000000 00000000 00000000 00000000 .*
+ 00a0 00000000 00000000 00000000 00000000 .*
+ 00b0 00000000 00000000 007c .*
+Contents of section \.text\.codemixconst2:
+ 0000 6ff0fff0 cc00aad0 6ff0fff0 6ff0fff0 .*
+ 0010 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0020 cc0122e0 6ff0fff0 00000000 00000000 .*
+ 0030 00000000 00000000 00000000 00000000 .*
+ 0040 00000000 00000000 00000044 0009e02c .*
+ 0050 00090009 89040009 00090009 00090009 .*
+ 0060 00090009 09000000 00000000 00000000 .*
+ 0070 00000000 00000000 00000000 00000000 .*
+ 0080 00000000 00000000 00000000 00000000 .*
+ 0090 00000000 00000000 00000000 00000000 .*
+ 00a0 00000000 00000000 00000000 00000000 .*
+ 00b0 00000000 00000000 00000000 00000000 .*
+ 00c0 00000000 00000000 00000000 00000000 .*
+ 00d0 00000000 00000000 00000000 00000000 .*
+ 00e0 00000000 00000000 00000000 00000000 .*
+ 00f0 00000000 00000000 00000000 00000000 .*
+ 0100 00000000 00000000 00000000 00000000 .*
+ 0110 00000000 00000000 00000000 00000000 .*
+ 0120 00000000 00000000 00000000 00000000 .*
+ 0130 000000e6 6ff0fff0 cc00aed0 6ff0fff0 .*
+ 0140 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0150 6ff0fff0 6ff0fff0 6ff0fff0 cc010ae0 .*
+ 0160 6ff0fff0 00000000 00000000 00000000 .*
+ 0170 00000000 00000000 00420009 e00e0009 .*
+ 0180 0009890a 00090009 00090009 00090009 .*
+ 0190 00090009 00090009 00090009 00000000 .*
+ 01a0 00000000 00000000 00000000 00000000 .*
+ 01b0 00000000 00000000 00000000 00000000 .*
+ 01c0 00000000 00000000 00000000 00000000 .*
+ 01d0 00000000 00000000 00000000 00000000 .*
+ 01e0 00000000 00000000 00000000 00000000 .*
+ 01f0 00000000 00000000 00000000 00000000 .*
+ 0200 00000000 00000000 00000000 00000000 .*
+ 0210 00000000 00000000 00000000 00000000 .*
+ 0220 00000000 00000000 00000000 00000000 .*
+ 0230 00000000 00000000 00000000 00000000 .*
+ 0240 00000000 00000000 00000000 00000000 .*
+ 0250 00000000 00000000 00000000 00000000 .*
+ 0260 00000000 00000000 00000000 00000000 .*
+ 0270 00000000 00000000 00000000 00000000 .*
+ 0280 00000000 00000000 00000000 00000000 .*
+ 0290 00000000 00000000 00000000 00000000 .*
+ 02a0 00000000 00000000 00000000 00000000 .*
+ 02b0 00000000 00000000 00000000 00000000 .*
+ 02c0 00000000 00000000 00000000 00000154 .*
diff --git a/gas/testsuite/gas/sh/sh64/crange1-2.d b/gas/testsuite/gas/sh/sh64/crange1-2.d
new file mode 100644
index 0000000..f4ae83b
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/crange1-2.d
@@ -0,0 +1,109 @@
+#as: --abi=32 -shcompact-const-crange
+#objdump: -sr
+#source: crange1.s
+#name: .cranges descriptors including SHcompact constant pool
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.cranges\]:
+OFFSET *TYPE *VALUE
+0+00 R_SH_DIR32 \.text\.shmediaanddata
+0+0a R_SH_DIR32 \.text\.codemix
+0+14 R_SH_DIR32 \.text\.codemixconst
+0+1e R_SH_DIR32 \.text\.codemixconst
+0+28 R_SH_DIR32 \.text\.codemixconst
+0+32 R_SH_DIR32 \.text\.codemixconst2
+0+3c R_SH_DIR32 \.text\.codemixconst2
+0+46 R_SH_DIR32 \.text\.codemixconst2
+0+50 R_SH_DIR32 \.text\.codemixconst2
+0+5a R_SH_DIR32 \.text\.codemixconst2
+0+64 R_SH_DIR32 \.text\.codemixconst2
+0+6e R_SH_DIR32 \.text\.codemixconst2
+0+78 R_SH_DIR32 \.text\.shmediaanddata
+0+82 R_SH_DIR32 \.text\.codemix
+0+8c R_SH_DIR32 \.text\.codemixconst
+0+96 R_SH_DIR32 \.text\.codemixconst2
+
+
+Contents of section \.text:
+ 0000 6ff0fff0 cc00aad0 cc0022e0 6ff0fff0 .*
+Contents of section \.data:
+Contents of section \.text\.compact:
+ 0000 0009e02a 89000009 0009 .*
+Contents of section \.text\.shmediaanddata:
+ 0000 cc00aad0 cc0022e0 6ff0fff0 00000014 .*
+ 0010 00000032 .*
+Contents of section \.cranges:
+ 0000 00000000 00000008 00030000 00000000 .*
+ 0010 00180003 00000000 0000001c 00030000 .*
+ 0020 001c0000 00200001 0000003c 00000012 .*
+ 0030 00020000 00000000 00240003 00000024 .*
+ 0040 00000028 00010000 004c0000 00160002 .*
+ 0050 00000062 000000d2 00010000 01340000 .*
+ 0060 002c0003 00000160 0000001a 00010000 .*
+ 0070 017a0000 00220002 00000008 0000000c .*
+ 0080 00010000 00180000 000e0002 0000004e .*
+ 0090 0000006c 00010000 019c0000 01340001 .*
+Contents of section \.text\.codemix:
+ 0000 cc00aad0 6ff0fff0 6ff0fff0 cc0062e0 .*
+ 0010 6ff0fff0 6ff0fff0 0009e028 00090009 .*
+ 0020 89000009 0009 .*
+Contents of section \.text\.codemixconst:
+ 0000 6ff0fff0 cc00aad0 6ff0fff0 6ff0fff0 .*
+ 0010 cc00e2e0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0020 6ff0fff0 6ff00000 0000fff0 6ff0fff0 .*
+ 0030 6ff0fff0 00000000 000000b1 0009e02b .*
+ 0040 00090009 89020009 00090009 00090000 .*
+ 0050 00000000 00000000 00000000 00000000 .*
+ 0060 00000000 00000000 00000000 00000000 .*
+ 0070 00000000 00000000 00000000 00000000 .*
+ 0080 00000000 00000000 00000000 00000000 .*
+ 0090 00000000 00000000 00000000 00000000 .*
+ 00a0 00000000 00000000 00000000 00000000 .*
+ 00b0 00000000 00000000 007c .*
+Contents of section \.text\.codemixconst2:
+ 0000 6ff0fff0 cc00aad0 6ff0fff0 6ff0fff0 .*
+ 0010 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0020 cc0122e0 6ff0fff0 00000000 00000000 .*
+ 0030 00000000 00000000 00000000 00000000 .*
+ 0040 00000000 00000000 00000044 0009e02c .*
+ 0050 00090009 89040009 00090009 00090009 .*
+ 0060 00090009 09000000 00000000 00000000 .*
+ 0070 00000000 00000000 00000000 00000000 .*
+ 0080 00000000 00000000 00000000 00000000 .*
+ 0090 00000000 00000000 00000000 00000000 .*
+ 00a0 00000000 00000000 00000000 00000000 .*
+ 00b0 00000000 00000000 00000000 00000000 .*
+ 00c0 00000000 00000000 00000000 00000000 .*
+ 00d0 00000000 00000000 00000000 00000000 .*
+ 00e0 00000000 00000000 00000000 00000000 .*
+ 00f0 00000000 00000000 00000000 00000000 .*
+ 0100 00000000 00000000 00000000 00000000 .*
+ 0110 00000000 00000000 00000000 00000000 .*
+ 0120 00000000 00000000 00000000 00000000 .*
+ 0130 000000e6 6ff0fff0 cc00aed0 6ff0fff0 .*
+ 0140 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0150 6ff0fff0 6ff0fff0 6ff0fff0 cc010ae0 .*
+ 0160 6ff0fff0 00000000 00000000 00000000 .*
+ 0170 00000000 00000000 00420009 e00e0009 .*
+ 0180 0009890a 00090009 00090009 00090009 .*
+ 0190 00090009 00090009 00090009 00000000 .*
+ 01a0 00000000 00000000 00000000 00000000 .*
+ 01b0 00000000 00000000 00000000 00000000 .*
+ 01c0 00000000 00000000 00000000 00000000 .*
+ 01d0 00000000 00000000 00000000 00000000 .*
+ 01e0 00000000 00000000 00000000 00000000 .*
+ 01f0 00000000 00000000 00000000 00000000 .*
+ 0200 00000000 00000000 00000000 00000000 .*
+ 0210 00000000 00000000 00000000 00000000 .*
+ 0220 00000000 00000000 00000000 00000000 .*
+ 0230 00000000 00000000 00000000 00000000 .*
+ 0240 00000000 00000000 00000000 00000000 .*
+ 0250 00000000 00000000 00000000 00000000 .*
+ 0260 00000000 00000000 00000000 00000000 .*
+ 0270 00000000 00000000 00000000 00000000 .*
+ 0280 00000000 00000000 00000000 00000000 .*
+ 0290 00000000 00000000 00000000 00000000 .*
+ 02a0 00000000 00000000 00000000 00000000 .*
+ 02b0 00000000 00000000 00000000 00000000 .*
+ 02c0 00000000 00000000 00000000 00000154 .*
diff --git a/gas/testsuite/gas/sh/sh64/crange1.s b/gas/testsuite/gas/sh/sh64/crange1.s
new file mode 100644
index 0000000..e654bb2
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/crange1.s
@@ -0,0 +1,210 @@
+! Test that .cranges are emitted:
+! 1) Not for sections with single contents.
+! 2) For data (through pseudo-ops) in SHmedia.
+! 3) For mixed SHcompact and SHmedia sections.
+! 4) For a mix of 2 and 3
+! 5) For 4, repeated.
+!
+! Use section contents that need relaxing to strengthen the check that the
+! .cranges implementation handles this correctly. Use different sizes for
+! each contents part.
+!
+
+! The .text section has only SHmedia contents, and should not get a
+! .cranges descriptor.
+ .mode SHmedia
+ .text
+ nop
+shmedia:
+ movi 42,r45
+ movi shmediaend-shmedia,r46
+shmediaend:
+ nop
+
+! Likewise the SHcompact section.
+ .mode SHcompact
+ .section .text.compact,"ax"
+ nop
+shcompact:
+ mov #42,r0
+ bt shcompactend
+ nop
+shcompactend:
+ nop
+
+! This section has SHmedia code followed by data. There should be two
+! .cranges descriptors. Note that we put the .mode directive *after* the
+! section change. It should not matter.
+ .section .text.shmediaanddata,"ax"
+ .mode SHmedia
+shmedia_data_code:
+ movi 42,r45
+ movi shmedia_data_code_end-shmedia_data_code,r46
+shmedia_data_code_end:
+ .long 0x6ff0fff0
+ .long shmedia_dataend-shmedia_data_code
+ .long 50
+shmedia_dataend:
+
+! This section mixes SHcompact and SHmedia code. There should be two
+! .cranges descriptors.
+ .section .text.codemix,"ax"
+shmedia_compact_code:
+ movi 42,r45
+ nop
+ nop
+ movi shmedia_compact_code_end-shmedia_compact_code,r46
+ nop
+ nop
+shmedia_compact_code_end:
+ .mode SHcompact
+compact_code:
+ nop
+compact:
+ mov #40,r0
+ nop
+ nop
+ bt compactend
+ nop
+compactend:
+ nop
+
+! This section mixes SHcompact and SHmedia code, and has a constant
+! section after the SHmedia code and one after the SHcompact code. There
+! should be three or four .cranges descriptors, depending on whether one
+! is emitted for the SHcompact constant pool: there's normally one such
+! after each SHcompact function.
+ .mode SHmedia
+ .section .text.codemixconst,"ax"
+ nop
+shmedia_compact_code2:
+ movi 42,r45
+ nop
+ nop
+ movi shmedia_compact_code_end2-shmedia_compact_code2,r46
+ nop
+ nop
+ .long 0x6ff0fff0
+ .long 0x6ff0fff0
+ .long 0x6ff00000
+ .long 0xfff0
+ .long 0x6ff0fff0
+ .long 0x6ff0fff0
+ .long 0
+mediapoollabel:
+ .long mediapoollabel2-shmedia_compact_code2
+mediapoolend:
+shmedia_compact_code_end2:
+ .mode SHcompact
+compact_code2:
+ nop
+compact2:
+ mov #43,r0
+ nop
+ nop
+ bt compactend2
+ nop
+ nop
+ nop
+compactend2:
+ nop
+ .space 100,0
+ .long 0
+mediapoollabel2:
+ .long mediapoolend2-compact2
+mediapoolend2:
+
+! This section is like the previous, but repeated twice and adjusted to
+! keep different sizes of each part.
+ .mode SHmedia
+ .section .text.codemixconst2,"ax"
+ nop
+shmedia_compact_code3:
+ movi 42,r45
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ movi shmedia_compact_code_end3-shmedia_compact_code3,r46
+ .long 0x6ff0fff0
+ .long 0
+ .long 0
+ .long 0
+ .long 0
+ .long 0
+ .long 0
+ .long 0
+ .long 0
+mediapoollabel3a:
+ .long mediapoollabel3a-shmedia_compact_code3
+mediapoolend3a:
+shmedia_compact_code_end3:
+ .mode SHcompact
+compact_code3:
+ nop
+compact3:
+ mov #44,r0
+ nop
+ nop
+ bt compactend3
+ nop
+ nop
+ nop
+ nop
+ nop
+compactend3:
+ nop
+ .word 9
+ .word 0x900
+ .space 198,0
+ .long 0
+mediapoollabel3:
+ .long mediapoolend3-compact3
+mediapoolend3:
+ .mode SHmedia
+ nop
+shmedia_compact_code4:
+ movi 43,r45
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ movi shmedia_compact_code_end4-shmedia_compact_code4,r46
+ .long 0x6ff0fff0
+ .space 18,0
+mediapoollabel4a:
+ .long mediapoolend4a-shmedia_compact_code4
+mediapoolend4a:
+shmedia_compact_code_end4:
+ .mode SHcompact
+compact_code4:
+ nop
+compact4:
+ mov #14,r0
+ nop
+ nop
+ bt compactend4
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+compactend4:
+ nop
+ .space 300,0
+ .long 0
+mediapoollabel4:
+ .long mediapoolend4-compact4
+mediapoolend4:
diff --git a/gas/testsuite/gas/sh/sh64/crange2-1.d b/gas/testsuite/gas/sh/sh64/crange2-1.d
new file mode 100644
index 0000000..8cfc0cc
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/crange2-1.d
@@ -0,0 +1,43 @@
+#as: --abi=32
+#objdump: -dr
+#source: crange2.s
+#name: PT to SHcompact
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+0+ <shmedia>:
+[ ]+0:[ ]+e8000a30[ ]+pta/l 8 <shmedia1>,tr3
+[ ]+4:[ ]+ec001240[ ]+ptb/l 14 <shcompact1>,tr4
+
+0+8 <shmedia1>:
+[ ]+8:[ ]+ec001250[ ]+ptb/l 18 <shcompact2>,tr5
+
+0+c <shmedia2>:
+[ ]+c:[ ]+6ff0fff0[ ]+nop
+
+0+10[ ]+<shcompact>:
+[ ]+10:[ ]+00[ ]+09[ ]+nop
+[ ]+12:[ ]+00[ ]+09[ ]+nop
+
+0+14 <shcompact1>:
+[ ]+14:[ ]+00[ ]+09[ ]+nop
+[ ]+16:[ ]+00[ ]+09[ ]+nop
+
+0+18 <shcompact2>:
+[ ]+18:[ ]+00[ ]+09[ ]+nop
+[ ]+1a:[ ]+00[ ]+09[ ]+nop
+
+0+1c <shcompact3>:
+[ ]+1c:[ ]+00[ ]+09[ ]+nop
+[ ]+1e:[ ]+00[ ]+09[ ]+nop
+
+0+20[ ]+<shcompact4>:
+[ ]+20:[ ]+00[ ]+09[ ]+nop
+[ ]+22:[ ]+00[ ]+09[ ]+nop
+
+0+24 <shmedia3>:
+[ ]+24:[ ]+effffa60[ ]+ptb/l 1c <shcompact3>,tr6
+[ ]+28:[ ]+effffa70[ ]+ptb/l 20[ ]+<shcompact4>,tr7
+[ ]+2c:[ ]+ebffe200[ ]+pta/l c <shmedia2>,tr0
diff --git a/gas/testsuite/gas/sh/sh64/crange2-2.d b/gas/testsuite/gas/sh/sh64/crange2-2.d
new file mode 100644
index 0000000..0468e2d
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/crange2-2.d
@@ -0,0 +1,23 @@
+#as: --abi=32
+#objdump: -sr
+#source: crange2.s
+#name: .cranges descriptors for SHcompact and SHmedia in .text.
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.cranges\]:
+
+OFFSET *TYPE *VALUE
+0+0 R_SH_DIR32 \.text
+0+a R_SH_DIR32 \.text
+0+14 R_SH_DIR32 \.text
+
+
+Contents of section \.text:
+ 0000 e8000a30 ec001240 ec001250 6ff0fff0 .*
+ 0010 00090009 00090009 00090009 00090009 .*
+ 0020 00090009 effffa60 effffa70 ebffe200 .*
+Contents of section .data:
+Contents of section .cranges:
+ 0000 00000000 00000010 00030000 00100000 .*
+ 0010 00140002 00000024 0000000c 0003 .*
diff --git a/gas/testsuite/gas/sh/sh64/crange2-noexp-1.d b/gas/testsuite/gas/sh/sh64/crange2-noexp-1.d
new file mode 100644
index 0000000..01a5629
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/crange2-noexp-1.d
@@ -0,0 +1,43 @@
+#as: --abi=32 -no-expand
+#objdump: -dr
+#source: crange2.s
+#name: PT to SHcompact with -no-expand.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+0+ <shmedia>:
+[ ]+0:[ ]+e8000a30[ ]+pta/l 8 <shmedia1>,tr3
+[ ]+4:[ ]+ec001240[ ]+ptb/l 14 <shcompact1>,tr4
+
+0+8 <shmedia1>:
+[ ]+8:[ ]+ec001250[ ]+ptb/l 18 <shcompact2>,tr5
+
+0+c <shmedia2>:
+[ ]+c:[ ]+6ff0fff0[ ]+nop
+
+0+10[ ]+<shcompact>:
+[ ]+10:[ ]+00[ ]+09[ ]+nop
+[ ]+12:[ ]+00[ ]+09[ ]+nop
+
+0+14 <shcompact1>:
+[ ]+14:[ ]+00[ ]+09[ ]+nop
+[ ]+16:[ ]+00[ ]+09[ ]+nop
+
+0+18 <shcompact2>:
+[ ]+18:[ ]+00[ ]+09[ ]+nop
+[ ]+1a:[ ]+00[ ]+09[ ]+nop
+
+0+1c <shcompact3>:
+[ ]+1c:[ ]+00[ ]+09[ ]+nop
+[ ]+1e:[ ]+00[ ]+09[ ]+nop
+
+0+20[ ]+<shcompact4>:
+[ ]+20:[ ]+00[ ]+09[ ]+nop
+[ ]+22:[ ]+00[ ]+09[ ]+nop
+
+0+24 <shmedia3>:
+[ ]+24:[ ]+effffa60[ ]+ptb/l 1c <shcompact3>,tr6
+[ ]+28:[ ]+effffa70[ ]+ptb/l 20[ ]+<shcompact4>,tr7
+[ ]+2c:[ ]+ebffe200[ ]+pta/l c <shmedia2>,tr0
diff --git a/gas/testsuite/gas/sh/sh64/crange2.s b/gas/testsuite/gas/sh/sh64/crange2.s
new file mode 100644
index 0000000..6fbebc3
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/crange2.s
@@ -0,0 +1,34 @@
+! Check PT to SHcompact within same section as SHmedia, and that PT to
+! nearby SHmedia still gets the right offset.
+ .text
+ .mode SHmedia
+shmedia:
+ pt shmedia1,tr3
+ pt shcompact1,tr4
+shmedia1:
+ ptb shcompact2,tr5
+shmedia2:
+ nop
+
+ .mode SHcompact
+shcompact: ! Have a label, so disassembling unrelocated code works.
+ nop
+ nop
+shcompact1:
+ nop
+ nop
+shcompact2:
+ nop
+ nop
+shcompact3:
+ nop
+ nop
+shcompact4:
+ nop
+ nop
+
+ .mode SHmedia
+shmedia3:
+ pt shcompact3,tr6
+ ptb shcompact4,tr7
+ pt shmedia2,tr0
diff --git a/gas/testsuite/gas/sh/sh64/crange3-1.d b/gas/testsuite/gas/sh/sh64/crange3-1.d
new file mode 100644
index 0000000..fab5860
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/crange3-1.d
@@ -0,0 +1,25 @@
+#as: --abi=32
+#objdump: -sr
+#source: crange3.s
+#name: .cranges descriptors, constant mix.
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.cranges\]:
+OFFSET *TYPE *VALUE
+0+00 R_SH_DIR32 \.text
+0+0a R_SH_DIR32 \.text
+0+14 R_SH_DIR32 \.text
+
+
+Contents of section \.text:
+ 0000 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0010 01235678 12345678 12345678 1234fede .*
+ 0020 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0030 6ff0fff0 .*
+Contents of section \.data:
+Contents of section \.rodata:
+ 0000 abcdef01 12345678 .*
+Contents of section \.cranges:
+ 0000 00000000 00000010 00030000 00100000 .*
+ 0010 00100001 00000020 00000014 0003 .*
diff --git a/gas/testsuite/gas/sh/sh64/crange3.s b/gas/testsuite/gas/sh/sh64/crange3.s
new file mode 100644
index 0000000..23ef76e
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/crange3.s
@@ -0,0 +1,34 @@
+! There was a bug in which a .cranges data hunk could include a hunk of
+! code in front of it. The following illustrates a function (start)
+! followed by constants output into .rodata, followed by a function
+! (continue), with a case-table (.L173) in it. The bug included code from
+! the start of the function (continue) into the case-table range descriptor.
+
+ .text
+ .mode SHmedia
+start:
+ nop
+ .section .rodata
+ .long 0xabcdef01
+ .long 0x12345678
+ .text
+continue:
+ nop
+ nop
+ nop
+ .align 2
+ .align 2
+.L173:
+ .word 0x0123
+ .word 0x5678
+ .word 0x1234
+ .word 0x5678
+ .word 0x1234
+ .word 0x5678
+ .word 0x1234
+ .word 0xfede
+ nop
+ nop
+ nop
+ nop
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/crange4-1.d b/gas/testsuite/gas/sh/sh64/crange4-1.d
new file mode 100644
index 0000000..b9c81c7
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/crange4-1.d
@@ -0,0 +1,20 @@
+#as: --abi=32
+#objdump: -sr
+#source: crange4.s
+#name: .cranges descriptors with final variant.
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.cranges\]:
+OFFSET *TYPE *VALUE
+0+ R_SH_DIR32 \.text
+0+a R_SH_DIR32 \.text
+
+
+Contents of section \.text:
+ 0000 6ff0fff0 00000000 00000000 00000000 .*
+ 0010 00000000 00000000 .*
+Contents of section \.data:
+Contents of section \.cranges:
+ 0000 00000000 00000004 00030000 00040000 .*
+ 0010 00140001 .*
diff --git a/gas/testsuite/gas/sh/sh64/crange4.s b/gas/testsuite/gas/sh/sh64/crange4.s
new file mode 100644
index 0000000..5eaeb79
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/crange4.s
@@ -0,0 +1,8 @@
+! This will be two .cranges. Original problem was that the second one was
+! lost because .space just emitted a frag, without calling emit_expr as
+! most other data-generating pseudos.
+
+ .mode SHmedia
+start:
+ nop
+ .space 20,0
diff --git a/gas/testsuite/gas/sh/sh64/crange5-1.d b/gas/testsuite/gas/sh/sh64/crange5-1.d
new file mode 100644
index 0000000..c665548
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/crange5-1.d
@@ -0,0 +1,13 @@
+#as: --abi=32 --isa=SHmedia
+#objdump: -sr
+#source: crange5.s
+#name: Avoid zero length .cranges range descriptor at .align in code.
+
+.*: file format .*-sh64
+
+Contents of section \.text:
+ 0000 e8003a00 d4ff80f0 4455fc00 acf000e0 .*
+ 0010 acf00c00 acf009c0 acf00520 00f8fce0 .*
+ 0020 0029fc10 e4110200 ebffda50 d81201c0 .*
+ 0030 e8000a00 cc000420 6ff0fff0 .*
+Contents of section .data:
diff --git a/gas/testsuite/gas/sh/sh64/crange5.s b/gas/testsuite/gas/sh/sh64/crange5.s
new file mode 100644
index 0000000..7644f1c
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/crange5.s
@@ -0,0 +1,26 @@
+! Zero-sized range descriptors are handled well, but GAS should not emit
+! them unnecessarily. This can happen if .align handling and insn
+! assembling does not cater to this specifically and completely.
+! Test-case shortened from gcc.c-torture/execute/20000205-1.c.
+
+ .text
+_f:
+ pt .L2, tr0
+ addi.l r15, -32, r15
+ gettr tr5, r0
+ st.q r15, 0, r14
+ st.q r15, 24, r0
+ st.q r15, 16, r28
+ st.q r15, 8, r18
+ add.l r15, r63, r14
+ add r2, r63, r1
+ beqi r1, 0, tr0
+ pt _f, tr5
+ andi r1, 128, r28
+ .align 2
+.L8:
+ pt .L2, tr0
+ movi 1, r2
+.L2:
+ nop
+
diff --git a/gas/testsuite/gas/sh/sh64/creg-1.d b/gas/testsuite/gas/sh/sh64/creg-1.d
new file mode 100644
index 0000000..d4e613d
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/creg-1.d
@@ -0,0 +1,77 @@
+#as: --abi=32
+#objdump: -dr
+#name: Predefined control register names.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+240ffd50[ ]+getcon sr,r21
+[ ]+4:[ ]+241ffdf0[ ]+getcon ssr,r31
+[ ]+8:[ ]+242ffd60[ ]+getcon pssr,r22
+[ ]+c:[ ]+244ffd50[ ]+getcon intevt,r21
+[ ]+10:[ ]+245ffd50[ ]+getcon expevt,r21
+[ ]+14:[ ]+246ffd50[ ]+getcon pexpevt,r21
+[ ]+18:[ ]+247ffcc0[ ]+getcon tra,r12
+[ ]+1c:[ ]+248ffd50[ ]+getcon spc,r21
+[ ]+20:[ ]+249ffe90[ ]+getcon pspc,r41
+[ ]+24:[ ]+24affd50[ ]+getcon resvec,r21
+[ ]+28:[ ]+24bffd30[ ]+getcon vbr,r19
+[ ]+2c:[ ]+24dffd50[ ]+getcon tea,r21
+[ ]+30:[ ]+250ffe30[ ]+getcon dcr,r35
+[ ]+34:[ ]+251ffd50[ ]+getcon kcr0,r21
+[ ]+38:[ ]+252ffd50[ ]+getcon kcr1,r21
+[ ]+3c:[ ]+27effd60[ ]+getcon ctc,r22
+[ ]+40:[ ]+27fffd50[ ]+getcon usr,r21
+[ ]+44:[ ]+240ffc20[ ]+getcon sr,r2
+[ ]+48:[ ]+241ffd50[ ]+getcon ssr,r21
+[ ]+4c:[ ]+242ffd50[ ]+getcon pssr,r21
+[ ]+50:[ ]+244ffd50[ ]+getcon intevt,r21
+[ ]+54:[ ]+245ffe60[ ]+getcon expevt,r38
+[ ]+58:[ ]+246ffd50[ ]+getcon pexpevt,r21
+[ ]+5c:[ ]+247ffd50[ ]+getcon tra,r21
+[ ]+60:[ ]+248ffc10[ ]+getcon spc,r1
+[ ]+64:[ ]+249ffd50[ ]+getcon pspc,r21
+[ ]+68:[ ]+24affd50[ ]+getcon resvec,r21
+[ ]+6c:[ ]+24bffef0[ ]+getcon vbr,r47
+[ ]+70:[ ]+24dffd50[ ]+getcon tea,r21
+[ ]+74:[ ]+250ffd50[ ]+getcon dcr,r21
+[ ]+78:[ ]+251ffe30[ ]+getcon kcr0,r35
+[ ]+7c:[ ]+252ffd50[ ]+getcon kcr1,r21
+[ ]+80:[ ]+27effd50[ ]+getcon ctc,r21
+[ ]+84:[ ]+27fffd50[ ]+getcon usr,r21
+[ ]+88:[ ]+6d5ffc00[ ]+putcon r21,sr
+[ ]+8c:[ ]+6dfffc10[ ]+putcon r31,ssr
+[ ]+90:[ ]+6d6ffc20[ ]+putcon r22,pssr
+[ ]+94:[ ]+6d5ffc40[ ]+putcon r21,intevt
+[ ]+98:[ ]+6d5ffc50[ ]+putcon r21,expevt
+[ ]+9c:[ ]+6d5ffc60[ ]+putcon r21,pexpevt
+[ ]+a0:[ ]+6ccffc70[ ]+putcon r12,tra
+[ ]+a4:[ ]+6d5ffc80[ ]+putcon r21,spc
+[ ]+a8:[ ]+6e9ffc90[ ]+putcon r41,pspc
+[ ]+ac:[ ]+6d5ffca0[ ]+putcon r21,resvec
+[ ]+b0:[ ]+6d3ffcb0[ ]+putcon r19,vbr
+[ ]+b4:[ ]+6d5ffcd0[ ]+putcon r21,tea
+[ ]+b8:[ ]+6e3ffd00[ ]+putcon r35,dcr
+[ ]+bc:[ ]+6d5ffd10[ ]+putcon r21,kcr0
+[ ]+c0:[ ]+6d5ffd20[ ]+putcon r21,kcr1
+[ ]+c4:[ ]+6d6fffe0[ ]+putcon r22,ctc
+[ ]+c8:[ ]+6d5ffff0[ ]+putcon r21,usr
+[ ]+cc:[ ]+6c2ffc00[ ]+putcon r2,sr
+[ ]+d0:[ ]+6d5ffc10[ ]+putcon r21,ssr
+[ ]+d4:[ ]+6d5ffc20[ ]+putcon r21,pssr
+[ ]+d8:[ ]+6d5ffc40[ ]+putcon r21,intevt
+[ ]+dc:[ ]+6e6ffc50[ ]+putcon r38,expevt
+[ ]+e0:[ ]+6d5ffc60[ ]+putcon r21,pexpevt
+[ ]+e4:[ ]+6d5ffc70[ ]+putcon r21,tra
+[ ]+e8:[ ]+6c1ffc80[ ]+putcon r1,spc
+[ ]+ec:[ ]+6d5ffc90[ ]+putcon r21,pspc
+[ ]+f0:[ ]+6d5ffca0[ ]+putcon r21,resvec
+[ ]+f4:[ ]+6efffcb0[ ]+putcon r47,vbr
+[ ]+f8:[ ]+6d5ffcd0[ ]+putcon r21,tea
+[ ]+fc:[ ]+6d5ffd00[ ]+putcon r21,dcr
+[ ]+100:[ ]+6e3ffd10[ ]+putcon r35,kcr0
+[ ]+104:[ ]+6d5ffd20[ ]+putcon r21,kcr1
+[ ]+108:[ ]+6d5fffe0[ ]+putcon r21,ctc
+[ ]+10c:[ ]+6d5ffff0[ ]+putcon r21,usr
diff --git a/gas/testsuite/gas/sh/sh64/creg-1.s b/gas/testsuite/gas/sh/sh64/creg-1.s
new file mode 100644
index 0000000..775f211
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/creg-1.s
@@ -0,0 +1,79 @@
+! Test recognition of predefined control register names, lower and upper
+! case; getcon and putcon. Exhaustive test in those domain is small and
+! simple enough. Note that basic-1.s has already tested non-predefined
+! register names.
+
+ .mode SHmedia
+ .text
+start:
+ getcon sr,r21
+ getcon ssr,r31
+ getcon pssr,r22
+ getcon intevt,r21
+ getcon expevt,r21
+ getcon pexpevt,r21
+ getcon tra,r12
+ getcon spc,r21
+ getcon pspc,r41
+ getcon resvec,r21
+ getcon vbr,r19
+ getcon tea,r21
+ getcon dcr,r35
+ getcon kcr0,r21
+ getcon kcr1,r21
+ getcon ctc,r22
+ getcon usr,r21
+
+ getcon SR,r2
+ getcon SSR,r21
+ getcon PSSR,r21
+ getcon INTEVT,r21
+ getcon EXPEVT,r38
+ getcon PEXPEVT,r21
+ getcon TRA,r21
+ getcon SPC,r1
+ getcon PSPC,r21
+ getcon RESVEC,r21
+ getcon VBR,r47
+ getcon TEA,r21
+ getcon DCR,r21
+ getcon KCR0,r35
+ getcon KCR1,r21
+ getcon CTC,r21
+ getcon USR,r21
+
+ putcon r21,sr
+ putcon r31,ssr
+ putcon r22,pssr
+ putcon r21,intevt
+ putcon r21,expevt
+ putcon r21,pexpevt
+ putcon r12,tra
+ putcon r21,spc
+ putcon r41,pspc
+ putcon r21,resvec
+ putcon r19,vbr
+ putcon r21,tea
+ putcon r35,dcr
+ putcon r21,kcr0
+ putcon r21,kcr1
+ putcon r22,ctc
+ putcon r21,usr
+
+ putcon r2,SR
+ putcon r21,SSR
+ putcon r21,PSSR
+ putcon r21,INTEVT
+ putcon r38,EXPEVT
+ putcon r21,PEXPEVT
+ putcon r21,TRA
+ putcon r1,SPC
+ putcon r21,PSPC
+ putcon r21,RESVEC
+ putcon r47,VBR
+ putcon r21,TEA
+ putcon r21,DCR
+ putcon r35,KCR0
+ putcon r21,KCR1
+ putcon r21,CTC
+ putcon r21,USR
diff --git a/gas/testsuite/gas/sh/sh64/creg-2.d b/gas/testsuite/gas/sh/sh64/creg-2.d
new file mode 100644
index 0000000..4dda639
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/creg-2.d
@@ -0,0 +1,17 @@
+#as: --abi=32
+#objdump: -dr
+#name: Predefined control register names specified in crN syntax.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+240ffd50[ ]+getcon sr,r21
+[ ]+4:[ ]+24dffd50[ ]+getcon tea,r21
+[ ]+8:[ ]+27effd60[ ]+getcon ctc,r22
+[ ]+c:[ ]+248ffd50[ ]+getcon spc,r21
+[ ]+10:[ ]+244ffd50[ ]+getcon intevt,r21
+[ ]+14:[ ]+6d3ffcb0[ ]+putcon r19,vbr
+[ ]+18:[ ]+6e6ffc50[ ]+putcon r38,expevt
+[ ]+1c:[ ]+6d5ffc10[ ]+putcon r21,ssr
diff --git a/gas/testsuite/gas/sh/sh64/creg-2.s b/gas/testsuite/gas/sh/sh64/creg-2.s
new file mode 100644
index 0000000..fdfe46e
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/creg-2.s
@@ -0,0 +1,14 @@
+! Test recognition of predefined control register names specified as crN
+! syntax, lower and upper case.
+
+ .mode SHmedia
+ .text
+start:
+ getcon cr0,r21
+ getcon cr13,r21
+ getcon CR62,r22
+ getcon cr8,r21
+ getcon CR4,r21
+ putcon r19,cr11
+ putcon r38,CR5
+ putcon r21,CR1
diff --git a/gas/testsuite/gas/sh/sh64/datal-1.s b/gas/testsuite/gas/sh/sh64/datal-1.s
new file mode 100644
index 0000000..074cf7a
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/datal-1.s
@@ -0,0 +1,41 @@
+! Check "datalabel" qualifier.
+! This is the most simple use; references to local symbols where it is
+! completely redundant. Code tests are for SHmedia mode.
+
+ .mode SHmedia
+ .text
+start:
+ movi datalabel foo,r3
+ movi DataLabel foo2 + 42,r3
+ movi (datalabel (foo3 + 46) >> 16) & 65535,r3
+ movi datalabel myrodata3 & 65535, r45
+ movi datalabel myrodata4 & 65535, r45
+ movi DATALABEL (myrodata2 + 50) & 65535, r45
+
+ .section .rodata
+ .long datalabel foo4
+myrodata1:
+ .long DATALABEL foo5 + 56
+myrodata2:
+ .long datalabel $
+ .global myrodata3
+myrodata3:
+ .long datalabel $+20
+myrodata4:
+ .long datalabel myrodata1+0x100
+
+ .data
+ .long datalabel myrodata1
+foo:
+ .long DATALABEL myrodata2+30
+foo2:
+ .long DataLabel foo
+foo3:
+ .long datalabel $
+foo4:
+ .long datalabel $+40
+foo5:
+ .long datalabel myrodata3
+ .global foo6
+foo6:
+ .long datalabel foo6 + 42
diff --git a/gas/testsuite/gas/sh/sh64/datal-2.d b/gas/testsuite/gas/sh/sh64/datal-2.d
new file mode 100644
index 0000000..05650ff
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/datal-2.d
@@ -0,0 +1,44 @@
+#as: --abi=32
+#objdump: -sr
+#source: datal-2.s
+#name: DataLabel redundant local use, SHcompact
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET *TYPE *VALUE
+0+08 R_SH_DIR32 \.rodata
+0+0c R_SH_DIR32 myrodata2
+0+10 R_SH_DIR32 \.text
+0+14 R_SH_DIR32 \.text
+0+18 R_SH_DIR32 \.text
+0+1c R_SH_DIR32 \.text
+
+
+RELOCATION RECORDS FOR \[\.data\]:
+OFFSET *TYPE *VALUE
+0+00 R_SH_DIR32 myrodata2
+0+04 R_SH_DIR32 \.data
+0+08 R_SH_DIR32 \.data
+0+0c R_SH_DIR32 foo2
+0+10 R_SH_DIR32 foo3
+0+14 R_SH_DIR32 \.text
+0+18 R_SH_DIR32 \.text
+
+
+RELOCATION RECORDS FOR \[\.rodata\]:
+OFFSET *TYPE *VALUE
+0+00 R_SH_DIR32 \.data
+0+04 R_SH_DIR32 \.data
+0+08 R_SH_DIR32 \.rodata
+0+0c R_SH_DIR32 \.rodata
+
+
+Contents of section \.text:
+ 0000 c701c70d 00090009 00000004 00000014 .*
+ 0010 00000002 0000002e 00000018 00000030 .*
+Contents of section \.data:
+ 0000 00000000 00000004 0000001c 00000000 .*
+ 0010 00000014 00000002 00000018 .*
+Contents of section \.rodata:
+ 0000 00000010 0000004c 00000008 00000020 .*
diff --git a/gas/testsuite/gas/sh/sh64/datal-2.s b/gas/testsuite/gas/sh/sh64/datal-2.s
new file mode 100644
index 0000000..4aeb25b
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/datal-2.s
@@ -0,0 +1,46 @@
+! Check "datalabel" qualifier.
+! This is the most simple use; references to local symbols where it is
+! completely redundant. Code tests are for SHcompact mode.
+
+ .mode SHcompact
+ .text
+start:
+ mova datalabel litpool1,r0
+start1:
+ mova datalabel litpool2 + 44,r0
+start2:
+ nop
+ nop
+litpool1:
+ .long datalabel myrodata1
+litpool2:
+ .long datalabel myrodata2 + 20
+ .long DATALABEL start1
+ .long datalabel start2+42
+ .long DataLabel $
+ .long datalabel $+20
+
+ .section .rodata
+ .long datalabel foo4
+myrodata1:
+ .long DataLabel foo5 + 56
+ .global myrodata2
+myrodata2:
+ .long datalabel $
+ .long datalabel $+20
+
+ .data
+ .long DATALABEL myrodata2
+foo:
+ .long datalabel $
+ .global foo2
+foo2:
+ .long datalabel $+20
+ .global foo3
+foo3:
+ .long DataLabel foo2
+foo4:
+ .long datalabel foo3+20
+foo5:
+ .long DATALABEL start1
+ .long datalabel start2+20
diff --git a/gas/testsuite/gas/sh/sh64/datal-3.s b/gas/testsuite/gas/sh/sh64/datal-3.s
new file mode 100644
index 0000000..2583a22
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/datal-3.s
@@ -0,0 +1,48 @@
+! Check "datalabel" qualifier.
+! This is the next most simple use; references symbols defined in this file.
+! Code tests are for SHmedia mode.
+
+ .mode SHmedia
+ .text
+start:
+ movi datalabel foo,r3
+ movi DataLabel foo2 + 42,r3
+ movi ((datalabel foo3 + 46) >> 16) & 65535,r3
+
+ .section .rodata
+ .long datalabel foo4
+myrodata1:
+ .long DATALABEL foo5 + 56
+myrodata2:
+ .long datalabel $
+ .global myrodata3
+myrodata3:
+ .long datalabel $+20
+
+ .text
+ movi datalabel foo7 + 42,r30
+ movi datalabel foo8,r30
+ movi ((datalabel foo9 + 64) >> 16) & 65535,r3
+ movi datalabel myrodata1,r56
+foo:
+ movi DATALABEL myrodata2+30,r21
+foo2:
+ movi DataLabel foo,r10
+foo3:
+ movi datalabel $,r33
+foo4:
+ movi datalabel $+40,r8
+foo5:
+ movi datalabel myrodata3,r44
+ .global foo6
+foo6:
+ movi datalabel foo6 + 42,r30
+ .global foo7
+foo7:
+ nop
+ .global foo8
+foo8:
+ nop
+ .global foo9
+foo9:
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/datal32-1.d b/gas/testsuite/gas/sh/sh64/datal32-1.d
new file mode 100644
index 0000000..48d9030
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/datal32-1.d
@@ -0,0 +1,45 @@
+#as: --abi=32
+#objdump: -sr
+#source: datal-1.s
+#name: DataLabel redundant local use, SHmedia 32-bit ABI
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET *TYPE *VALUE
+0+10 R_SH_IMM_MEDLOW16 \.data\+0x0+3a
+0+14 R_SH_IMM_LOW16 myrodata3
+0+18 R_SH_IMM_LOW16 \.rodata\+0x0+10
+0+1c R_SH_IMM_LOW16 \.rodata\+0x0+3a
+0+00 R_SH_IMM_MEDLOW16 \.data\+0x0+4
+0+04 R_SH_IMM_LOW16 \.data\+0x0+4
+0+08 R_SH_IMM_MEDLOW16 \.data\+0x0+32
+0+0c R_SH_IMM_LOW16 \.data\+0x0+32
+
+RELOCATION RECORDS FOR \[\.data\]:
+OFFSET *TYPE *VALUE
+0+00 R_SH_DIR32 \.rodata
+0+04 R_SH_DIR32 \.rodata
+0+08 R_SH_DIR32 \.data
+0+0c R_SH_DIR32 \.data
+0+10 R_SH_DIR32 \.data
+0+14 R_SH_DIR32 myrodata3
+0+18 R_SH_DIR32 foo6
+
+RELOCATION RECORDS FOR \[\.rodata\]:
+OFFSET *TYPE *VALUE
+0+00 R_SH_DIR32 \.data
+0+04 R_SH_DIR32 \.data
+0+08 R_SH_DIR32 \.rodata
+0+0c R_SH_DIR32 \.rodata
+0+10 R_SH_DIR32 \.rodata
+
+Contents of section \.text:
+ 0000 cc000030 c8000030 cc000030 c8000030 .*
+ 0010 cc000030 cc0002d0 cc0002d0 cc0002d0 .*
+Contents of section \.data:
+ 0000 00000004 00000026 00000004 0000000c .*
+ 0010 00000038 00000000 0000002a .*
+Contents of section \.rodata:
+ 0000 00000010 0000004c 00000008 00000020 .*
+ 0010 00000104 .*
diff --git a/gas/testsuite/gas/sh/sh64/datal32-3.d b/gas/testsuite/gas/sh/sh64/datal32-3.d
new file mode 100644
index 0000000..8d29c05
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/datal32-3.d
@@ -0,0 +1,95 @@
+#as: --abi=32
+#objdump: -xsr
+#source: datal-3.s
+#name: DataLabel local def/use, SHmedia 32-bit ABI
+
+# We should have the st_type field of each symbol displayed too, so we can
+# check that STT_DATALABEL is set, but objdump doesn't do that at present,
+# and readelf isn't supported as a run_dump_test tool.
+
+.*: file format .*-sh64
+.*
+architecture: sh5, flags 0x0+11:
+HAS_RELOC, HAS_SYMS
+start address 0x0+
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+6c 0+ 0+ 0+34 2\*\*0
+ CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
+ 1 \.data 0+ 0+ 0+ 0+a0 2\*\*0
+ CONTENTS, ALLOC, LOAD, DATA
+ 2 \.bss 0+ 0+ 0+ 0+a0 2\*\*0
+ ALLOC
+ 3 \.rodata 0+10 0+ 0+ 0+a0 2\*\*0
+ CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
+SYMBOL TABLE:
+0+ l d \.text 0+
+0+ l d \.data 0+
+0+ l d \.bss 0+
+0+ l \.text 0+ 0x04 start
+0+30 l \.text 0+ 0x04 foo
+0+38 l \.text 0+ 0x04 foo2
+0+40 l \.text 0+ 0x04 foo3
+0+ l d \.rodata 0+
+0+48 l \.text 0+ 0x04 foo4
+0+4 l \.rodata 0+ myrodata1
+0+50 l \.text 0+ 0x04 foo5
+0+8 l \.rodata 0+ myrodata2
+0+c g \.rodata 0+ myrodata3
+0+60 g \.text 0+ 0x04 foo7
+0+60 \*UND\* 0+ foo7
+0+64 g \.text 0+ 0x04 foo8
+0+64 \*UND\* 0+ foo8
+0+68 g \.text 0+ 0x04 foo9
+0+68 \*UND\* 0+ foo9
+0+58 g \.text 0+ 0x04 foo6
+0+58 \*UND\* 0+ foo6
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET *TYPE *VALUE
+0+10 R_SH_IMM_MEDLOW16 \.text\+0x0+6e
+0+24 R_SH_IMM_MEDLOW16 foo9\+0x0+40
+0+00 R_SH_IMM_MEDLOW16 \.text\+0x0+30
+0+04 R_SH_IMM_LOW16 \.text\+0x0+30
+0+08 R_SH_IMM_MEDLOW16 \.text\+0x0+62
+0+0c R_SH_IMM_LOW16 \.text\+0x0+62
+0+14 R_SH_IMM_MEDLOW16 foo7\+0x0+2a
+0+18 R_SH_IMM_LOW16 foo7\+0x0+2a
+0+1c R_SH_IMM_MEDLOW16 foo8
+0+20 R_SH_IMM_LOW16 foo8
+0+28 R_SH_IMM_MEDLOW16 \.rodata\+0x0+4
+0+2c R_SH_IMM_LOW16 \.rodata\+0x0+4
+0+30 R_SH_IMM_MEDLOW16 \.rodata\+0x0+26
+0+34 R_SH_IMM_LOW16 \.rodata\+0x0+26
+0+38 R_SH_IMM_MEDLOW16 \.text\+0x0+30
+0+3c R_SH_IMM_LOW16 \.text\+0x0+30
+0+40 R_SH_IMM_MEDLOW16 \.text\+0x0+40
+0+44 R_SH_IMM_LOW16 \.text\+0x0+40
+0+48 R_SH_IMM_MEDLOW16 \.text\+0x0+70
+0+4c R_SH_IMM_LOW16 \.text\+0x0+70
+0+50 R_SH_IMM_MEDLOW16 myrodata3
+0+54 R_SH_IMM_LOW16 myrodata3
+0+58 R_SH_IMM_MEDLOW16 foo6\+0x0+2a
+0+5c R_SH_IMM_LOW16 foo6\+0x0+2a
+
+
+RELOCATION RECORDS FOR \[\.rodata\]:
+OFFSET *TYPE *VALUE
+0+ R_SH_DIR32 \.text
+0+4 R_SH_DIR32 \.text
+0+8 R_SH_DIR32 \.rodata
+0+c R_SH_DIR32 \.rodata
+
+
+Contents of section \.text:
+ 0000 cc000030 c8000030 cc000030 c8000030 .*
+ 0010 cc000030 cc0001e0 c80001e0 cc0001e0 .*
+ 0020 c80001e0 cc000030 cc000380 c8000380 .*
+ 0030 cc000150 c8000150 cc0000a0 c80000a0 .*
+ 0040 cc000210 c8000210 cc000080 c8000080 .*
+ 0050 cc0002c0 c80002c0 cc0001e0 c80001e0 .*
+ 0060 6ff0fff0 6ff0fff0 6ff0fff0 .*
+Contents of section \.data:
+Contents of section \.rodata:
+ 0000 00000048 00000088 00000008 00000020 .*
diff --git a/gas/testsuite/gas/sh/sh64/datal64-1.d b/gas/testsuite/gas/sh/sh64/datal64-1.d
new file mode 100644
index 0000000..7726b7a
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/datal64-1.d
@@ -0,0 +1,50 @@
+#as: --abi=64
+#objdump: -sr
+#source: datal-1.s
+#name: DataLabel redundant local use, SHmedia 64-bit ABI
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET TYPE VALUE
+0+20 R_SH_IMM_MEDLOW16 \.data\+0x0+3a
+0+24 R_SH_IMM_LOW16 myrodata3
+0+28 R_SH_IMM_LOW16 \.rodata\+0x0+10
+0+2c R_SH_IMM_LOW16 \.rodata\+0x0+3a
+0+00 R_SH_IMM_HI16 \.data\+0x0+4
+0+04 R_SH_IMM_MEDHI16 \.data\+0x0+4
+0+08 R_SH_IMM_MEDLOW16 \.data\+0x0+4
+0+0c R_SH_IMM_LOW16 \.data\+0x0+4
+0+10 R_SH_IMM_HI16 \.data\+0x0+32
+0+14 R_SH_IMM_MEDHI16 \.data\+0x0+32
+0+18 R_SH_IMM_MEDLOW16 \.data\+0x0+32
+0+1c R_SH_IMM_LOW16 \.data\+0x0+32
+
+RELOCATION RECORDS FOR \[\.data\]:
+OFFSET TYPE VALUE
+0+00 R_SH_DIR32 \.rodata
+0+04 R_SH_DIR32 \.rodata
+0+08 R_SH_DIR32 \.data
+0+0c R_SH_DIR32 \.data
+0+10 R_SH_DIR32 \.data
+0+14 R_SH_DIR32 myrodata3
+0+18 R_SH_DIR32 foo6
+
+RELOCATION RECORDS FOR \[\.rodata\]:
+OFFSET TYPE VALUE
+0+00 R_SH_DIR32 \.data
+0+04 R_SH_DIR32 \.data
+0+08 R_SH_DIR32 \.rodata
+0+0c R_SH_DIR32 \.rodata
+0+10 R_SH_DIR32 \.rodata
+
+Contents of section \.text:
+ 0000 cc000030 c8000030 c8000030 c8000030 .*
+ 0010 cc000030 c8000030 c8000030 c8000030 .*
+ 0020 cc000030 cc0002d0 cc0002d0 cc0002d0 .*
+Contents of section \.data:
+ 0000 00000004 00000026 00000004 0000000c .*
+ 0010 00000038 00000000 0000002a .*
+Contents of section \.rodata:
+ 0000 00000010 0000004c 00000008 00000020 .*
+ 0010 00000104 .*
diff --git a/gas/testsuite/gas/sh/sh64/datal64-3.d b/gas/testsuite/gas/sh/sh64/datal64-3.d
new file mode 100644
index 0000000..b062986
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/datal64-3.d
@@ -0,0 +1,124 @@
+#as: --abi=64
+#objdump: -xsr
+#source: datal-3.s
+#name: DataLabel local def/use, SHmedia 64-bit ABI
+
+# We should have the st_type field of each symbol displayed too, so we can
+# check that STT_DATALABEL is set, but objdump doesn't do that at present,
+# and readelf isn't supported as a run_dump_test tool.
+
+.*: file format .*-sh64
+.*
+architecture: sh5, flags 0x0+11:
+HAS_RELOC, HAS_SYMS
+start address 0x0+
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 \.text 0+c4 0+ 0+ 0+40 2\*\*0
+ CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
+ 1 \.data 0+ 0+ 0+ 0+104 2\*\*0
+ CONTENTS, ALLOC, LOAD, DATA
+ 2 \.bss 0+ 0+ 0+ 0+104 2\*\*0
+ ALLOC
+ 3 \.rodata 0+10 0+ 0+ 0+104 2\*\*0
+ CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
+SYMBOL TABLE:
+0+ l d \.text 0+
+0+ l d \.data 0+
+0+ l d \.bss 0+
+0+ l \.text 0+ 0x04 start
+0+58 l \.text 0+ 0x04 foo
+0+68 l \.text 0+ 0x04 foo2
+0+78 l \.text 0+ 0x04 foo3
+0+ l d \.rodata 0+
+0+88 l \.text 0+ 0x04 foo4
+0+4 l \.rodata 0+ myrodata1
+0+98 l \.text 0+ 0x04 foo5
+0+8 l \.rodata 0+ myrodata2
+0+c g \.rodata 0+ myrodata3
+0+b8 g \.text 0+ 0x04 foo7
+0+b8 \*UND\* 0+ foo7
+0+bc g \.text 0+ 0x04 foo8
+0+bc \*UND\* 0+ foo8
+0+c0 g \.text 0+ 0x04 foo9
+0+c0 \*UND\* 0+ foo9
+0+a8 g \.text 0+ 0x04 foo6
+0+a8 \*UND\* 0+ foo6
+
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET TYPE VALUE
+0+20 R_SH_IMM_MEDLOW16 \.text\+0x0+a6
+0+44 R_SH_IMM_MEDLOW16 foo9\+0x0+40
+0+ R_SH_IMM_HI16 \.text\+0x0+58
+0+4 R_SH_IMM_MEDHI16 \.text\+0x0+58
+0+8 R_SH_IMM_MEDLOW16 \.text\+0x0+58
+0+c R_SH_IMM_LOW16 \.text\+0x0+58
+0+10 R_SH_IMM_HI16 \.text\+0x0+92
+0+14 R_SH_IMM_MEDHI16 \.text\+0x0+92
+0+18 R_SH_IMM_MEDLOW16 \.text\+0x0+92
+0+1c R_SH_IMM_LOW16 \.text\+0x0+92
+0+24 R_SH_IMM_HI16 foo7\+0x0+2a
+0+28 R_SH_IMM_MEDHI16 foo7\+0x0+2a
+0+2c R_SH_IMM_MEDLOW16 foo7\+0x0+2a
+0+30 R_SH_IMM_LOW16 foo7\+0x0+2a
+0+34 R_SH_IMM_HI16 foo8
+0+38 R_SH_IMM_MEDHI16 foo8
+0+3c R_SH_IMM_MEDLOW16 foo8
+0+40 R_SH_IMM_LOW16 foo8
+0+48 R_SH_IMM_HI16 \.rodata\+0x0+4
+0+4c R_SH_IMM_MEDHI16 \.rodata\+0x0+4
+0+50 R_SH_IMM_MEDLOW16 \.rodata\+0x0+4
+0+54 R_SH_IMM_LOW16 \.rodata\+0x0+4
+0+58 R_SH_IMM_HI16 \.rodata\+0x0+26
+0+5c R_SH_IMM_MEDHI16 \.rodata\+0x0+26
+0+60 R_SH_IMM_MEDLOW16 \.rodata\+0x0+26
+0+64 R_SH_IMM_LOW16 \.rodata\+0x0+26
+0+68 R_SH_IMM_HI16 \.text\+0x0+58
+0+6c R_SH_IMM_MEDHI16 \.text\+0x0+58
+0+70 R_SH_IMM_MEDLOW16 \.text\+0x0+58
+0+74 R_SH_IMM_LOW16 \.text\+0x0+58
+0+78 R_SH_IMM_HI16 \.text\+0x0+78
+0+7c R_SH_IMM_MEDHI16 \.text\+0x0+78
+0+80 R_SH_IMM_MEDLOW16 \.text\+0x0+78
+0+84 R_SH_IMM_LOW16 \.text\+0x0+78
+0+88 R_SH_IMM_HI16 \.text\+0x0+b0
+0+8c R_SH_IMM_MEDHI16 \.text\+0x0+b0
+0+90 R_SH_IMM_MEDLOW16 \.text\+0x0+b0
+0+94 R_SH_IMM_LOW16 \.text\+0x0+b0
+0+98 R_SH_IMM_HI16 myrodata3
+0+9c R_SH_IMM_MEDHI16 myrodata3
+0+a0 R_SH_IMM_MEDLOW16 myrodata3
+0+a4 R_SH_IMM_LOW16 myrodata3
+0+a8 R_SH_IMM_HI16 foo6\+0x0+2a
+0+ac R_SH_IMM_MEDHI16 foo6\+0x0+2a
+0+b0 R_SH_IMM_MEDLOW16 foo6\+0x0+2a
+0+b4 R_SH_IMM_LOW16 foo6\+0x0+2a
+
+
+RELOCATION RECORDS FOR \[\.rodata\]:
+OFFSET TYPE VALUE
+0+ R_SH_DIR32 \.text
+0+4 R_SH_DIR32 \.text
+0+8 R_SH_DIR32 \.rodata
+0+c R_SH_DIR32 \.rodata
+
+
+Contents of section \.text:
+ 0000 cc000030 c8000030 c8000030 c8000030 .*
+ 0010 cc000030 c8000030 c8000030 c8000030 .*
+ 0020 cc000030 cc0001e0 c80001e0 c80001e0 .*
+ 0030 c80001e0 cc0001e0 c80001e0 c80001e0 .*
+ 0040 c80001e0 cc000030 cc000380 c8000380 .*
+ 0050 c8000380 c8000380 cc000150 c8000150 .*
+ 0060 c8000150 c8000150 cc0000a0 c80000a0 .*
+ 0070 c80000a0 c80000a0 cc000210 c8000210 .*
+ 0080 c8000210 c8000210 cc000080 c8000080 .*
+ 0090 c8000080 c8000080 cc0002c0 c80002c0 .*
+ 00a0 c80002c0 c80002c0 cc0001e0 c80001e0 .*
+ 00b0 c80001e0 c80001e0 6ff0fff0 6ff0fff0 .*
+ 00c0 6ff0fff0 .*
+Contents of section \.data:
+Contents of section \.rodata:
+ 0000 00000088 000000d0 00000008 00000020 .*
diff --git a/gas/testsuite/gas/sh/sh64/endian-1.d b/gas/testsuite/gas/sh/sh64/endian-1.d
new file mode 100644
index 0000000..921e5a5
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/endian-1.d
@@ -0,0 +1,9 @@
+#as: --isa=shmedia --no-exp -little
+#objdump: -s
+#name: SH64 Little Endian
+
+.*: file format elf64-sh64l
+
+Contents of section .text:
+ 0000 00d048cc 78563412 34120000.*
+Contents of section .data:
diff --git a/gas/testsuite/gas/sh/sh64/endian-1.s b/gas/testsuite/gas/sh/sh64/endian-1.s
new file mode 100644
index 0000000..79bc9e4
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/endian-1.s
@@ -0,0 +1,7 @@
+ .text
+ .mode shmedia
+start:
+
+ movi 0x1234,r0
+ .long 0x12345678
+ .word 0x1234, 0
diff --git a/gas/testsuite/gas/sh/sh64/endian-2.d b/gas/testsuite/gas/sh/sh64/endian-2.d
new file mode 100644
index 0000000..f3d6e02
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/endian-2.d
@@ -0,0 +1,10 @@
+#as: --isa=shmedia --no-exp
+#objdump: -s
+#name: SH64 Big Endian
+
+.*: file format elf64-sh64
+
+Contents of section .text:
+ 0000 cc48d000 12345678 12340000.*
+Contents of section .data:
+
diff --git a/gas/testsuite/gas/sh/sh64/endian-2.s b/gas/testsuite/gas/sh/sh64/endian-2.s
new file mode 100644
index 0000000..79bc9e4
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/endian-2.s
@@ -0,0 +1,7 @@
+ .text
+ .mode shmedia
+start:
+
+ movi 0x1234,r0
+ .long 0x12345678
+ .word 0x1234, 0
diff --git a/gas/testsuite/gas/sh/sh64/err-1.s b/gas/testsuite/gas/sh/sh64/err-1.s
new file mode 100644
index 0000000..4e23c4f
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/err-1.s
@@ -0,0 +1,47 @@
+! { dg-do assemble }
+
+! Various operand errors experienced during the creation of basic-1.s;
+! some are redundant.
+!
+ addz.l r51,-42,r30 ! { dg-error "invalid operand" }
+ beqi r4,-33,tr5 ! { dg-error "not a 6-bit signed value" }
+ fadd.s dr41,dr59,dr19 ! { dg-error "invalid operand" }
+ fdiv.s fr13,dr26,fr19 ! { dg-error "invalid operand" }
+ fld.p r53,-3000,fp39 ! { dg-error "invalid operand" }
+ fld.s r53,1010,fr53 ! { dg-error "not a multiple of 4" }
+ float.qd dr45,dr16 ! { dg-error "invalid operand" }
+ float.qs dr31,fr11 ! { dg-error "invalid operand" }
+ fmov.d dr8,dr43 ! { dg-error "invalid operand" }
+ fmov.qd r45,dr5 ! { dg-error "invalid operand" }
+ fmul.d dr7,dr57,dr42 ! { dg-error "invalid operand" }
+ fneg.s fr0,dr33 ! { dg-error "invalid operand" }
+ fsqrt.d dr31,dr43 ! { dg-error "invalid operand" }
+ fst.p r54,-4008,fp11 ! { dg-error "invalid operand" }
+ fstx.p r38,r26,dr52 ! { dg-error "invalid operand" }
+ ftrc.dq dr15,dr29 ! { dg-error "invalid operand" }
+ ftrv.s mtrx16,fv32,fv7 ! { dg-error "invalid operand" }
+ icbi r48,12000 ! { dg-error "not a 11-bit signed value" }
+ ld.w r46,301,r11 ! { dg-error "not an even value" }
+ ldhi.l r6,302,r41 ! { dg-error "not a 6-bit signed value" }
+ ldlo.l r19,334,r48 ! { dg-error "not a 6-bit signed value" }
+ ldlo.q r9,311,r29 ! { dg-error "not a 6-bit signed value" }
+ ocbi r43,11008 ! { dg-error "not a 11-bit signed value" }
+ ocbp r40,-11008 ! { dg-error "not a 11-bit signed value" }
+ ocbwb r44,-10016 ! { dg-error "not a 11-bit signed value" }
+ prefi r57,16000 ! { dg-error "not a 11-bit signed value" }
+ putcfg r41,-511,r62 ! { dg-error "not a 6-bit signed value" }
+ shlld r56,38,r23 ! { dg-error "invalid operand" }
+ shlli.l r61,r35,r26 ! { dg-error "invalid operand" }
+ shlli r60,r36,r25 ! { dg-error "invalid operand" }
+ shlri r2,r32,r29 ! { dg-error "invalid operand" }
+ shlri.l r3,r31,r30 ! { dg-error "invalid operand" }
+ st.w r9,2002,r33 ! { dg-error "not a 11-bit signed value" }
+ sthi.l r10,-201,r43 ! { dg-error "not a 6-bit signed value" }
+ sthi.q r12,203,r44 ! { dg-error "not a 6-bit signed value" }
+ stlo.l r13,-207,r45 ! { dg-error "not a 6-bit signed value" }
+ stlo.q r15,217,r46 ! { dg-error "not a 6-bit signed value" }
+ stx.b r16,219,r47 ! { dg-error "invalid operand" }
+ stx.l r17,-500,r48 ! { dg-error "invalid operand" }
+ stx.q r19,-50,r49 ! { dg-error "invalid operand" }
+ stx.w r20,-150,r50 ! { dg-error "invalid operand" }
+ xori r29,-51,r55 ! { dg-error "not a 6-bit signed value" }
diff --git a/gas/testsuite/gas/sh/sh64/err-2.s b/gas/testsuite/gas/sh/sh64/err-2.s
new file mode 100644
index 0000000..8078a3b
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/err-2.s
@@ -0,0 +1,16 @@
+! { dg-do assemble }
+! { dg-options "--abi=32 --isa=shmedia" }
+!
+
+! This is a mainly a copy of movi64-2.s, but we check that out-of-range
+! errors are emitted for the 32-bit ABI.
+ .text
+start:
+ movi 65536 << 16,r3 ! { dg-error "not a 32-bit signed value" }
+ movi -32769 << 16,r3 ! { dg-error "not a 32-bit signed value" }
+ movi 32768 << 16,r3
+ movi -32768 << 16,r3
+ movi 32767 << 48,r3 ! { dg-error "not a 32-bit signed value" }
+ movi 32768 << 48,r3 ! { dg-error "not a 32-bit signed value" }
+ movi -32768 << 48,r3 ! { dg-error "not a 32-bit signed value" }
+
diff --git a/gas/testsuite/gas/sh/sh64/err-3.s b/gas/testsuite/gas/sh/sh64/err-3.s
new file mode 100644
index 0000000..dd1a88c
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/err-3.s
@@ -0,0 +1,36 @@
+! { dg-do assemble }
+! { dg-options "--abi=32" }
+
+! Check that we get errors for immediate operands with expressions with
+! resolvable differences between local symbols, but not in range for the
+! operands, and no errors for nearby valid values.
+
+ .text
+ .mode SHmedia
+start:
+ addi r50,.Lab500 - .Lab1,r40
+ addi r50,.Lab1000 - .Lab1,r40 ! { dg-error "not a 10-bit signed value" }
+ addi r50,.Lab500 - .Lab1 + 1,r40
+ addi r50,.Lab500 - .Lab1 + 2,r40
+ ld.uw r30,.Lab1000 - .Lab1,r40
+ ld.uw r30,.Lab500 - .Lab1 + 1,r40 ! { dg-error "not an even value" }
+ ld.uw r30,.Lab500 - .Lab1 + 2,r40
+ ld.uw r50,.Lab2000 - .Lab1,r20 ! { dg-error "not a 11-bit signed value" }
+ ld.l r50,.Lab2000 - .Lab1,r20
+ ld.l r50,.Lab2000 - .Lab1 + 1,r20 ! { dg-error "not a multiple of 4" }
+ ld.l r50,.Lab2000 - .Lab1 + 2,r20 ! { dg-error "not a multiple of 4" }
+ ld.l r50,.Lab4000 - .Lab1,r20 ! { dg-error "not a 12-bit signed value" }
+ nop
+
+ .data
+ .long 0
+.Lab1:
+ .zero 500,0
+.Lab500:
+ .zero 500,0
+.Lab1000:
+ .zero 1000,0
+.Lab2000:
+ .zero 2000,0
+.Lab4000:
+ .long 0
diff --git a/gas/testsuite/gas/sh/sh64/err-4.s b/gas/testsuite/gas/sh/sh64/err-4.s
new file mode 100644
index 0000000..2bd72f1
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/err-4.s
@@ -0,0 +1,27 @@
+! { dg-do assemble }
+! { dg-options "--abi=32 -no-mix" }
+
+! Check that we can't have different ISA:s in the same section if disallowed.
+
+ .text
+ .mode SHmedia
+start:
+ nop
+
+ .mode SHcompact
+ nop ! { dg-error "not allowed in same section" }
+
+ .section .text.other,"ax"
+ .mode SHmedia
+ nop
+
+ .mode SHcompact
+ nop ! { dg-error "not allowed in same section" }
+
+ .section .text.more,"ax"
+ .mode SHmedia
+ nop
+
+ .section .text.yetmore,"ax"
+ .mode SHcompact
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/err-abi-32.s b/gas/testsuite/gas/sh/sh64/err-abi-32.s
new file mode 100644
index 0000000..400a262
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/err-abi-32.s
@@ -0,0 +1,10 @@
+! Check .abi pseudo assertion.
+
+! { dg-do assemble }
+! { dg-options "-abi=64" }
+
+ .text
+ .abi 32 ! { dg-error "options do not specify 32-bit ABI" }
+
+start:
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/err-abi-64.s b/gas/testsuite/gas/sh/sh64/err-abi-64.s
new file mode 100644
index 0000000..3e136d2
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/err-abi-64.s
@@ -0,0 +1,10 @@
+! Check .abi pseudo assertion.
+
+! { dg-do assemble }
+! { dg-options "-abi=32" }
+
+ .text
+ .abi 64 ! { dg-error "options do not specify 64-bit ABI" }
+
+start:
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/err-dsp.s b/gas/testsuite/gas/sh/sh64/err-dsp.s
new file mode 100644
index 0000000..52173a7
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/err-dsp.s
@@ -0,0 +1,15 @@
+! Check that we get errors when assembling DSP instructions.
+
+! { dg-do assemble }
+! { dg-options "-isa=SHcompact" }
+
+! Regarding the opcode table, all insns are marked arch_sh_dsp_up; there are
+! no insns marked arch_sh3_dsp_up. We check a few marked arch_sh_dsp_up:
+! two have operands only recognized with -dsp; the other has an opcode not
+! recognized without -dsp.
+
+ .text
+start:
+ ldc r3,mod ! { dg-error "invalid operands" }
+ ldre @(16,pc) ! { dg-error "unknown opcode" }
+ lds r4,a0 ! { dg-error "invalid operands" }
diff --git a/gas/testsuite/gas/sh/sh64/err-movi-noexp-1.s b/gas/testsuite/gas/sh/sh64/err-movi-noexp-1.s
new file mode 100644
index 0000000..50374f9
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/err-movi-noexp-1.s
@@ -0,0 +1,24 @@
+! Check that we get errors for MOVI operands out-of-range with -no-expand.
+
+! { dg-do assemble }
+! { dg-options "--abi=32 --isa=shmedia -no-expand" }
+
+ .text
+start:
+ movi externalsym + 123,r3
+ movi 65535,r3 ! { dg-error "not a 16-bit signed value" }
+ movi 65536,r3 ! { dg-error "not a 16-bit signed value" }
+ movi 65535 << 16,r3 ! { dg-error "not a 16-bit signed value" }
+ movi 32767,r3
+ movi 32768,r3 ! { dg-error "not a 16-bit signed value" }
+ movi 32767 << 16,r3 ! { dg-error "not a 16-bit signed value" }
+ movi -32768,r3
+ movi -32769,r3 ! { dg-error "not a 16-bit signed value" }
+ movi -32768 << 16,r3 ! { dg-error "not a 16-bit signed value" }
+ movi localsym + 73,r4
+ movi forwardsym - 42,r4
+ .set forwardsym,47
+
+ .data
+localsym:
+ .long 1
diff --git a/gas/testsuite/gas/sh/sh64/err-noexp-cmd1.s b/gas/testsuite/gas/sh/sh64/err-noexp-cmd1.s
new file mode 100644
index 0000000..3e3dde7
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/err-noexp-cmd1.s
@@ -0,0 +1,10 @@
+! Check command-line error checking. The option -no-expand is not valid
+! unless SHcompact/SHmedia is specified.
+
+! { dg-do assemble }
+! { dg-options "-no-expand" }
+! { dg-error ".* only valid with SHcompact or SHmedia" "" { target sh64-*-* } 0 }
+
+ .text
+start:
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/err-pt-1.s b/gas/testsuite/gas/sh/sh64/err-pt-1.s
new file mode 100644
index 0000000..c8a50a8
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/err-pt-1.s
@@ -0,0 +1,18 @@
+! Check that we get errors for a PT operand out of range with -no-relax.
+
+! { dg-do assemble }
+! { dg-options "--abi=32 --no-expand" }
+
+ .mode SHmedia
+start:
+ nop
+start2:
+ pt x0,tr3 ! { dg-error "operand out of range" }
+x1:
+ pt x0,tr4
+ .space 32767*4-4,0
+x0:
+ pt x1,tr5
+ pt x1,tr6
+ pt x1,tr6 ! { dg-error "operand out of range" }
+ pt x1,tr7 ! { dg-error "operand out of range" }
diff --git a/gas/testsuite/gas/sh/sh64/err-pt32-cmd1.s b/gas/testsuite/gas/sh/sh64/err-pt32-cmd1.s
new file mode 100644
index 0000000..d92f62f
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/err-pt32-cmd1.s
@@ -0,0 +1,10 @@
+! Check command-line error checking. The option -expand-pt32 is only valid
+! with -abi=64
+
+! { dg-do assemble }
+! { dg-options "-expand-pt32" }
+! { dg-error ".* only valid with -abi=64" "" { target sh64-*-* } 0 }
+
+ .text
+start:
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/err-pt32-cmd2.s b/gas/testsuite/gas/sh/sh64/err-pt32-cmd2.s
new file mode 100644
index 0000000..f75f3c8
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/err-pt32-cmd2.s
@@ -0,0 +1,10 @@
+! Check command-line error checking. The option -expand-pt32 is invalid with
+! -no-expand.
+
+! { dg-do assemble }
+! { dg-options "-abi=64 -expand-pt32 -no-expand" }
+! { dg-error ".* invalid together with -no-expand" "" { target sh64-*-* } 0 }
+
+ .text
+start:
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/err-pt32-cmd3.s b/gas/testsuite/gas/sh/sh64/err-pt32-cmd3.s
new file mode 100644
index 0000000..d64cc44
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/err-pt32-cmd3.s
@@ -0,0 +1,10 @@
+! Check command-line error checking. The option -expand-pt32 is invalid with
+! -abi=32 just as it is invalid with no SHmedia/SHcompact options.
+
+! { dg-do assemble }
+! { dg-options "-abi=32 -expand-pt32" }
+! { dg-error ".* only valid with -abi=64" "" { target sh64-*-* } 0 }
+
+ .text
+start:
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/err-ptb-1.s b/gas/testsuite/gas/sh/sh64/err-ptb-1.s
new file mode 100644
index 0000000..7c881bd
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/err-ptb-1.s
@@ -0,0 +1,34 @@
+! Check that PTB to a assembly-time-resolvable SHcompact operand
+! gets an error. Likewise PTA.
+
+! { dg-do assemble }
+! { dg-options "--abi=32" }
+
+ .text
+ .mode SHmedia
+start:
+ ptb shmediasymbol1,tr1 ! { dg-error "PTB operand is a SHmedia symbol" }
+shmediasymbol3:
+ ptb shcompactsymbol1,tr1
+ pta shcompactsymbol2,tr3 ! { dg-error "PTA operand is a SHcompact symbol" }
+shmediasymbol1:
+ ptb shmediasymbol2,tr2 ! { dg-error "PTB operand is a SHmedia symbol" }
+
+ .mode SHcompact
+shcompact:
+ nop
+ nop
+shcompactsymbol2:
+ nop
+ nop
+shcompactsymbol1:
+ nop
+ nop
+
+ .mode SHmedia
+shmedia:
+ nop
+shmediasymbol2:
+ nop
+ ptb shmediasymbol3,tr3 ! { dg-error "PTB operand is a SHmedia symbol" }
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/err-ptb-2.s b/gas/testsuite/gas/sh/sh64/err-ptb-2.s
new file mode 100644
index 0000000..216e434
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/err-ptb-2.s
@@ -0,0 +1,34 @@
+! Check that PTB to a assembly-time-resolvable SHcompact operand gets an
+! error. Mostly like err-ptb-1.s, except we also specify --no-expand.
+
+! { dg-do assemble }
+! { dg-options "--abi=32 --no-expand" }
+
+ .text
+ .mode SHmedia
+start:
+ ptb shmediasymbol1,tr1 ! { dg-error "PTB operand is a SHmedia symbol" }
+shmediasymbol3:
+ ptb shcompactsymbol1,tr1
+ pta shcompactsymbol2,tr3 ! { dg-error "PTA operand is a SHcompact symbol" }
+shmediasymbol1:
+ ptb shmediasymbol2,tr2 ! { dg-error "PTB operand is a SHmedia symbol" }
+
+ .mode SHcompact
+shcompact:
+ nop
+ nop
+shcompactsymbol2:
+ nop
+ nop
+shcompactsymbol1:
+ nop
+ nop
+
+ .mode SHmedia
+shmedia:
+ nop
+shmediasymbol2:
+ nop
+ ptb shmediasymbol3,tr3 ! { dg-error "PTB operand is a SHmedia symbol" }
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/err.exp b/gas/testsuite/gas/sh/sh64/err.exp
new file mode 100644
index 0000000..22a5251
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/err.exp
@@ -0,0 +1,9 @@
+load_lib gas-dg.exp
+dg-init
+
+if [istarget sh64-*-*] then {
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/warn-*.s]] "" "--isa=SHmedia"
+ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s]] "" "--isa=SHmedia"
+}
+
+dg-finish
diff --git a/gas/testsuite/gas/sh/sh64/immexpr1.s b/gas/testsuite/gas/sh/sh64/immexpr1.s
new file mode 100644
index 0000000..31060a12d
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/immexpr1.s
@@ -0,0 +1,85 @@
+! Check that immediate operands with expressions with differences between
+! local symbols work for other than 16-bit operands.
+
+ .text
+ .mode SHmedia
+start:
+ addi r50,.Lab500 - .Lab1,r40
+ addi r50,-(.Lab500 - .Lab1),r40
+ addi r50,(.Lab1000 - .Lab1)/2,r40
+ addi r50,(.Lab4000 - .Lab1)/8,r40
+ addi r50,-(.Lab1000 - .Lab1)/2,r40
+ addi r50,-(.Lab4000 - .Lab1)/8,r40
+ addi r50,.Lab500 - .Lab1 + 1,r40
+ addi r50,.Lab500 - .Lab1 + 2,r40
+ addi r50,-(.Lab500 - .Lab1 + 1),r40
+ addi r50,-(.Lab500 - .Lab1 + 2),r40
+ ld.uw r30,.Lab1000 - .Lab1,r40
+ ld.uw r30,.Lab500 - .Lab1 - 2,r40
+ ld.uw r30,.Lab500 - .Lab1 + 2,r40
+ ld.uw r50,(.Lab2000 - .Lab1)/2,r20
+ ld.uw r30,-(.Lab1000 - .Lab1),r40
+ ld.uw r30,-(.Lab500 - .Lab1 - 2),r40
+ ld.uw r30,-(.Lab500 - .Lab1 + 2),r40
+ ld.uw r50,-(.Lab2000 - .Lab1)/2,r20
+ ld.l r50,.Lab2000 - .Lab1,r20
+ ld.l r50,.Lab2000 - .Lab1 + 4,r20
+ ld.l r50,.Lab2000 - .Lab1 - 4,r20
+ ld.l r50,(.Lab4000 - .Lab1)/2,r20
+ ld.l r50,(.Lab4000 - .Lab1)/2 + 4,r20
+ ld.l r50,(.Lab4000 - .Lab1)/2 - 4,r20
+ ld.l r50,-(.Lab2000 - .Lab1),r20
+ ld.l r50,-(.Lab2000 - .Lab1 + 4),r20
+ ld.l r50,-(.Lab2000 - .Lab1 - 4),r20
+ ld.l r50,-(.Lab4000 - .Lab1)/2,r20
+ ld.l r50,-(.Lab4000 - .Lab1)/2 + 4,r20
+ ld.l r50,-(.Lab4000 - .Lab1)/2 - 4,r20
+ nop
+ addi r50,.Lab500t - .Lab1t,r40
+ addi r50,(.Lab1000t - .Lab1t)/2,r40
+ addi r50,(.Lab4000t - .Lab1t)/8,r40
+ addi r50,.Lab500t - .Lab1t + 1,r40
+ addi r50,.Lab500t - .Lab1t + 2,r40
+ ld.uw r30,.Lab1000t - .Lab1t,r40
+ ld.uw r30,.Lab500t - .Lab1t - 2,r40
+ ld.uw r30,.Lab500t - .Lab1t + 2,r40
+ ld.uw r50,(.Lab2000t - .Lab1t)/2,r20
+ ld.l r50,.Lab2000t - .Lab1t,r20
+ ld.l r50,.Lab2000t - .Lab1t + 4,r20
+ ld.l r50,.Lab2000t - .Lab1t - 4,r20
+ addi r50,.Lab500t - .Lab1t,r40
+ addi r50,-((.Lab1000t - .Lab1t)/2),r40
+ addi r50,-((.Lab4000t - .Lab1t)/8),r40
+ addi r50,-(.Lab500t - .Lab1t + 1),r40
+ addi r50,-(.Lab500t - .Lab1t + 2),r40
+ ld.uw r30,-(.Lab1000t - .Lab1t),r40
+ ld.uw r30,-(.Lab500t - .Lab1t - 2),r40
+ ld.uw r30,-(.Lab500t - .Lab1t + 2),r40
+ ld.uw r50,-((.Lab2000t - .Lab1t)/2),r20
+ ld.l r50,-(.Lab2000t - .Lab1t),r20
+ ld.l r50,-(.Lab2000t - .Lab1t + 4),r20
+ ld.l r50,-(.Lab2000t - .Lab1t - 4),r20
+ nop
+ .long 0
+.Lab1t:
+ .zero 500,0
+.Lab500t:
+ .zero 500,0
+.Lab1000t:
+ .zero 1000,0
+.Lab2000t:
+ .zero 2000,0
+.Lab4000t:
+
+ .data
+ .long 0
+.Lab1:
+ .zero 500,0
+.Lab500:
+ .zero 500,0
+.Lab1000:
+ .zero 1000,0
+.Lab2000:
+ .zero 2000,0
+.Lab4000:
+ .long 0
diff --git a/gas/testsuite/gas/sh/sh64/immexpr2.s b/gas/testsuite/gas/sh/sh64/immexpr2.s
new file mode 100644
index 0000000..2eeda98
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/immexpr2.s
@@ -0,0 +1,16 @@
+! This expression and the associated resolved-expression case is new for SH64.
+
+ .data
+ .uaquad end-start
+ .uaquad .Lend-.Lstart
+
+ .text
+ .mode SHmedia
+start:
+ nop
+end:
+.Lstart:
+ nop
+ nop
+.Lend:
+
diff --git a/gas/testsuite/gas/sh/sh64/immexpr32-1.d b/gas/testsuite/gas/sh/sh64/immexpr32-1.d
new file mode 100644
index 0000000..7541630
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/immexpr32-1.d
@@ -0,0 +1,67 @@
+#as: --abi=32
+#objdump: -dr
+#source: immexpr1.s
+#name: Immediate resolved operands, 32-bit ABI.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+0+ <start>:
+[ ]+0:[ ]+d327d280[ ]+addi r50,500,r40
+[ ]+4:[ ]+d3283280[ ]+addi r50,-500,r40
+[ ]+8:[ ]+d327d280[ ]+addi r50,500,r40
+[ ]+c:[ ]+d327d280[ ]+addi r50,500,r40
+[ ]+10:[ ]+d3283280[ ]+addi r50,-500,r40
+[ ]+14:[ ]+d3283280[ ]+addi r50,-500,r40
+[ ]+18:[ ]+d327d680[ ]+addi r50,501,r40
+[ ]+1c:[ ]+d327da80[ ]+addi r50,502,r40
+[ ]+20:[ ]+d3282e80[ ]+addi r50,-501,r40
+[ ]+24:[ ]+d3282a80[ ]+addi r50,-502,r40
+[ ]+28:[ ]+b1e7d280[ ]+ld\.uw r30,1000,r40
+[ ]+2c:[ ]+b1e3e680[ ]+ld\.uw r30,498,r40
+[ ]+30:[ ]+b1e3ee80[ ]+ld\.uw r30,502,r40
+[ ]+34:[ ]+b327d140[ ]+ld\.uw r50,1000,r20
+[ ]+38:[ ]+b1e83280[ ]+ld\.uw r30,-1000,r40
+[ ]+3c:[ ]+b1ec1e80[ ]+ld\.uw r30,-498,r40
+[ ]+40:[ ]+b1ec1680[ ]+ld\.uw r30,-502,r40
+[ ]+44:[ ]+b3283140[ ]+ld\.uw r50,-1000,r20
+[ ]+48:[ ]+8b27d140[ ]+ld\.l r50,2000,r20
+[ ]+4c:[ ]+8b27d540[ ]+ld\.l r50,2004,r20
+[ ]+50:[ ]+8b27cd40[ ]+ld\.l r50,1996,r20
+[ ]+54:[ ]+8b27d140[ ]+ld\.l r50,2000,r20
+[ ]+58:[ ]+8b27d540[ ]+ld\.l r50,2004,r20
+[ ]+5c:[ ]+8b27cd40[ ]+ld\.l r50,1996,r20
+[ ]+60:[ ]+8b283140[ ]+ld\.l r50,-2000,r20
+[ ]+64:[ ]+8b282d40[ ]+ld\.l r50,-2004,r20
+[ ]+68:[ ]+8b283540[ ]+ld\.l r50,-1996,r20
+[ ]+6c:[ ]+8b283140[ ]+ld\.l r50,-2000,r20
+[ ]+70:[ ]+8b283540[ ]+ld\.l r50,-1996,r20
+[ ]+74:[ ]+8b282d40[ ]+ld\.l r50,-2004,r20
+[ ]+78:[ ]+6ff0fff0[ ]+nop
+[ ]+7c:[ ]+d327d280[ ]+addi r50,500,r40
+[ ]+80:[ ]+d327d280[ ]+addi r50,500,r40
+[ ]+84:[ ]+d327d280[ ]+addi r50,500,r40
+[ ]+88:[ ]+d327d680[ ]+addi r50,501,r40
+[ ]+8c:[ ]+d327da80[ ]+addi r50,502,r40
+[ ]+90:[ ]+b1e7d280[ ]+ld\.uw r30,1000,r40
+[ ]+94:[ ]+b1e3e680[ ]+ld\.uw r30,498,r40
+[ ]+98:[ ]+b1e3ee80[ ]+ld\.uw r30,502,r40
+[ ]+9c:[ ]+b327d140[ ]+ld\.uw r50,1000,r20
+[ ]+a0:[ ]+8b27d140[ ]+ld\.l r50,2000,r20
+[ ]+a4:[ ]+8b27d540[ ]+ld\.l r50,2004,r20
+[ ]+a8:[ ]+8b27cd40[ ]+ld\.l r50,1996,r20
+[ ]+ac:[ ]+d327d280[ ]+addi r50,500,r40
+[ ]+b0:[ ]+d3283280[ ]+addi r50,-500,r40
+[ ]+b4:[ ]+d3283280[ ]+addi r50,-500,r40
+[ ]+b8:[ ]+d3282e80[ ]+addi r50,-501,r40
+[ ]+bc:[ ]+d3282a80[ ]+addi r50,-502,r40
+[ ]+c0:[ ]+b1e83280[ ]+ld\.uw r30,-1000,r40
+[ ]+c4:[ ]+b1ec1e80[ ]+ld\.uw r30,-498,r40
+[ ]+c8:[ ]+b1ec1680[ ]+ld\.uw r30,-502,r40
+[ ]+cc:[ ]+b3283140[ ]+ld\.uw r50,-1000,r20
+[ ]+d0:[ ]+8b283140[ ]+ld\.l r50,-2000,r20
+[ ]+d4:[ ]+8b282d40[ ]+ld\.l r50,-2004,r20
+[ ]+d8:[ ]+8b283540[ ]+ld\.l r50,-1996,r20
+[ ]+dc:[ ]+6ff0fff0[ ]+nop
+[ ]\.\.\.
diff --git a/gas/testsuite/gas/sh/sh64/immexpr32-2.d b/gas/testsuite/gas/sh/sh64/immexpr32-2.d
new file mode 100644
index 0000000..d306444
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/immexpr32-2.d
@@ -0,0 +1,11 @@
+#as: --abi=32
+#objdump: -sr
+#source: immexpr2.s
+#name: Resolved 64-bit operand, 32-bit ABI.
+
+.*: file format .*-sh64
+
+Contents of section \.text:
+ 0000 6ff0fff0 6ff0fff0 6ff0fff0 .*
+Contents of section .data:
+ 0000 00000000 00000004 00000000 00000008 .*
diff --git a/gas/testsuite/gas/sh/sh64/immexpr64-1.d b/gas/testsuite/gas/sh/sh64/immexpr64-1.d
new file mode 100644
index 0000000..6b2decb
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/immexpr64-1.d
@@ -0,0 +1,68 @@
+#as: --abi=64
+#objdump: -dr
+#source: immexpr1.s
+#name: Immediate resolved operands, 64-bit ABI.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+0+ <start>:
+[ ]+0:[ ]+d327d280[ ]+addi r50,500,r40
+[ ]+4:[ ]+d3283280[ ]+addi r50,-500,r40
+[ ]+8:[ ]+d327d280[ ]+addi r50,500,r40
+[ ]+c:[ ]+d327d280[ ]+addi r50,500,r40
+[ ]+10:[ ]+d3283280[ ]+addi r50,-500,r40
+[ ]+14:[ ]+d3283280[ ]+addi r50,-500,r40
+[ ]+18:[ ]+d327d680[ ]+addi r50,501,r40
+[ ]+1c:[ ]+d327da80[ ]+addi r50,502,r40
+[ ]+20:[ ]+d3282e80[ ]+addi r50,-501,r40
+[ ]+24:[ ]+d3282a80[ ]+addi r50,-502,r40
+[ ]+28:[ ]+b1e7d280[ ]+ld\.uw r30,1000,r40
+[ ]+2c:[ ]+b1e3e680[ ]+ld\.uw r30,498,r40
+[ ]+30:[ ]+b1e3ee80[ ]+ld\.uw r30,502,r40
+[ ]+34:[ ]+b327d140[ ]+ld\.uw r50,1000,r20
+[ ]+38:[ ]+b1e83280[ ]+ld\.uw r30,-1000,r40
+[ ]+3c:[ ]+b1ec1e80[ ]+ld\.uw r30,-498,r40
+[ ]+40:[ ]+b1ec1680[ ]+ld\.uw r30,-502,r40
+[ ]+44:[ ]+b3283140[ ]+ld\.uw r50,-1000,r20
+[ ]+48:[ ]+8b27d140[ ]+ld\.l r50,2000,r20
+[ ]+4c:[ ]+8b27d540[ ]+ld\.l r50,2004,r20
+[ ]+50:[ ]+8b27cd40[ ]+ld\.l r50,1996,r20
+[ ]+54:[ ]+8b27d140[ ]+ld\.l r50,2000,r20
+[ ]+58:[ ]+8b27d540[ ]+ld\.l r50,2004,r20
+[ ]+5c:[ ]+8b27cd40[ ]+ld\.l r50,1996,r20
+[ ]+60:[ ]+8b283140[ ]+ld\.l r50,-2000,r20
+[ ]+64:[ ]+8b282d40[ ]+ld\.l r50,-2004,r20
+[ ]+68:[ ]+8b283540[ ]+ld\.l r50,-1996,r20
+[ ]+6c:[ ]+8b283140[ ]+ld\.l r50,-2000,r20
+[ ]+70:[ ]+8b283540[ ]+ld\.l r50,-1996,r20
+[ ]+74:[ ]+8b282d40[ ]+ld\.l r50,-2004,r20
+[ ]+78:[ ]+6ff0fff0[ ]+nop
+[ ]+7c:[ ]+d327d280[ ]+addi r50,500,r40
+[ ]+80:[ ]+d327d280[ ]+addi r50,500,r40
+[ ]+84:[ ]+d327d280[ ]+addi r50,500,r40
+[ ]+88:[ ]+d327d680[ ]+addi r50,501,r40
+[ ]+8c:[ ]+d327da80[ ]+addi r50,502,r40
+[ ]+90:[ ]+b1e7d280[ ]+ld\.uw r30,1000,r40
+[ ]+94:[ ]+b1e3e680[ ]+ld\.uw r30,498,r40
+[ ]+98:[ ]+b1e3ee80[ ]+ld\.uw r30,502,r40
+[ ]+9c:[ ]+b327d140[ ]+ld\.uw r50,1000,r20
+[ ]+a0:[ ]+8b27d140[ ]+ld\.l r50,2000,r20
+[ ]+a4:[ ]+8b27d540[ ]+ld\.l r50,2004,r20
+[ ]+a8:[ ]+8b27cd40[ ]+ld\.l r50,1996,r20
+[ ]+ac:[ ]+d327d280[ ]+addi r50,500,r40
+[ ]+b0:[ ]+d3283280[ ]+addi r50,-500,r40
+[ ]+b4:[ ]+d3283280[ ]+addi r50,-500,r40
+[ ]+b8:[ ]+d3282e80[ ]+addi r50,-501,r40
+[ ]+bc:[ ]+d3282a80[ ]+addi r50,-502,r40
+[ ]+c0:[ ]+b1e83280[ ]+ld\.uw r30,-1000,r40
+[ ]+c4:[ ]+b1ec1e80[ ]+ld\.uw r30,-498,r40
+[ ]+c8:[ ]+b1ec1680[ ]+ld\.uw r30,-502,r40
+[ ]+cc:[ ]+b3283140[ ]+ld\.uw r50,-1000,r20
+[ ]+d0:[ ]+8b283140[ ]+ld\.l r50,-2000,r20
+[ ]+d4:[ ]+8b282d40[ ]+ld\.l r50,-2004,r20
+[ ]+d8:[ ]+8b283540[ ]+ld\.l r50,-1996,r20
+[ ]+dc:[ ]+6ff0fff0[ ]+nop
+[ ]\.\.\.
+
diff --git a/gas/testsuite/gas/sh/sh64/immexpr64-2.d b/gas/testsuite/gas/sh/sh64/immexpr64-2.d
new file mode 100644
index 0000000..f782ce4
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/immexpr64-2.d
@@ -0,0 +1,11 @@
+#as: --abi=64
+#objdump: -sr
+#source: immexpr2.s
+#name: Resolved 64-bit operand, 64-bit ABI.
+
+.*: file format .*-sh64
+
+Contents of section \.text:
+ 0000 6ff0fff0 6ff0fff0 6ff0fff0 .*
+Contents of section .data:
+ 0000 00000000 00000004 00000000 00000008 .*
diff --git a/gas/testsuite/gas/sh/sh64/lineno.d b/gas/testsuite/gas/sh/sh64/lineno.d
new file mode 100644
index 0000000..99ac94c
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/lineno.d
@@ -0,0 +1,19 @@
+#as: --abi=32 --isa=shmedia -gdwarf2
+#objdump: -dl
+#source: lineno.s
+#name: Dwarf2 line numbers vs macro opcodes
+
+.*: file format .*-sh64
+
+Disassembly of section .text:
+
+[0]+ <start>:
+start.*:
+[ ]+0:[ ]+cc000410[ ]+movi[ ]+1,r1
+.*:4
+[ ]+4:[ ]+cc000410[ ]+movi[ ]+1,r1
+.*:5
+[ ]+8:[ ]+ca1a8010[ ]+shori[ ]+34464,r1
+[ ]+c:[ ]+6ff0fff0[ ]+nop[ ]*
+.*:6
+[ ]+10:[ ]+6ff0fff0[ ]+nop[ ]*
diff --git a/gas/testsuite/gas/sh/sh64/lineno.s b/gas/testsuite/gas/sh/sh64/lineno.s
new file mode 100644
index 0000000..3804976
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/lineno.s
@@ -0,0 +1,7 @@
+ .text
+
+start:
+ movi 1,r1
+ movi 100000,r1
+ nop
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/localcom-1.d b/gas/testsuite/gas/sh/sh64/localcom-1.d
new file mode 100644
index 0000000..395938d
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/localcom-1.d
@@ -0,0 +1,30 @@
+#as: --abi=32
+#objdump: -srt
+#source: localcom-1.s
+#name: Datalabel on local comm symbol and equated local comm symbol
+
+.*: file format .*-sh64
+
+SYMBOL TABLE:
+0+0 l d \.text 0+
+0+0 l d \.data 0+
+0+0 l d \.bss 0+
+0+0 l \.text 0+ start
+0+c l O \.bss 0+4 dd
+0+c l O \.bss 0+4 d
+0+4 l O \.bss 0+4 b
+0+0 l O \.bss 0+4 a
+0+8 l O \.bss 0+4 c
+
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET *TYPE *VALUE
+0+10 R_SH_DIR32 \.bss
+0+14 R_SH_DIR32 \.bss
+0+18 R_SH_DIR32 \.bss
+
+
+Contents of section \.text:
+ 0000 00090009 00090009 00090009 00090009 .*
+ 0010 00000004 00000004 0000000c 1234 .*
+Contents of section \.data:
diff --git a/gas/testsuite/gas/sh/sh64/localcom-1.s b/gas/testsuite/gas/sh/sh64/localcom-1.s
new file mode 100644
index 0000000..53295d6
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/localcom-1.s
@@ -0,0 +1,26 @@
+! The implicit equation from a datalabel to the main symbol was incorrect
+! at one time. This is reasonably close to the original testcase.
+
+ .mode SHcompact
+start:
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ nop
+ .set dd,d
+ .long b
+ .long datalabel b
+ .long datalabel dd
+ .word 0x1234
+ .local a
+ .comm a,4,4
+ .local b
+ .comm b,4,4
+ .local c
+ .comm c,4,4
+ .local d
+ .comm d,4,4
diff --git a/gas/testsuite/gas/sh/sh64/mix-1.d b/gas/testsuite/gas/sh/sh64/mix-1.d
new file mode 100644
index 0000000..6d4493c
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/mix-1.d
@@ -0,0 +1,42 @@
+#as: --abi=32
+#objdump: -dr
+#name: Mixed-ISA objects.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+0+ <start>:
+[ ]+0:[ ]+89 01 bt 6 <forw>
+[ ]+2:[ ]+c7 00[ ]+mova 4 <start2>,r0
+
+0+4 <start2>:
+[ ]+4:[ ]+00[ ]+09 nop
+
+0+6 <forw>:
+[ ]+6:[ ]+00[ ]+09 nop
+Disassembly of section \.text\.media:
+
+0+ <mediacode>:
+[ ]+0:[ ]+cc000190[ ]+movi 0,r25
+[ ]+0:[ ]+R_SH_IMM_MEDLOW16_PCREL \.text\+0xf*fffffffe
+[ ]+4:[ ]+c8000190[ ]+shori 0,r25
+[ ]+4:[ ]+R_SH_IMM_LOW16_PCREL \.text\+0x2
+[ ]+8:[ ]+6bf56640[ ]+ptrel/l r25,tr4
+[ ]+c:[ ]+cc000190[ ]+movi 0,r25
+[ ]+c:[ ]+R_SH_IMM_MEDLOW16_PCREL \.text\+0xf*fffffffc
+[ ]+10:[ ]+c8000190[ ]+shori 0,r25
+[ ]+10:[ ]+R_SH_IMM_LOW16_PCREL \.text
+[ ]+14:[ ]+6bf56650[ ]+ptrel/l r25,tr5
+
+0+18 <mediacode2>:
+[ ]+18:[ ]+cc000360[ ]+movi 0,r54
+[ ]+18:[ ]+R_SH_IMM_MEDLOW16 \.text\+0x4
+[ ]+1c:[ ]+c8000360[ ]+shori 0,r54
+[ ]+1c:[ ]+R_SH_IMM_LOW16 \.text\+0x4
+[ ]+20:[ ]+cc0002d0[ ]+movi 0,r45
+[ ]+20:[ ]+R_SH_IMM_MEDLOW16 \.text\.media\+0x19
+[ ]+24:[ ]+c80002d0[ ]+shori 0,r45
+[ ]+24:[ ]+R_SH_IMM_LOW16 \.text\.media\+0x19
+[ ]+28:[ ]+ebfff270[ ]+pta/l 18 <mediacode2>,tr7
+[ ]+2c:[ ]+6ff0fff0[ ]+nop
diff --git a/gas/testsuite/gas/sh/sh64/mix-1.s b/gas/testsuite/gas/sh/sh64/mix-1.s
new file mode 100644
index 0000000..03b96eb
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/mix-1.s
@@ -0,0 +1,21 @@
+! Check mixed-mode objects; different sections holding different ISA:s.
+ .mode SHcompact
+ .text
+start:
+ bt forw
+ mova start2,r0
+start2:
+ nop
+forw:
+ nop
+
+ .section .text.media,"ax"
+ .mode SHmedia
+mediacode:
+ ptb forw,tr4
+ pt start2,tr5
+mediacode2:
+ movi start2,r54
+ movi mediacode2,r45
+ pta mediacode2,tr7
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/mix-noexp-1.d b/gas/testsuite/gas/sh/sh64/mix-noexp-1.d
new file mode 100644
index 0000000..5596608
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/mix-noexp-1.d
@@ -0,0 +1,33 @@
+#as: --abi=32 -no-expand
+#objdump: -dr
+#source: mix-1.s
+#name: Mixed-ISA objects with -no-expand.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+0+ <start>:
+[ ]+0:[ ]+89 01 bt 6 <forw>
+[ ]+2:[ ]+c7 00[ ]+mova 4 <start2>,r0
+
+0+4 <start2>:
+[ ]+4:[ ]+00[ ]+09 nop
+
+0+6 <forw>:
+[ ]+6:[ ]+00[ ]+09 nop
+Disassembly of section \.text\.media:
+
+0+ <mediacode>:
+[ ]+0:[ ]+ec000640[ ]+ptb/l 4 <mediacode\+0x4>,tr4
+[ ]+0:[ ]+R_SH_PT_16[ ]+\.text\+0x6
+[ ]+4:[ ]+e8000250[ ]+pta/l 4 <mediacode\+0x4>,tr5
+[ ]+4:[ ]+R_SH_PT_16[ ]+\.text\+0x4
+
+0+8 <mediacode2>:
+[ ]+8:[ ]+cc000360[ ]+movi 0,r54
+[ ]+8:[ ]+R_SH_IMMS16[ ]+\.text\+0x4
+[ ]+c:[ ]+cc0002d0[ ]+movi 0,r45
+[ ]+c:[ ]+R_SH_IMMS16[ ]+\.text\.media\+0x9
+[ ]+10:[ ]+ebfffa70[ ]+pta/l 8 <mediacode2>,tr7
+[ ]+14:[ ]+6ff0fff0[ ]+nop
diff --git a/gas/testsuite/gas/sh/sh64/movi-1.s b/gas/testsuite/gas/sh/sh64/movi-1.s
new file mode 100644
index 0000000..7268548
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/movi-1.s
@@ -0,0 +1,20 @@
+! Check MOVI expansion. This one for the 32-bit subset.
+ .text
+start:
+ movi externalsym + 123,r3
+ movi 65535,r3
+ movi 65536,r3
+ movi 65535 << 16,r3
+ movi 32767,r3
+ movi 32768,r3
+ movi 32767 << 16,r3
+ movi -32768,r3
+ movi -32769,r3
+ movi -32768 << 16,r3
+ movi localsym + 73,r4
+ movi forwardsym - 42,r4
+ .set forwardsym,47
+
+ .data
+localsym:
+ .long 1
diff --git a/gas/testsuite/gas/sh/sh64/movi-2.s b/gas/testsuite/gas/sh/sh64/movi-2.s
new file mode 100644
index 0000000..222cec6
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/movi-2.s
@@ -0,0 +1,28 @@
+! Check MOVI expansion of local symbols that should get segment-relative
+! relocations.
+ .text
+start:
+ movi forw + 32,r33
+ movi forwdata + 40,r54
+ movi forwothertext + 44,r15
+forw:
+ movi forwotherdata + 48,r25
+
+ .data
+ .long 0 ! To get a non-zero segment offset for "forwdata".
+forwdata:
+ .long 0
+
+ .section .text.other,"ax"
+forwdummylabel: ! Needed to hang a marker that this section is SHmedia.
+ nop
+ nop
+forwothertext:
+ nop
+
+ .section .data.other,"aw"
+ .long 0
+ .long 0
+forwotherdata:
+ .long 0
+
diff --git a/gas/testsuite/gas/sh/sh64/movi-3.d b/gas/testsuite/gas/sh/sh64/movi-3.d
new file mode 100644
index 0000000..4900ef1
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/movi-3.d
@@ -0,0 +1,18 @@
+#as: --abi=64
+#objdump: -dr
+#source: movi-3.s
+#name: Assembler PC-rel resolved negative MOVI.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+cef68040[ ]+movi -16992,r4
+[ ]+4:[ ]+cfffc050[ ]+movi -16,r5
+[ ]+8:[ ]+cffffc60[ ]+movi -1,r6
+[ ]+c:[ ]+cffffc70[ ]+movi -1,r7
+[ ]+10:[ ]+cffffc80[ ]+movi -1,r8
+[ ]+14:[ ]+cbfffc80[ ]+shori 65535,r8
+[ ]+18:[ ]+cbffc080[ ]+shori 65520,r8
+[ ]+1c:[ ]+caf68080[ ]+shori 48544,r8
diff --git a/gas/testsuite/gas/sh/sh64/movi-3.s b/gas/testsuite/gas/sh/sh64/movi-3.s
new file mode 100644
index 0000000..b301001
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/movi-3.s
@@ -0,0 +1,10 @@
+! There was a bug with negative pc-relative numbers.
+ .mode SHmedia
+ .text
+start:
+ movi (start - 1000000 - end) & 65535,r4
+ movi ((start - 1000000 - end) >> 16) & 65535,r5
+ movi ((start - 1000000 - end) >> 32) & 65535,r6
+ movi ((start - 1000000 - end) >> 48) & 65535,r7
+ movi (start - 1000000 - end),r8
+end:
diff --git a/gas/testsuite/gas/sh/sh64/movi32-1.d b/gas/testsuite/gas/sh/sh64/movi32-1.d
new file mode 100644
index 0000000..f1674ec
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/movi32-1.d
@@ -0,0 +1,35 @@
+#as: --isa=shmedia --abi=32
+#objdump: -dr
+#source: movi-1.s
+#name: MOVI expansion, 32-bit ABI.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+cc000030[ ]+movi 0,r3
+[ ]+0:[ ]+R_SH_IMM_MEDLOW16 externalsym\+0x7b
+[ ]+4:[ ]+c8000030[ ]+shori 0,r3
+[ ]+4:[ ]+R_SH_IMM_LOW16 externalsym\+0x7b
+[ ]+8:[ ]+cc000030[ ]+movi 0,r3
+[ ]+c:[ ]+cbfffc30[ ]+shori 65535,r3
+[ ]+10:[ ]+cc000430[ ]+movi 1,r3
+[ ]+14:[ ]+c8000030[ ]+shori 0,r3
+[ ]+18:[ ]+cffffc30[ ]+movi -1,r3
+[ ]+1c:[ ]+c8000030[ ]+shori 0,r3
+[ ]+20:[ ]+cdfffc30[ ]+movi 32767,r3
+[ ]+24:[ ]+cc000030[ ]+movi 0,r3
+[ ]+28:[ ]+ca000030[ ]+shori 32768,r3
+[ ]+2c:[ ]+cdfffc30[ ]+movi 32767,r3
+[ ]+30:[ ]+c8000030[ ]+shori 0,r3
+[ ]+34:[ ]+ce000030[ ]+movi -32768,r3
+[ ]+38:[ ]+cffffc30[ ]+movi -1,r3
+[ ]+3c:[ ]+c9fffc30[ ]+shori 32767,r3
+[ ]+40:[ ]+ce000030[ ]+movi -32768,r3
+[ ]+44:[ ]+c8000030[ ]+shori 0,r3
+[ ]+48:[ ]+cc000040[ ]+movi 0,r4
+[ ]+48:[ ]+R_SH_IMM_MEDLOW16 \.data\+0x49
+[ ]+4c:[ ]+c8000040[ ]+shori 0,r4
+[ ]+4c:[ ]+R_SH_IMM_LOW16 \.data\+0x49
+[ ]+50:[ ]+cc001440[ ]+movi 5,r4
diff --git a/gas/testsuite/gas/sh/sh64/movi32-2.d b/gas/testsuite/gas/sh/sh64/movi32-2.d
new file mode 100644
index 0000000..eb1f22b
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/movi32-2.d
@@ -0,0 +1,36 @@
+#as: --isa=shmedia --abi=32
+#objdump: -dr
+#source: movi-2.s
+#name: MOVI expansion of local symbols with relocs, 32-bit ABI.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+0+ <start>:
+[ ]+0:[ ]+cc000210[ ]+movi 0,r33
+[ ]+0:[ ]+R_SH_IMM_MEDLOW16 \.text\+0x39
+[ ]+4:[ ]+c8000210[ ]+shori 0,r33
+[ ]+4:[ ]+R_SH_IMM_LOW16 \.text\+0x39
+[ ]+8:[ ]+cc000360[ ]+movi 0,r54
+[ ]+8:[ ]+R_SH_IMM_MEDLOW16 \.data\+0x2c
+[ ]+c:[ ]+c8000360[ ]+shori 0,r54
+[ ]+c:[ ]+R_SH_IMM_LOW16 \.data\+0x2c
+[ ]+10:[ ]+cc0000f0[ ]+movi 0,r15
+[ ]+10:[ ]+R_SH_IMM_MEDLOW16 \.text\.other\+0x35
+[ ]+14:[ ]+c80000f0[ ]+shori 0,r15
+[ ]+14:[ ]+R_SH_IMM_LOW16 \.text\.other\+0x35
+
+0+18 <forw>:
+[ ]+18:[ ]+cc000190[ ]+movi 0,r25
+[ ]+18:[ ]+R_SH_IMM_MEDLOW16 \.data\.other\+0x38
+[ ]+1c:[ ]+c8000190[ ]+shori 0,r25
+[ ]+1c:[ ]+R_SH_IMM_LOW16 \.data\.other\+0x38
+Disassembly of section \.text\.other:
+
+0+ <forwdummylabel>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+[ ]+4:[ ]+6ff0fff0[ ]+nop
+
+0+8 <forwothertext>:
+[ ]+8:[ ]+6ff0fff0[ ]+nop
diff --git a/gas/testsuite/gas/sh/sh64/movi32-noexp-2.d b/gas/testsuite/gas/sh/sh64/movi32-noexp-2.d
new file mode 100644
index 0000000..2cab9fd
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/movi32-noexp-2.d
@@ -0,0 +1,28 @@
+#as: --isa=shmedia --abi=32 -no-expand
+#objdump: -dr
+#source: movi-2.s
+#name: MOVI non-expansion of local symbols with relocs, 32-bit ABI.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+0+ <start>:
+[ ]+0:[ ]+cc000210[ ]+movi 0,r33
+[ ]+0:[ ]+R_SH_IMMS16 \.text\+0x2d
+[ ]+4:[ ]+cc000360[ ]+movi 0,r54
+[ ]+4:[ ]+R_SH_IMMS16 \.data\+0x2c
+[ ]+8:[ ]+cc0000f0[ ]+movi 0,r15
+[ ]+8:[ ]+R_SH_IMMS16 \.text\.other\+0x35
+
+0+c <forw>:
+[ ]+c:[ ]+cc000190[ ]+movi 0,r25
+[ ]+c:[ ]+R_SH_IMMS16 \.data\.other\+0x38
+Disassembly of section \.text\.other:
+
+0+ <forwdummylabel>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+[ ]+4:[ ]+6ff0fff0[ ]+nop
+
+0+8 <forwothertext>:
+[ ]+8:[ ]+6ff0fff0[ ]+nop
diff --git a/gas/testsuite/gas/sh/sh64/movi64-1.d b/gas/testsuite/gas/sh/sh64/movi64-1.d
new file mode 100644
index 0000000..536b949
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/movi64-1.d
@@ -0,0 +1,44 @@
+#as: --isa=shmedia --abi=64
+#objdump: -dr
+#source: movi-1.s
+#name: MOVI expansion, 64-bit ABI, 32-bit subset.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+cc000030[ ]+movi 0,r3
+[ ]+0:[ ]+R_SH_IMM_HI16 externalsym\+0x7b
+[ ]+4:[ ]+c8000030[ ]+shori 0,r3
+[ ]+4:[ ]+R_SH_IMM_MEDHI16 externalsym\+0x7b
+[ ]+8:[ ]+c8000030[ ]+shori 0,r3
+[ ]+8:[ ]+R_SH_IMM_MEDLOW16 externalsym\+0x7b
+[ ]+c:[ ]+c8000030[ ]+shori 0,r3
+[ ]+c:[ ]+R_SH_IMM_LOW16 externalsym\+0x7b
+[ ]+10:[ ]+cc000030[ ]+movi 0,r3
+[ ]+14:[ ]+cbfffc30[ ]+shori 65535,r3
+[ ]+18:[ ]+cc000430[ ]+movi 1,r3
+[ ]+1c:[ ]+c8000030[ ]+shori 0,r3
+[ ]+20:[ ]+cc000030[ ]+movi 0,r3
+[ ]+24:[ ]+cbfffc30[ ]+shori 65535,r3
+[ ]+28:[ ]+c8000030[ ]+shori 0,r3
+[ ]+2c:[ ]+cdfffc30[ ]+movi 32767,r3
+[ ]+30:[ ]+cc000030[ ]+movi 0,r3
+[ ]+34:[ ]+ca000030[ ]+shori 32768,r3
+[ ]+38:[ ]+cdfffc30[ ]+movi 32767,r3
+[ ]+3c:[ ]+c8000030[ ]+shori 0,r3
+[ ]+40:[ ]+ce000030[ ]+movi -32768,r3
+[ ]+44:[ ]+cffffc30[ ]+movi -1,r3
+[ ]+48:[ ]+c9fffc30[ ]+shori 32767,r3
+[ ]+4c:[ ]+ce000030[ ]+movi -32768,r3
+[ ]+50:[ ]+c8000030[ ]+shori 0,r3
+[ ]+54:[ ]+cc000040[ ]+movi 0,r4
+[ ]+54:[ ]+R_SH_IMM_HI16 \.data\+0x49
+[ ]+58:[ ]+c8000040[ ]+shori 0,r4
+[ ]+58:[ ]+R_SH_IMM_MEDHI16 \.data\+0x49
+[ ]+5c:[ ]+c8000040[ ]+shori 0,r4
+[ ]+5c:[ ]+R_SH_IMM_MEDLOW16 \.data\+0x49
+[ ]+60:[ ]+c8000040[ ]+shori 0,r4
+[ ]+60:[ ]+R_SH_IMM_LOW16 \.data\+0x49
+[ ]+64:[ ]+cc001440[ ]+movi 5,r4
diff --git a/gas/testsuite/gas/sh/sh64/movi64-2.d b/gas/testsuite/gas/sh/sh64/movi64-2.d
new file mode 100644
index 0000000..c1b7e1d
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/movi64-2.d
@@ -0,0 +1,30 @@
+#as: --isa=shmedia --abi=64
+#objdump: -dr
+#name: MOVI expansion, 64-bit ABI, 64-bit subset.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+cc000430[ ]+movi 1,r3
+[ ]+4:[ ]+c8000030[ ]+shori 0,r3
+[ ]+8:[ ]+c8000030[ ]+shori 0,r3
+[ ]+c:[ ]+cffffc30[ ]+movi -1,r3
+[ ]+10:[ ]+c9fffc30[ ]+shori 32767,r3
+[ ]+14:[ ]+c8000030[ ]+shori 0,r3
+[ ]+18:[ ]+cc000030[ ]+movi 0,r3
+[ ]+1c:[ ]+ca000030[ ]+shori 32768,r3
+[ ]+20:[ ]+c8000030[ ]+shori 0,r3
+[ ]+24:[ ]+cdfffc30[ ]+movi 32767,r3
+[ ]+28:[ ]+c8000030[ ]+shori 0,r3
+[ ]+2c:[ ]+c8000030[ ]+shori 0,r3
+[ ]+30:[ ]+c8000030[ ]+shori 0,r3
+[ ]+34:[ ]+ce000030[ ]+movi -32768,r3
+[ ]+38:[ ]+c8000030[ ]+shori 0,r3
+[ ]+3c:[ ]+c8000030[ ]+shori 0,r3
+[ ]+40:[ ]+c8000030[ ]+shori 0,r3
+[ ]+44:[ ]+ce000030[ ]+movi -32768,r3
+[ ]+48:[ ]+c8000030[ ]+shori 0,r3
+[ ]+4c:[ ]+c8000030[ ]+shori 0,r3
+[ ]+50:[ ]+c8000030[ ]+shori 0,r3
diff --git a/gas/testsuite/gas/sh/sh64/movi64-2.s b/gas/testsuite/gas/sh/sh64/movi64-2.s
new file mode 100644
index 0000000..607e17f
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/movi64-2.s
@@ -0,0 +1,10 @@
+! Check MOVI expansion. This one for the 64-bit ABI only.
+ .text
+start:
+ movi 65536 << 16,r3
+ movi -32769 << 16,r3
+ movi 32768 << 16,r3
+ movi 32767 << 48,r3
+ movi 32768 << 48,r3 ! Perhaps a warning on this or the next,
+ movi -32768 << 48,r3 ! for being out of range?
+
diff --git a/gas/testsuite/gas/sh/sh64/movi64-3.d b/gas/testsuite/gas/sh/sh64/movi64-3.d
new file mode 100644
index 0000000..4ba6ac3
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/movi64-3.d
@@ -0,0 +1,52 @@
+#as: --isa=shmedia --abi=64
+#objdump: -dr
+#source: movi-2.s
+#name: MOVI expansion of local symbols with relocs, 64-bit ABI.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+0+ <start>:
+[ ]+0:[ ]+cc000210[ ]+movi 0,r33
+[ ]+0:[ ]+R_SH_IMM_HI16 \.text\+0x51
+[ ]+4:[ ]+c8000210[ ]+shori 0,r33
+[ ]+4:[ ]+R_SH_IMM_MEDHI16 \.text\+0x51
+[ ]+8:[ ]+c8000210[ ]+shori 0,r33
+[ ]+8:[ ]+R_SH_IMM_MEDLOW16 \.text\+0x51
+[ ]+c:[ ]+c8000210[ ]+shori 0,r33
+[ ]+c:[ ]+R_SH_IMM_LOW16 \.text\+0x51
+[ ]+10:[ ]+cc000360[ ]+movi 0,r54
+[ ]+10:[ ]+R_SH_IMM_HI16 \.data\+0x2c
+[ ]+14:[ ]+c8000360[ ]+shori 0,r54
+[ ]+14:[ ]+R_SH_IMM_MEDHI16 \.data\+0x2c
+[ ]+18:[ ]+c8000360[ ]+shori 0,r54
+[ ]+18:[ ]+R_SH_IMM_MEDLOW16 \.data\+0x2c
+[ ]+1c:[ ]+c8000360[ ]+shori 0,r54
+[ ]+1c:[ ]+R_SH_IMM_LOW16 \.data\+0x2c
+[ ]+20:[ ]+cc0000f0[ ]+movi 0,r15
+[ ]+20:[ ]+R_SH_IMM_HI16 \.text\.other\+0x35
+[ ]+24:[ ]+c80000f0[ ]+shori 0,r15
+[ ]+24:[ ]+R_SH_IMM_MEDHI16 \.text\.other\+0x35
+[ ]+28:[ ]+c80000f0[ ]+shori 0,r15
+[ ]+28:[ ]+R_SH_IMM_MEDLOW16 \.text\.other\+0x35
+[ ]+2c:[ ]+c80000f0[ ]+shori 0,r15
+[ ]+2c:[ ]+R_SH_IMM_LOW16 \.text\.other\+0x35
+
+0+30 <forw>:
+[ ]+30:[ ]+cc000190[ ]+movi 0,r25
+[ ]+30:[ ]+R_SH_IMM_HI16 \.data\.other\+0x38
+[ ]+34:[ ]+c8000190[ ]+shori 0,r25
+[ ]+34:[ ]+R_SH_IMM_MEDHI16 \.data\.other\+0x38
+[ ]+38:[ ]+c8000190[ ]+shori 0,r25
+[ ]+38:[ ]+R_SH_IMM_MEDLOW16 \.data\.other\+0x38
+[ ]+3c:[ ]+c8000190[ ]+shori 0,r25
+[ ]+3c:[ ]+R_SH_IMM_LOW16 \.data\.other\+0x38
+Disassembly of section \.text\.other:
+
+0+ <forwdummylabel>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+[ ]+4:[ ]+6ff0fff0[ ]+nop
+
+0+8 <forwothertext>:
+[ ]+8:[ ]+6ff0fff0[ ]+nop
diff --git a/gas/testsuite/gas/sh/sh64/movi64-noexp-2.d b/gas/testsuite/gas/sh/sh64/movi64-noexp-2.d
new file mode 100644
index 0000000..13a26f1
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/movi64-noexp-2.d
@@ -0,0 +1,28 @@
+#as: --isa=shmedia --abi=64 -no-expand
+#objdump: -dr
+#source: movi-2.s
+#name: MOVI non-expansion of local symbols with relocs, 64-bit ABI.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+0+ <start>:
+[ ]+0:[ ]+cc000210[ ]+movi 0,r33
+[ ]+0:[ ]+R_SH_IMMS16 \.text\+0x2d
+[ ]+4:[ ]+cc000360[ ]+movi 0,r54
+[ ]+4:[ ]+R_SH_IMMS16 \.data\+0x2c
+[ ]+8:[ ]+cc0000f0[ ]+movi 0,r15
+[ ]+8:[ ]+R_SH_IMMS16 \.text\.other\+0x35
+
+0+c <forw>:
+[ ]+c:[ ]+cc000190[ ]+movi 0,r25
+[ ]+c:[ ]+R_SH_IMMS16 \.data\.other\+0x38
+Disassembly of section \.text\.other:
+
+0+ <forwdummylabel>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+[ ]+4:[ ]+6ff0fff0[ ]+nop
+
+0+8 <forwothertext>:
+[ ]+8:[ ]+6ff0fff0[ ]+nop
diff --git a/gas/testsuite/gas/sh/sh64/pt-1.d b/gas/testsuite/gas/sh/sh64/pt-1.d
new file mode 100644
index 0000000..96d83d3
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/pt-1.d
@@ -0,0 +1,26 @@
+#as: --isa=shmedia
+#objdump: -dr
+#name: Basic SHmedia PT and PTA instructions.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+[0]+ <start>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+
+[0]+4 <start1>:
+[ ]+4:[ ]+6ff0fff0[ ]+nop
+
+[0]+8 <start4>:
+[ ]+8:[ ]+ebfffe50[ ]+pta/l 4 <start1>,tr5
+[ ]+c:[ ]+6ff0fff0[ ]+nop
+[ ]+10:[ ]+e8000a70[ ]+pta/l 18 <start2>,tr7
+[ ]+14:[ ]+6ff0fff0[ ]+nop
+
+[0]+18 <start2>:
+[ ]+18:[ ]+e8000a40[ ]+pta/l 20 <start3>,tr4
+[ ]+1c:[ ]+6ff0fff0[ ]+nop
+
+[0]+20 <start3>:
+[ ]+20:[ ]+ebffea30[ ]+pta/l 8 <start4>,tr3
+[ ]+24:[ ]+6ff0fff0[ ]+nop
diff --git a/gas/testsuite/gas/sh/sh64/pt-1.s b/gas/testsuite/gas/sh/sh64/pt-1.s
new file mode 100644
index 0000000..cf5cd70
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/pt-1.s
@@ -0,0 +1,17 @@
+! Check simple use of PT/PTA.
+ .text
+start:
+ nop
+start1:
+ nop
+start4:
+ pt start1,tr5
+ nop
+ pt start2,tr7
+ nop
+start2:
+ pta start3,tr4
+ nop
+start3:
+ pta start4,tr3
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/pt-2.s b/gas/testsuite/gas/sh/sh64/pt-2.s
new file mode 100644
index 0000000..b9b6597
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/pt-2.s
@@ -0,0 +1,22 @@
+! Check inter-segment pt and pta
+ .text
+start:
+ nop
+start1:
+ nop
+start4:
+ pt start1,tr5
+ nop
+
+ pt start2,tr7
+ nop
+
+ .section .text.other,"ax"
+dummylabel: ! Needed to hang a marker that this is SHmedia.
+ nop
+start2:
+ pta start3,tr4
+ nop
+start3:
+ pta start4,tr3
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/pt-noexp-1.d b/gas/testsuite/gas/sh/sh64/pt-noexp-1.d
new file mode 100644
index 0000000..17db665
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/pt-noexp-1.d
@@ -0,0 +1,27 @@
+#as: --isa=shmedia -no-expand
+#objdump: -dr
+#source: pt-1.s
+#name: Basic SHmedia PT and PTA instructions with -no-expand.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+[0]+ <start>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+
+[0]+4 <start1>:
+[ ]+4:[ ]+6ff0fff0[ ]+nop
+
+[0]+8 <start4>:
+[ ]+8:[ ]+ebfffe50[ ]+pta/l 4 <start1>,tr5
+[ ]+c:[ ]+6ff0fff0[ ]+nop
+[ ]+10:[ ]+e8000a70[ ]+pta/l 18 <start2>,tr7
+[ ]+14:[ ]+6ff0fff0[ ]+nop
+
+[0]+18 <start2>:
+[ ]+18:[ ]+e8000a40[ ]+pta/l 20 <start3>,tr4
+[ ]+1c:[ ]+6ff0fff0[ ]+nop
+
+[0]+20 <start3>:
+[ ]+20:[ ]+ebffea30[ ]+pta/l 8 <start4>,tr3
+[ ]+24:[ ]+6ff0fff0[ ]+nop
diff --git a/gas/testsuite/gas/sh/sh64/pt32-1.d b/gas/testsuite/gas/sh/sh64/pt32-1.d
new file mode 100644
index 0000000..faa5123
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/pt32-1.d
@@ -0,0 +1,39 @@
+#as: --isa=shmedia -abi=32
+#objdump: -dr
+#source: pt-2.s
+#name: Inter-segment PT, 32-bit.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+0+ <start>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+
+0+4 <start1>:
+[ ]+4:[ ]+6ff0fff0[ ]+nop
+
+0+8 <start4>:
+[ ]+8:[ ]+ebfffe50[ ]+pta/l 4 <start1>,tr5
+[ ]+c:[ ]+6ff0fff0[ ]+nop
+[ ]+10:[ ]+cc000190[ ]+movi 0,r25
+[ ]+10:[ ]+R_SH_IMM_MEDLOW16_PCREL \.text\.other\+0xf*fffffffd
+[ ]+14:[ ]+c8000190[ ]+shori 0,r25
+[ ]+14:[ ]+R_SH_IMM_LOW16_PCREL \.text\.other\+0x1
+[ ]+18:[ ]+6bf56670[ ]+ptrel/l r25,tr7
+[ ]+1c:[ ]+6ff0fff0[ ]+nop
+Disassembly of section \.text\.other:
+
+0+ <dummylabel>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+
+0+4 <start2>:
+[ ]+4:[ ]+e8000a40[ ]+pta/l c <start3>,tr4
+[ ]+8:[ ]+6ff0fff0[ ]+nop
+
+0+c <start3>:
+[ ]+c:[ ]+cc000190[ ]+movi 0,r25
+[ ]+c:[ ]+R_SH_IMM_MEDLOW16_PCREL \.text\+0x1
+[ ]+10:[ ]+c8000190[ ]+shori 0,r25
+[ ]+10:[ ]+R_SH_IMM_LOW16_PCREL \.text\+0x5
+[ ]+14:[ ]+6bf56630[ ]+ptrel/l r25,tr3
+[ ]+18:[ ]+6ff0fff0[ ]+nop
diff --git a/gas/testsuite/gas/sh/sh64/pt32-noexp-2.d b/gas/testsuite/gas/sh/sh64/pt32-noexp-2.d
new file mode 100644
index 0000000..201e467
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/pt32-noexp-2.d
@@ -0,0 +1,34 @@
+#as: --isa=shmedia -abi=32 -no-expand
+#objdump: -dr
+#source: pt-2.s
+#name: Inter-segment PT, 32-bit with -no-expand.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+0+ <start>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+
+0+4 <start1>:
+[ ]+4:[ ]+6ff0fff0[ ]+nop
+
+0+8 <start4>:
+[ ]+8:[ ]+ebfffe50[ ]+pta/l 4 <start1>,tr5
+[ ]+c:[ ]+6ff0fff0[ ]+nop
+[ ]+10:[ ]+e8000270[ ]+pta/l 10 <start4\+0x8>,tr7
+[ ]+10:[ ]+R_SH_PT_16 \.text\.other\+0x5
+[ ]+14:[ ]+6ff0fff0[ ]+nop
+
+Disassembly of section \.text\.other:
+
+0+ <dummylabel>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+
+0+4 <start2>:
+[ ]+4:[ ]+e8000a40[ ]+pta/l c <start3>,tr4
+[ ]+8:[ ]+6ff0fff0[ ]+nop
+
+0+c <start3>:
+[ ]+c:[ ]+e8000630[ ]+pta/l 10 <start3\+0x4>,tr3
+[ ]+c:[ ]R_SH_PT_16 \.text\+0x9
+[ ]+10:[ ]+6ff0fff0[ ]+nop
diff --git a/gas/testsuite/gas/sh/sh64/pt64-1.d b/gas/testsuite/gas/sh/sh64/pt64-1.d
new file mode 100644
index 0000000..4cbc7cd
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/pt64-1.d
@@ -0,0 +1,47 @@
+#as: --isa=shmedia -abi=64
+#objdump: -dr
+#source: pt-2.s
+#name: Inter-segment PT, 64-bit.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+0+ <start>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+
+0+4 <start1>:
+[ ]+4:[ ]+6ff0fff0[ ]+nop
+
+0+8 <start4>:
+[ ]+8:[ ]+ebfffe50[ ]+pta/l 4 <start1>,tr5
+[ ]+c:[ ]+6ff0fff0[ ]+nop
+[ ]+10:[ ]+cc000190[ ]+movi 0,r25
+[ ]+10:[ ]+R_SH_IMM_HI16_PCREL \.text\.other\+0xfffffffffffffff5
+[ ]+14:[ ]+c8000190[ ]+shori 0,r25
+[ ]+14:[ ]+R_SH_IMM_MEDHI16_PCREL \.text\.other\+0xfffffffffffffff9
+[ ]+18:[ ]+c8000190[ ]+shori 0,r25
+[ ]+18:[ ]+R_SH_IMM_MEDLOW16_PCREL \.text\.other\+0xfffffffffffffffd
+[ ]+1c:[ ]+c8000190[ ]+shori 0,r25
+[ ]+1c:[ ]+R_SH_IMM_LOW16_PCREL \.text\.other\+0x1
+[ ]+20:[ ]+6bf56670[ ]+ptrel/l r25,tr7
+[ ]+24:[ ]+6ff0fff0[ ]+nop
+Disassembly of section \.text\.other:
+
+0+ <dummylabel>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+
+0+4 <start2>:
+[ ]+4:[ ]+e8000a40[ ]+pta/l c <start3>,tr4
+[ ]+8:[ ]+6ff0fff0[ ]+nop
+
+0+c <start3>:
+[ ]+c:[ ]+cc000190[ ]+movi 0,r25
+[ ]+c:[ ]+R_SH_IMM_HI16_PCREL \.text\+0xfffffffffffffff9
+[ ]+10:[ ]+c8000190[ ]+shori 0,r25
+[ ]+10:[ ]+R_SH_IMM_MEDHI16_PCREL \.text\+0xfffffffffffffffd
+[ ]+14:[ ]+c8000190[ ]+shori 0,r25
+[ ]+14:[ ]+R_SH_IMM_MEDLOW16_PCREL \.text\+0x1
+[ ]+18:[ ]+c8000190[ ]+shori 0,r25
+[ ]+18:[ ]+R_SH_IMM_LOW16_PCREL \.text\+0x5
+[ ]+1c:[ ]+6bf56630[ ]+ptrel/l r25,tr3
+[ ]+20:[ ]+6ff0fff0[ ]+nop
diff --git a/gas/testsuite/gas/sh/sh64/pt64-32-1.d b/gas/testsuite/gas/sh/sh64/pt64-32-1.d
new file mode 100644
index 0000000..13ff816
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/pt64-32-1.d
@@ -0,0 +1,27 @@
+#as: --isa=shmedia -expand-pt32
+#objdump: -dr
+#source: pt-1.s
+#name: Basic SHmedia PT and PTA instructions with -expand-pt32.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+[0]+ <start>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+
+[0]+4 <start1>:
+[ ]+4:[ ]+6ff0fff0[ ]+nop
+
+[0]+8 <start4>:
+[ ]+8:[ ]+ebfffe50[ ]+pta/l 4 <start1>,tr5
+[ ]+c:[ ]+6ff0fff0[ ]+nop
+[ ]+10:[ ]+e8000a70[ ]+pta/l 18 <start2>,tr7
+[ ]+14:[ ]+6ff0fff0[ ]+nop
+
+[0]+18 <start2>:
+[ ]+18:[ ]+e8000a40[ ]+pta/l 20 <start3>,tr4
+[ ]+1c:[ ]+6ff0fff0[ ]+nop
+
+[0]+20 <start3>:
+[ ]+20:[ ]+ebffea30[ ]+pta/l 8 <start4>,tr3
+[ ]+24:[ ]+6ff0fff0[ ]+nop
diff --git a/gas/testsuite/gas/sh/sh64/pt64-32-2.d b/gas/testsuite/gas/sh/sh64/pt64-32-2.d
new file mode 100644
index 0000000..727dd2a
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/pt64-32-2.d
@@ -0,0 +1,39 @@
+#as: --isa=shmedia -abi=64 -expand-pt32
+#objdump: -dr
+#source: pt-2.s
+#name: Inter-segment PT, 64-bit with -expand-pt32.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+0+ <start>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+
+0+4 <start1>:
+[ ]+4:[ ]+6ff0fff0[ ]+nop
+
+0+8 <start4>:
+[ ]+8:[ ]+ebfffe50[ ]+pta/l 4 <start1>,tr5
+[ ]+c:[ ]+6ff0fff0[ ]+nop
+[ ]+10:[ ]+cc000190[ ]+movi 0,r25
+[ ]+10:[ ]+R_SH_IMM_MEDLOW16_PCREL \.text\.other\+0xfffffffffffffffd
+[ ]+14:[ ]+c8000190[ ]+shori 0,r25
+[ ]+14:[ ]+R_SH_IMM_LOW16_PCREL \.text\.other\+0x1
+[ ]+18:[ ]+6bf56670[ ]+ptrel/l r25,tr7
+[ ]+1c:[ ]+6ff0fff0[ ]+nop
+Disassembly of section \.text\.other:
+
+0+ <dummylabel>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+
+0+4 <start2>:
+[ ]+4:[ ]+e8000a40[ ]+pta/l c <start3>,tr4
+[ ]+8:[ ]+6ff0fff0[ ]+nop
+
+0+c <start3>:
+[ ]+c:[ ]+cc000190[ ]+movi 0,r25
+[ ]+c:[ ]+R_SH_IMM_MEDLOW16_PCREL \.text\+0x1
+[ ]+10:[ ]+c8000190[ ]+shori 0,r25
+[ ]+10:[ ]+R_SH_IMM_LOW16_PCREL \.text\+0x5
+[ ]+14:[ ]+6bf56630[ ]+ptrel/l r25,tr3
+[ ]+18:[ ]+6ff0fff0[ ]+nop
diff --git a/gas/testsuite/gas/sh/sh64/pt64-noexp-2.d b/gas/testsuite/gas/sh/sh64/pt64-noexp-2.d
new file mode 100644
index 0000000..5ed5ef2
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/pt64-noexp-2.d
@@ -0,0 +1,34 @@
+#as: --isa=shmedia -abi=64 -no-expand
+#objdump: -dr
+#source: pt-2.s
+#name: Inter-segment PT, 64-bit with -no-expand.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+0+ <start>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+
+0+4 <start1>:
+[ ]+4:[ ]+6ff0fff0[ ]+nop
+
+0+8 <start4>:
+[ ]+8:[ ]+ebfffe50[ ]+pta/l 4 <start1>,tr5
+[ ]+c:[ ]+6ff0fff0[ ]+nop
+[ ]+10:[ ]+e8000270[ ]+pta/l 10 <start4\+0x8>,tr7
+[ ]+10:[ ]+R_SH_PT_16 \.text\.other\+0x5
+[ ]+14:[ ]+6ff0fff0[ ]+nop
+
+Disassembly of section \.text\.other:
+
+0+ <dummylabel>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+
+0+4 <start2>:
+[ ]+4:[ ]+e8000a40[ ]+pta/l c <start3>,tr4
+[ ]+8:[ ]+6ff0fff0[ ]+nop
+
+0+c <start3>:
+[ ]+c:[ ]+e8000630[ ]+pta/l 10 <start3\+0x4>,tr3
+[ ]+c:[ ]R_SH_PT_16 \.text\+0x9
+[ ]+10:[ ]+6ff0fff0[ ]+nop
diff --git a/gas/testsuite/gas/sh/sh64/ptc-1.s b/gas/testsuite/gas/sh/sh64/ptc-1.s
new file mode 100644
index 0000000..d6199fd
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/ptc-1.s
@@ -0,0 +1,5 @@
+! Check that simple constants get expected results.
+ .mode SHmedia
+ .text
+start:
+ pta 0x100, tr1
diff --git a/gas/testsuite/gas/sh/sh64/ptc32-1.d b/gas/testsuite/gas/sh/sh64/ptc32-1.d
new file mode 100644
index 0000000..481a504
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/ptc32-1.d
@@ -0,0 +1,15 @@
+#as: --abi=32
+#objdump: -dr
+#source: ptc-1.s
+#name: PT constant, 32-bit ABI.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+cc000190[ ]+movi 0,r25
+[ ]+0:[ ]+R_SH_IMM_MEDLOW16_PCREL \*ABS\*\+0xf8
+[ ]+4:[ ]+c8000190[ ]+shori 0,r25
+[ ]+4:[ ]+R_SH_IMM_LOW16_PCREL \*ABS\*\+0xfc
+[ ]+8:[ ]+6bf56610[ ]+ptrel/l r25,tr1
diff --git a/gas/testsuite/gas/sh/sh64/ptc32-noexp-1.d b/gas/testsuite/gas/sh/sh64/ptc32-noexp-1.d
new file mode 100644
index 0000000..8e18c9c
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/ptc32-noexp-1.d
@@ -0,0 +1,12 @@
+#as: --abi=32 -no-expand
+#objdump: -dr
+#source: ptc-1.s
+#name: PT constant, 32-bit ABI with -no-expand.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+e8000610[ ]+pta/l 4 <\*ABS\*\+0x4>,tr1
+[ ]+0:[ ]+R_SH_PT_16 \*ABS\*\+0x100
diff --git a/gas/testsuite/gas/sh/sh64/ptc64-1.d b/gas/testsuite/gas/sh/sh64/ptc64-1.d
new file mode 100644
index 0000000..06ff3de
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/ptc64-1.d
@@ -0,0 +1,19 @@
+#as: --abi=64
+#objdump: -dr
+#source: ptc-1.s
+#name: PT constant, 64-bit ABI.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+0+ <start>:
+[ ]+0:[ ]+cc000190[ ]+movi 0,r25
+[ ]+0:[ ]+R_SH_IMM_HI16_PCREL \*ABS\*\+0xf0
+[ ]+4:[ ]+c8000190[ ]+shori 0,r25
+[ ]+4:[ ]+R_SH_IMM_MEDHI16_PCREL \*ABS\*\+0xf4
+[ ]+8:[ ]+c8000190[ ]+shori 0,r25
+[ ]+8:[ ]+R_SH_IMM_MEDLOW16_PCREL \*ABS\*\+0xf8
+[ ]+c:[ ]+c8000190[ ]+shori 0,r25
+[ ]+c:[ ]+R_SH_IMM_LOW16_PCREL \*ABS\*\+0xfc
+[ ]+10:[ ]+6bf56610[ ]+ptrel/l r25,tr1
diff --git a/gas/testsuite/gas/sh/sh64/ptc64-32-1.d b/gas/testsuite/gas/sh/sh64/ptc64-32-1.d
new file mode 100644
index 0000000..a11e89c
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/ptc64-32-1.d
@@ -0,0 +1,15 @@
+#as: --abi=64 -expand-pt32
+#objdump: -dr
+#source: ptc-1.s
+#name: PT constant, 64-bit ABI with -expand-pt32.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+cc000190[ ]+movi 0,r25
+[ ]+0:[ ]+R_SH_IMM_MEDLOW16_PCREL \*ABS\*\+0xf8
+[ ]+4:[ ]+c8000190[ ]+shori 0,r25
+[ ]+4:[ ]+R_SH_IMM_LOW16_PCREL \*ABS\*\+0xfc
+[ ]+8:[ ]+6bf56610[ ]+ptrel/l r25,tr1
diff --git a/gas/testsuite/gas/sh/sh64/ptc64-noexp-1.d b/gas/testsuite/gas/sh/sh64/ptc64-noexp-1.d
new file mode 100644
index 0000000..aa8a186
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/ptc64-noexp-1.d
@@ -0,0 +1,13 @@
+#as: --abi=64 -no-expand
+#objdump: -dr
+#source: ptc-1.s
+#name: PT constant, 64-bit ABI with -no-expand.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+e8000610[ ]+pta/l 4 <\*ABS\*\+0x4>,tr1
+[ ]+0:[ ]+R_SH_PT_16 \*ABS\*\+0x100
+
diff --git a/gas/testsuite/gas/sh/sh64/ptext-1.s b/gas/testsuite/gas/sh/sh64/ptext-1.s
new file mode 100644
index 0000000..794d0f5
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/ptext-1.s
@@ -0,0 +1,8 @@
+! PT, PTA, PTB expansion for external symbols.
+start:
+ pt externalsym1 + 40,tr5
+ pta externalsym2 + 44,tr4
+ ptb externalsym3 + 48,tr3
+ pt/u externalsym4 + 52,tr5
+ pta/u externalsym5 + 56,tr4
+ ptb/u externalsym6 + 60,tr3
diff --git a/gas/testsuite/gas/sh/sh64/ptext32-1.d b/gas/testsuite/gas/sh/sh64/ptext32-1.d
new file mode 100644
index 0000000..84adf6a
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/ptext32-1.d
@@ -0,0 +1,40 @@
+#as: --isa=shmedia --abi=32
+#source: ptext-1.s
+#objdump: -dr
+#name: PT, PTA, PTB expansion for external symbols, 32-bit ABI.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+cc000190[ ]+movi 0,r25
+[ ]+0:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym1\+0x20
+[ ]+4:[ ]+c8000190[ ]+shori 0,r25
+[ ]+4:[ ]+R_SH_IMM_LOW16_PCREL externalsym1\+0x24
+[ ]+8:[ ]+6bf56650[ ]+ptrel/l r25,tr5
+[ ]+c:[ ]+cc000190[ ]+movi 0,r25
+[ ]+c:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym2\+0x24
+[ ]+10:[ ]+c8000190[ ]+shori 0,r25
+[ ]+10:[ ]+R_SH_IMM_LOW16_PCREL externalsym2\+0x28
+[ ]+14:[ ]+6bf56640[ ]+ptrel/l r25,tr4
+[ ]+18:[ ]+cc000190[ ]+movi 0,r25
+[ ]+18:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym3\+0x28
+[ ]+1c:[ ]+c8000190[ ]+shori 0,r25
+[ ]+1c:[ ]+R_SH_IMM_LOW16_PCREL externalsym3\+0x2c
+[ ]+20:[ ]+6bf56630[ ]+ptrel/l r25,tr3
+[ ]+24:[ ]+cc000190[ ]+movi 0,r25
+[ ]+24:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym4\+0x2c
+[ ]+28:[ ]+c8000190[ ]+shori 0,r25
+[ ]+28:[ ]+R_SH_IMM_LOW16_PCREL externalsym4\+0x30
+[ ]+2c:[ ]+6bf56450[ ]+ptrel/u r25,tr5
+[ ]+30:[ ]+cc000190[ ]+movi 0,r25
+[ ]+30:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym5\+0x30
+[ ]+34:[ ]+c8000190[ ]+shori 0,r25
+[ ]+34:[ ]+R_SH_IMM_LOW16_PCREL externalsym5\+0x34
+[ ]+38:[ ]+6bf56440[ ]+ptrel/u r25,tr4
+[ ]+3c:[ ]+cc000190[ ]+movi 0,r25
+[ ]+3c:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym6\+0x34
+[ ]+40:[ ]+c8000190[ ]+shori 0,r25
+[ ]+40:[ ]+R_SH_IMM_LOW16_PCREL externalsym6\+0x38
+[ ]+44:[ ]+6bf56430[ ]+ptrel/u r25,tr3
diff --git a/gas/testsuite/gas/sh/sh64/ptext32-noexp-1.d b/gas/testsuite/gas/sh/sh64/ptext32-noexp-1.d
new file mode 100644
index 0000000..be41d1c
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/ptext32-noexp-1.d
@@ -0,0 +1,22 @@
+#as: --isa=shmedia --abi=32 -no-expand
+#source: ptext-1.s
+#objdump: -dr
+#name: PT, PTA, PTB non-expansion for external symbols, 32-bit ABI.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+e8000250[ ]+pta/l 0 <start>,tr5
+[ ]+0:[ ]+R_SH_PT_16 externalsym1\+0x28
+[ ]+4:[ ]+e8000640[ ]+pta/l 8 <start\+0x8>,tr4
+[ ]+4:[ ]+R_SH_PT_16 externalsym2\+0x2c
+[ ]+8:[ ]+ec000630[ ]+ptb/l c <start\+0xc>,tr3
+[ ]+8:[ ]+R_SH_PT_16 externalsym3\+0x30
+[ ]+c:[ ]+e8000050[ ]+pta/u c <start\+0xc>,tr5
+[ ]+c:[ ]+R_SH_PT_16 externalsym4\+0x34
+[ ]+10:[ ]+e8000440[ ]+pta/u 14 <start\+0x14>,tr4
+[ ]+10:[ ]+R_SH_PT_16 externalsym5\+0x38
+[ ]+14:[ ]+ec000430[ ]+ptb/u 18 <start\+0x18>,tr3
+[ ]+14:[ ]+R_SH_PT_16 externalsym6\+0x3c
diff --git a/gas/testsuite/gas/sh/sh64/ptext64-1.d b/gas/testsuite/gas/sh/sh64/ptext64-1.d
new file mode 100644
index 0000000..eeb062e
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/ptext64-1.d
@@ -0,0 +1,64 @@
+#as: --isa=shmedia --abi=64
+#source: ptext-1.s
+#objdump: -dr
+#name: PT, PTA, PTB expansion for external symbols, 64-bit ABI.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+cc000190[ ]+movi 0,r25
+[ ]+0:[ ]+R_SH_IMM_HI16_PCREL externalsym1\+0x18
+[ ]+4:[ ]+c8000190[ ]+shori 0,r25
+[ ]+4:[ ]+R_SH_IMM_MEDHI16_PCREL externalsym1\+0x1c
+[ ]+8:[ ]+c8000190[ ]+shori 0,r25
+[ ]+8:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym1\+0x20
+[ ]+c:[ ]+c8000190[ ]+shori 0,r25
+[ ]+c:[ ]+R_SH_IMM_LOW16_PCREL externalsym1\+0x24
+[ ]+10:[ ]+6bf56650[ ]+ptrel/l r25,tr5
+[ ]+14:[ ]+cc000190[ ]+movi 0,r25
+[ ]+14:[ ]+R_SH_IMM_HI16_PCREL externalsym2\+0x1c
+[ ]+18:[ ]+c8000190[ ]+shori 0,r25
+[ ]+18:[ ]+R_SH_IMM_MEDHI16_PCREL externalsym2\+0x20
+[ ]+1c:[ ]+c8000190[ ]+shori 0,r25
+[ ]+1c:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym2\+0x24
+[ ]+20:[ ]+c8000190[ ]+shori 0,r25
+[ ]+20:[ ]+R_SH_IMM_LOW16_PCREL externalsym2\+0x28
+[ ]+24:[ ]+6bf56640[ ]+ptrel/l r25,tr4
+[ ]+28:[ ]+cc000190[ ]+movi 0,r25
+[ ]+28:[ ]+R_SH_IMM_HI16_PCREL externalsym3\+0x20
+[ ]+2c:[ ]+c8000190[ ]+shori 0,r25
+[ ]+2c:[ ]+R_SH_IMM_MEDHI16_PCREL externalsym3\+0x24
+[ ]+30:[ ]+c8000190[ ]+shori 0,r25
+[ ]+30:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym3\+0x28
+[ ]+34:[ ]+c8000190[ ]+shori 0,r25
+[ ]+34:[ ]+R_SH_IMM_LOW16_PCREL externalsym3\+0x2c
+[ ]+38:[ ]+6bf56630[ ]+ptrel/l r25,tr3
+[ ]+3c:[ ]+cc000190[ ]+movi 0,r25
+[ ]+3c:[ ]+R_SH_IMM_HI16_PCREL externalsym4\+0x24
+[ ]+40:[ ]+c8000190[ ]+shori 0,r25
+[ ]+40:[ ]+R_SH_IMM_MEDHI16_PCREL externalsym4\+0x28
+[ ]+44:[ ]+c8000190[ ]+shori 0,r25
+[ ]+44:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym4\+0x2c
+[ ]+48:[ ]+c8000190[ ]+shori 0,r25
+[ ]+48:[ ]+R_SH_IMM_LOW16_PCREL externalsym4\+0x30
+[ ]+4c:[ ]+6bf56450[ ]+ptrel/u r25,tr5
+[ ]+50:[ ]+cc000190[ ]+movi 0,r25
+[ ]+50:[ ]+R_SH_IMM_HI16_PCREL externalsym5\+0x28
+[ ]+54:[ ]+c8000190[ ]+shori 0,r25
+[ ]+54:[ ]+R_SH_IMM_MEDHI16_PCREL externalsym5\+0x2c
+[ ]+58:[ ]+c8000190[ ]+shori 0,r25
+[ ]+58:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym5\+0x30
+[ ]+5c:[ ]+c8000190[ ]+shori 0,r25
+[ ]+5c:[ ]+R_SH_IMM_LOW16_PCREL externalsym5\+0x34
+[ ]+60:[ ]+6bf56440[ ]+ptrel/u r25,tr4
+[ ]+64:[ ]+cc000190[ ]+movi 0,r25
+[ ]+64:[ ]+R_SH_IMM_HI16_PCREL externalsym6\+0x2c
+[ ]+68:[ ]+c8000190[ ]+shori 0,r25
+[ ]+68:[ ]+R_SH_IMM_MEDHI16_PCREL externalsym6\+0x30
+[ ]+6c:[ ]+c8000190[ ]+shori 0,r25
+[ ]+6c:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym6\+0x34
+[ ]+70:[ ]+c8000190[ ]+shori 0,r25
+[ ]+70:[ ]+R_SH_IMM_LOW16_PCREL externalsym6\+0x38
+[ ]+74:[ ]+6bf56430[ ]+ptrel/u r25,tr3
diff --git a/gas/testsuite/gas/sh/sh64/ptext64-32-1.d b/gas/testsuite/gas/sh/sh64/ptext64-32-1.d
new file mode 100644
index 0000000..3644528
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/ptext64-32-1.d
@@ -0,0 +1,40 @@
+#as: --isa=shmedia --abi=64 -expand-pt32
+#source: ptext-1.s
+#objdump: -dr
+#name: PT, PTA, PTB expansion for external symbols, 64-bit ABI with -expand-pt32.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+cc000190[ ]+movi 0,r25
+[ ]+0:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym1\+0x20
+[ ]+4:[ ]+c8000190[ ]+shori 0,r25
+[ ]+4:[ ]+R_SH_IMM_LOW16_PCREL externalsym1\+0x24
+[ ]+8:[ ]+6bf56650[ ]+ptrel/l r25,tr5
+[ ]+c:[ ]+cc000190[ ]+movi 0,r25
+[ ]+c:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym2\+0x24
+[ ]+10:[ ]+c8000190[ ]+shori 0,r25
+[ ]+10:[ ]+R_SH_IMM_LOW16_PCREL externalsym2\+0x28
+[ ]+14:[ ]+6bf56640[ ]+ptrel/l r25,tr4
+[ ]+18:[ ]+cc000190[ ]+movi 0,r25
+[ ]+18:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym3\+0x28
+[ ]+1c:[ ]+c8000190[ ]+shori 0,r25
+[ ]+1c:[ ]+R_SH_IMM_LOW16_PCREL externalsym3\+0x2c
+[ ]+20:[ ]+6bf56630[ ]+ptrel/l r25,tr3
+[ ]+24:[ ]+cc000190[ ]+movi 0,r25
+[ ]+24:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym4\+0x2c
+[ ]+28:[ ]+c8000190[ ]+shori 0,r25
+[ ]+28:[ ]+R_SH_IMM_LOW16_PCREL externalsym4\+0x30
+[ ]+2c:[ ]+6bf56450[ ]+ptrel/u r25,tr5
+[ ]+30:[ ]+cc000190[ ]+movi 0,r25
+[ ]+30:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym5\+0x30
+[ ]+34:[ ]+c8000190[ ]+shori 0,r25
+[ ]+34:[ ]+R_SH_IMM_LOW16_PCREL externalsym5\+0x34
+[ ]+38:[ ]+6bf56440[ ]+ptrel/u r25,tr4
+[ ]+3c:[ ]+cc000190[ ]+movi 0,r25
+[ ]+3c:[ ]+R_SH_IMM_MEDLOW16_PCREL externalsym6\+0x34
+[ ]+40:[ ]+c8000190[ ]+shori 0,r25
+[ ]+40:[ ]+R_SH_IMM_LOW16_PCREL externalsym6\+0x38
+[ ]+44:[ ]+6bf56430[ ]+ptrel/u r25,tr3
diff --git a/gas/testsuite/gas/sh/sh64/ptext64-noexp-1.d b/gas/testsuite/gas/sh/sh64/ptext64-noexp-1.d
new file mode 100644
index 0000000..79f1419
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/ptext64-noexp-1.d
@@ -0,0 +1,22 @@
+#as: --isa=shmedia --abi=64 -no-expand
+#source: ptext-1.s
+#objdump: -dr
+#name: PT, PTA, PTB non-expansion for external symbols, 64-bit ABI.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+e8000250[ ]+pta/l 0 <start>,tr5
+[ ]+0:[ ]+R_SH_PT_16 externalsym1\+0x28
+[ ]+4:[ ]+e8000640[ ]+pta/l 8 <start\+0x8>,tr4
+[ ]+4:[ ]+R_SH_PT_16 externalsym2\+0x2c
+[ ]+8:[ ]+ec000630[ ]+ptb/l c <start\+0xc>,tr3
+[ ]+8:[ ]+R_SH_PT_16 externalsym3\+0x30
+[ ]+c:[ ]+e8000050[ ]+pta/u c <start\+0xc>,tr5
+[ ]+c:[ ]+R_SH_PT_16 externalsym4\+0x34
+[ ]+10:[ ]+e8000440[ ]+pta/u 14 <start\+0x14>,tr4
+[ ]+10:[ ]+R_SH_PT_16 externalsym5\+0x38
+[ ]+14:[ ]+ec000430[ ]+ptb/u 18 <start\+0x18>,tr3
+[ ]+14:[ ]+R_SH_PT_16 externalsym6\+0x3c
diff --git a/gas/testsuite/gas/sh/sh64/rel-1.s b/gas/testsuite/gas/sh/sh64/rel-1.s
new file mode 100644
index 0000000..c402ecd
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/rel-1.s
@@ -0,0 +1,137 @@
+! Test pc-relative relocations in MOVI and MOVI expansion.
+
+ .mode SHmedia
+ .text
+start:
+ movi data1 - datalabel $,r10
+ movi (data2 - datalabel $) & 65535,r10
+ movi ((data3 - datalabel $) >> 0) & 65535,r10
+ movi ((data4 - datalabel $) >> 16) & 65535,r10
+ movi data5 + 8 - datalabel $,r10
+ movi (data6 + 16 - datalabel $) & 65535,r10
+ movi ((data7 + 12 - datalabel $) >> 0) & 65535,r10
+ movi ((data8 + 4 - datalabel $) >> 16) & 65535,r10
+
+ movi othertext1 - datalabel $,r10
+ movi (othertext2 - datalabel $) & 65535,r10
+ movi ((othertext3 - datalabel $) >> 0) & 65535,r10
+ movi ((othertext4 - datalabel $) >> 16) & 65535,r10
+ movi othertext5 + 8 - datalabel $,r10
+ movi (othertext6 + 16 - datalabel $) & 65535,r10
+ movi ((othertext7 + 12 - datalabel $) >> 0) & 65535,r10
+ movi ((othertext8 + 4 - datalabel $) >> 16) & 65535,r10
+
+ movi extern1 - datalabel $,r10
+ movi (extern2 - datalabel $) & 65535,r10
+ movi ((extern3 - datalabel $) >> 0) & 65535,r10
+ movi ((extern4 - datalabel $) >> 16) & 65535,r10
+ movi extern5 + 8 - datalabel $,r10
+ movi (extern6 + 16 - datalabel $) & 65535,r10
+ movi ((extern7 + 12 - datalabel $) >> 0) & 65535,r10
+ movi ((extern8 + 4 - datalabel $) >> 16) & 65535,r10
+
+ movi gdata1 - datalabel $,r10
+ movi (gdata2 - datalabel $) & 65535,r10
+ movi ((gdata3 - datalabel $) >> 0) & 65535,r10
+ movi ((gdata4 - datalabel $) >> 16) & 65535,r10
+ movi gdata5 + 8 - datalabel $,r10
+ movi (gdata6 + 16 - datalabel $) & 65535,r10
+ movi ((gdata7 + 12 - datalabel $) >> 0) & 65535,r10
+ movi ((gdata8 + 4 - datalabel $) >> 16) & 65535,r10
+
+ movi gothertext1 - datalabel $,r10
+ movi (gothertext2 - datalabel $) & 65535,r10
+ movi ((gothertext3 - datalabel $) >> 0) & 65535,r10
+ movi ((gothertext4 - datalabel $) >> 16) & 65535,r10
+ movi gothertext5 + 8 - datalabel $,r10
+ movi (gothertext6 + 16 - datalabel $) & 65535,r10
+ movi ((gothertext7 + 12 - datalabel $) >> 0) & 65535,r10
+ movi ((gothertext8 + 4 - datalabel $) >> 16) & 65535,r10
+
+ .section .othertext,"ax"
+x:
+ nop
+othertext1:
+ nop
+othertext2:
+ nop
+othertext3:
+ nop
+othertext4:
+ nop
+othertext5:
+ nop
+othertext6:
+ nop
+othertext7:
+ nop
+othertext8:
+ nop
+ .global gothertext1
+gothertext1:
+ nop
+ .global gothertext2
+gothertext2:
+ nop
+ .global gothertext3
+gothertext3:
+ nop
+ .global gothertext4
+gothertext4:
+ nop
+ .global gothertext5
+gothertext5:
+ nop
+ .global gothertext6
+gothertext6:
+ nop
+ .global gothertext7
+gothertext7:
+ nop
+ .global gothertext8
+gothertext8:
+ nop
+
+ .data
+y:
+ .long 0
+data1:
+ .long 0
+data2:
+ .long 0
+data3:
+ .long 0
+data4:
+ .long 0
+data5:
+ .long 0
+data6:
+ .long 0
+data7:
+ .long 0
+data8:
+ .long 0
+ .global gdata1
+gdata1:
+ .long 0
+ .global gdata2
+gdata2:
+ .long 0
+ .global gdata3
+gdata3:
+ .long 0
+ .global gdata4
+gdata4:
+ .long 0
+ .global gdata5
+gdata5:
+ .long 0
+ .global gdata6
+gdata6:
+ .long 0
+ .global gdata7
+gdata7:
+ .long 0
+ .global gdata8
+gdata8:
+ .long 0
diff --git a/gas/testsuite/gas/sh/sh64/rel-2.s b/gas/testsuite/gas/sh/sh64/rel-2.s
new file mode 100644
index 0000000..798cf41
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/rel-2.s
@@ -0,0 +1,138 @@
+! Like rel-1.s, but using "$", not "datalabel $" as self expression. It's
+! not as useful, but should emit the obvious output.
+
+ .mode SHmedia
+ .text
+start:
+ movi data1 - $,r10
+ movi (data2 - $) & 65535,r10
+ movi ((data3 - $) >> 0) & 65535,r10
+ movi ((data4 - $) >> 16) & 65535,r10
+ movi data5 + 8 - $,r10
+ movi (data6 + 16 - $) & 65535,r10
+ movi ((data7 + 12 - $) >> 0) & 65535,r10
+ movi ((data8 + 4 - $) >> 16) & 65535,r10
+
+ movi othertext1 - $,r10
+ movi (othertext2 - $) & 65535,r10
+ movi ((othertext3 - $) >> 0) & 65535,r10
+ movi ((othertext4 - $) >> 16) & 65535,r10
+ movi othertext5 + 8 - $,r10
+ movi (othertext6 + 16 - $) & 65535,r10
+ movi ((othertext7 + 12 - $) >> 0) & 65535,r10
+ movi ((othertext8 + 4 - $) >> 16) & 65535,r10
+
+ movi extern1 - $,r10
+ movi (extern2 - $) & 65535,r10
+ movi ((extern3 - $) >> 0) & 65535,r10
+ movi ((extern4 - $) >> 16) & 65535,r10
+ movi extern5 + 8 - $,r10
+ movi (extern6 + 16 - $) & 65535,r10
+ movi ((extern7 + 12 - $) >> 0) & 65535,r10
+ movi ((extern8 + 4 - $) >> 16) & 65535,r10
+
+ movi gdata1 - $,r10
+ movi (gdata2 - $) & 65535,r10
+ movi ((gdata3 - $) >> 0) & 65535,r10
+ movi ((gdata4 - $) >> 16) & 65535,r10
+ movi gdata5 + 8 - $,r10
+ movi (gdata6 + 16 - $) & 65535,r10
+ movi ((gdata7 + 12 - $) >> 0) & 65535,r10
+ movi ((gdata8 + 4 - $) >> 16) & 65535,r10
+
+ movi gothertext1 - $,r10
+ movi (gothertext2 - $) & 65535,r10
+ movi ((gothertext3 - $) >> 0) & 65535,r10
+ movi ((gothertext4 - $) >> 16) & 65535,r10
+ movi gothertext5 + 8 - $,r10
+ movi (gothertext6 + 16 - $) & 65535,r10
+ movi ((gothertext7 + 12 - $) >> 0) & 65535,r10
+ movi ((gothertext8 + 4 - $) >> 16) & 65535,r10
+
+ .section .othertext,"ax"
+x:
+ nop
+othertext1:
+ nop
+othertext2:
+ nop
+othertext3:
+ nop
+othertext4:
+ nop
+othertext5:
+ nop
+othertext6:
+ nop
+othertext7:
+ nop
+othertext8:
+ nop
+ .global gothertext1
+gothertext1:
+ nop
+ .global gothertext2
+gothertext2:
+ nop
+ .global gothertext3
+gothertext3:
+ nop
+ .global gothertext4
+gothertext4:
+ nop
+ .global gothertext5
+gothertext5:
+ nop
+ .global gothertext6
+gothertext6:
+ nop
+ .global gothertext7
+gothertext7:
+ nop
+ .global gothertext8
+gothertext8:
+ nop
+
+ .data
+y:
+ .long 0
+data1:
+ .long 0
+data2:
+ .long 0
+data3:
+ .long 0
+data4:
+ .long 0
+data5:
+ .long 0
+data6:
+ .long 0
+data7:
+ .long 0
+data8:
+ .long 0
+ .global gdata1
+gdata1:
+ .long 0
+ .global gdata2
+gdata2:
+ .long 0
+ .global gdata3
+gdata3:
+ .long 0
+ .global gdata4
+gdata4:
+ .long 0
+ .global gdata5
+gdata5:
+ .long 0
+ .global gdata6
+gdata6:
+ .long 0
+ .global gdata7
+gdata7:
+ .long 0
+ .global gdata8
+gdata8:
+ .long 0
diff --git a/gas/testsuite/gas/sh/sh64/rel-3.s b/gas/testsuite/gas/sh/sh64/rel-3.s
new file mode 100644
index 0000000..de60beb
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/rel-3.s
@@ -0,0 +1,137 @@
+! Like rel-1, but references are marked "datalabel".
+
+ .mode SHmedia
+ .text
+start:
+ movi datalabel data1 - datalabel $,r10
+ movi (datalabel data2 - datalabel $) & 65535,r10
+ movi ((datalabel data3 - datalabel $) >> 0) & 65535,r10
+ movi ((datalabel data4 - datalabel $) >> 16) & 65535,r10
+ movi datalabel data5 + 8 - datalabel $,r10
+ movi (datalabel data6 + 16 - datalabel $) & 65535,r10
+ movi ((datalabel data7 + 12 - datalabel $) >> 0) & 65535,r10
+ movi ((datalabel data8 + 4 - datalabel $) >> 16) & 65535,r10
+
+ movi datalabel othertext1 - datalabel $,r10
+ movi (datalabel othertext2 - datalabel $) & 65535,r10
+ movi ((datalabel othertext3 - datalabel $) >> 0) & 65535,r10
+ movi ((datalabel othertext4 - datalabel $) >> 16) & 65535,r10
+ movi datalabel othertext5 + 8 - datalabel $,r10
+ movi (datalabel othertext6 + 16 - datalabel $) & 65535,r10
+ movi ((datalabel othertext7 + 12 - datalabel $) >> 0) & 65535,r10
+ movi ((datalabel othertext8 + 4 - datalabel $) >> 16) & 65535,r10
+
+ movi datalabel extern1 - datalabel $,r10
+ movi (datalabel extern2 - datalabel $) & 65535,r10
+ movi ((datalabel extern3 - datalabel $) >> 0) & 65535,r10
+ movi ((datalabel extern4 - datalabel $) >> 16) & 65535,r10
+ movi datalabel extern5 + 8 - datalabel $,r10
+ movi (datalabel extern6 + 16 - datalabel $) & 65535,r10
+ movi ((datalabel extern7 + 12 - datalabel $) >> 0) & 65535,r10
+ movi ((datalabel extern8 + 4 - datalabel $) >> 16) & 65535,r10
+
+ movi datalabel gdata1 - datalabel $,r10
+ movi (datalabel gdata2 - datalabel $) & 65535,r10
+ movi ((datalabel gdata3 - datalabel $) >> 0) & 65535,r10
+ movi ((datalabel gdata4 - datalabel $) >> 16) & 65535,r10
+ movi datalabel gdata5 + 8 - datalabel $,r10
+ movi (datalabel gdata6 + 16 - datalabel $) & 65535,r10
+ movi ((datalabel gdata7 + 12 - datalabel $) >> 0) & 65535,r10
+ movi ((datalabel gdata8 + 4 - datalabel $) >> 16) & 65535,r10
+
+ movi datalabel gothertext1 - datalabel $,r10
+ movi (datalabel gothertext2 - datalabel $) & 65535,r10
+ movi ((datalabel gothertext3 - datalabel $) >> 0) & 65535,r10
+ movi ((datalabel gothertext4 - datalabel $) >> 16) & 65535,r10
+ movi datalabel gothertext5 + 8 - datalabel $,r10
+ movi (datalabel gothertext6 + 16 - datalabel $) & 65535,r10
+ movi ((datalabel gothertext7 + 12 - datalabel $) >> 0) & 65535,r10
+ movi ((datalabel gothertext8 + 4 - datalabel $) >> 16) & 65535,r10
+
+ .section .othertext,"ax"
+x:
+ nop
+othertext1:
+ nop
+othertext2:
+ nop
+othertext3:
+ nop
+othertext4:
+ nop
+othertext5:
+ nop
+othertext6:
+ nop
+othertext7:
+ nop
+othertext8:
+ nop
+ .global gothertext1
+gothertext1:
+ nop
+ .global gothertext2
+gothertext2:
+ nop
+ .global gothertext3
+gothertext3:
+ nop
+ .global gothertext4
+gothertext4:
+ nop
+ .global gothertext5
+gothertext5:
+ nop
+ .global gothertext6
+gothertext6:
+ nop
+ .global gothertext7
+gothertext7:
+ nop
+ .global gothertext8
+gothertext8:
+ nop
+
+ .data
+y:
+ .long 0
+data1:
+ .long 0
+data2:
+ .long 0
+data3:
+ .long 0
+data4:
+ .long 0
+data5:
+ .long 0
+data6:
+ .long 0
+data7:
+ .long 0
+data8:
+ .long 0
+ .global gdata1
+gdata1:
+ .long 0
+ .global gdata2
+gdata2:
+ .long 0
+ .global gdata3
+gdata3:
+ .long 0
+ .global gdata4
+gdata4:
+ .long 0
+ .global gdata5
+gdata5:
+ .long 0
+ .global gdata6
+gdata6:
+ .long 0
+ .global gdata7
+gdata7:
+ .long 0
+ .global gdata8
+gdata8:
+ .long 0
diff --git a/gas/testsuite/gas/sh/sh64/rel-4.s b/gas/testsuite/gas/sh/sh64/rel-4.s
new file mode 100644
index 0000000..411cb0a
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/rel-4.s
@@ -0,0 +1,138 @@
+! Like rel-3.s, but as with rel-2 vs. rel-1, using "$", not "datalabel $"
+! as self expression.
+
+ .mode SHmedia
+ .text
+start:
+ movi datalabel data1 - $,r10
+ movi (datalabel data2 - $) & 65535,r10
+ movi ((datalabel data3 - $) >> 0) & 65535,r10
+ movi ((datalabel data4 - $) >> 16) & 65535,r10
+ movi datalabel data5 + 8 - $,r10
+ movi (datalabel data6 + 16 - $) & 65535,r10
+ movi ((datalabel data7 + 12 - $) >> 0) & 65535,r10
+ movi ((datalabel data8 + 4 - $) >> 16) & 65535,r10
+
+ movi datalabel othertext1 - $,r10
+ movi (datalabel othertext2 - $) & 65535,r10
+ movi ((datalabel othertext3 - $) >> 0) & 65535,r10
+ movi ((datalabel othertext4 - $) >> 16) & 65535,r10
+ movi datalabel othertext5 + 8 - $,r10
+ movi (datalabel othertext6 + 16 - $) & 65535,r10
+ movi ((datalabel othertext7 + 12 - $) >> 0) & 65535,r10
+ movi ((datalabel othertext8 + 4 - $) >> 16) & 65535,r10
+
+ movi datalabel extern1 - $,r10
+ movi (datalabel extern2 - $) & 65535,r10
+ movi ((datalabel extern3 - $) >> 0) & 65535,r10
+ movi ((datalabel extern4 - $) >> 16) & 65535,r10
+ movi datalabel extern5 + 8 - $,r10
+ movi (datalabel extern6 + 16 - $) & 65535,r10
+ movi ((datalabel extern7 + 12 - $) >> 0) & 65535,r10
+ movi ((datalabel extern8 + 4 - $) >> 16) & 65535,r10
+
+ movi datalabel gdata1 - $,r10
+ movi (datalabel gdata2 - $) & 65535,r10
+ movi ((datalabel gdata3 - $) >> 0) & 65535,r10
+ movi ((datalabel gdata4 - $) >> 16) & 65535,r10
+ movi datalabel gdata5 + 8 - $,r10
+ movi (datalabel gdata6 + 16 - $) & 65535,r10
+ movi ((datalabel gdata7 + 12 - $) >> 0) & 65535,r10
+ movi ((datalabel gdata8 + 4 - $) >> 16) & 65535,r10
+
+ movi datalabel gothertext1 - $,r10
+ movi (datalabel gothertext2 - $) & 65535,r10
+ movi ((datalabel gothertext3 - $) >> 0) & 65535,r10
+ movi ((datalabel gothertext4 - $) >> 16) & 65535,r10
+ movi datalabel gothertext5 + 8 - $,r10
+ movi (datalabel gothertext6 + 16 - $) & 65535,r10
+ movi ((datalabel gothertext7 + 12 - $) >> 0) & 65535,r10
+ movi ((datalabel gothertext8 + 4 - $) >> 16) & 65535,r10
+
+ .section .othertext,"ax"
+x:
+ nop
+othertext1:
+ nop
+othertext2:
+ nop
+othertext3:
+ nop
+othertext4:
+ nop
+othertext5:
+ nop
+othertext6:
+ nop
+othertext7:
+ nop
+othertext8:
+ nop
+ .global gothertext1
+gothertext1:
+ nop
+ .global gothertext2
+gothertext2:
+ nop
+ .global gothertext3
+gothertext3:
+ nop
+ .global gothertext4
+gothertext4:
+ nop
+ .global gothertext5
+gothertext5:
+ nop
+ .global gothertext6
+gothertext6:
+ nop
+ .global gothertext7
+gothertext7:
+ nop
+ .global gothertext8
+gothertext8:
+ nop
+
+ .data
+y:
+ .long 0
+data1:
+ .long 0
+data2:
+ .long 0
+data3:
+ .long 0
+data4:
+ .long 0
+data5:
+ .long 0
+data6:
+ .long 0
+data7:
+ .long 0
+data8:
+ .long 0
+ .global gdata1
+gdata1:
+ .long 0
+ .global gdata2
+gdata2:
+ .long 0
+ .global gdata3
+gdata3:
+ .long 0
+ .global gdata4
+gdata4:
+ .long 0
+ .global gdata5
+gdata5:
+ .long 0
+ .global gdata6
+gdata6:
+ .long 0
+ .global gdata7
+gdata7:
+ .long 0
+ .global gdata8
+gdata8:
+ .long 0
diff --git a/gas/testsuite/gas/sh/sh64/rel-5.s b/gas/testsuite/gas/sh/sh64/rel-5.s
new file mode 100644
index 0000000..053c237
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/rel-5.s
@@ -0,0 +1,48 @@
+! Test MOVI pc-relative expansion within text section.
+
+ .text
+ .mode SHmedia
+start:
+ nop
+ movi start2+8 - datalabel $,r30
+ movi start3+4 - $,r30
+ movi datalabel start4 + 8 - datalabel $,r30
+ movi datalabel start5 + 12 - $,r30
+ movi (datalabel start6 + 24 - datalabel $) & 65535,r40
+ movi ((datalabel start7 + 32 - datalabel $) >> 16) & 65535,r50
+ movi gstart2+8 - datalabel $,r30
+ movi gstart3+4 - $,r30
+ movi datalabel gstart4 + 8 - datalabel $,r30
+ movi datalabel gstart5 + 12 - $,r30
+ movi (datalabel gstart6 + 24 - datalabel $) & 65535,r40
+ movi ((datalabel gstart7 + 32 - datalabel $) >> 16) & 65535,r50
+start2:
+ nop
+start3:
+ nop
+start4:
+ nop
+start5:
+ nop
+start6:
+ nop
+start7:
+ nop
+ .global gstart2
+gstart2:
+ nop
+ .global gstart3
+gstart3:
+ nop
+ .global gstart4
+gstart4:
+ nop
+ .global gstart5
+gstart5:
+ nop
+ .global gstart6
+gstart6:
+ nop
+ .global gstart7
+gstart7:
+ nop
diff --git a/gas/testsuite/gas/sh/sh64/rel32-1.d b/gas/testsuite/gas/sh/sh64/rel32-1.d
new file mode 100644
index 0000000..dab15e6
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/rel32-1.d
@@ -0,0 +1,86 @@
+#as: --abi=32
+#objdump: -sr
+#source: rel-1.s
+#name: MOVI: PC-relative relocs, 32-bit ABI.
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET *TYPE *VALUE
+0+08 R_SH_IMM_LOW16_PCREL \.data\+0x0+8
+0+0c R_SH_IMM_LOW16_PCREL \.data\+0x0+c
+0+10 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+10
+0+1c R_SH_IMM_LOW16_PCREL \.data\+0x0+28
+0+20 R_SH_IMM_LOW16_PCREL \.data\+0x0+28
+0+24 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+24
+0+30 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+9
+0+34 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+d
+0+38 R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+11
+0+44 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+29
+0+48 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+29
+0+4c R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+25
+0+58 R_SH_IMM_LOW16_PCREL extern2
+0+5c R_SH_IMM_LOW16_PCREL extern3
+0+60 R_SH_IMM_MEDLOW16_PCREL extern4
+0+6c R_SH_IMM_LOW16_PCREL extern6\+0x0+10
+0+70 R_SH_IMM_LOW16_PCREL extern7\+0x0+c
+0+74 R_SH_IMM_MEDLOW16_PCREL extern8\+0x0+4
+0+80 R_SH_IMM_LOW16_PCREL gdata2
+0+84 R_SH_IMM_LOW16_PCREL gdata3
+0+88 R_SH_IMM_MEDLOW16_PCREL gdata4
+0+94 R_SH_IMM_LOW16_PCREL gdata6\+0x0+10
+0+98 R_SH_IMM_LOW16_PCREL gdata7\+0x0+c
+0+9c R_SH_IMM_MEDLOW16_PCREL gdata8\+0x0+4
+0+a8 R_SH_IMM_LOW16_PCREL gothertext2
+0+ac R_SH_IMM_LOW16_PCREL gothertext3
+0+b0 R_SH_IMM_MEDLOW16_PCREL gothertext4
+0+bc R_SH_IMM_LOW16_PCREL gothertext6\+0x0+10
+0+c0 R_SH_IMM_LOW16_PCREL gothertext7\+0x0+c
+0+c4 R_SH_IMM_MEDLOW16_PCREL gothertext8\+0x0+4
+0+00 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+4
+0+04 R_SH_IMM_LOW16_PCREL \.data\+0x0+8
+0+14 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+1c
+0+18 R_SH_IMM_LOW16_PCREL \.data\+0x0+20
+0+28 R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+5
+0+2c R_SH_IMM_LOW16_PCREL \.othertext\+0x0+9
+0+3c R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+1d
+0+40 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+21
+0+50 R_SH_IMM_MEDLOW16_PCREL extern1
+0+54 R_SH_IMM_LOW16_PCREL extern1\+0x0+4
+0+64 R_SH_IMM_MEDLOW16_PCREL extern5\+0x0+8
+0+68 R_SH_IMM_LOW16_PCREL extern5\+0x0+c
+0+78 R_SH_IMM_MEDLOW16_PCREL gdata1
+0+7c R_SH_IMM_LOW16_PCREL gdata1\+0x0+4
+0+8c R_SH_IMM_MEDLOW16_PCREL gdata5\+0x0+8
+0+90 R_SH_IMM_LOW16_PCREL gdata5\+0x0+c
+0+a0 R_SH_IMM_MEDLOW16_PCREL gothertext1
+0+a4 R_SH_IMM_LOW16_PCREL gothertext1\+0x0+4
+0+b4 R_SH_IMM_MEDLOW16_PCREL gothertext5\+0x0+8
+0+b8 R_SH_IMM_LOW16_PCREL gothertext5\+0x0+c
+
+Contents of section \.text:
+ 0000 cc0000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 0010 cc0000a0 cc0000a0 c80000a0 cc0000a0 .*
+ 0020 cc0000a0 cc0000a0 cc0000a0 c80000a0 .*
+ 0030 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0040 c80000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0050 cc0000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 0060 cc0000a0 cc0000a0 c80000a0 cc0000a0 .*
+ 0070 cc0000a0 cc0000a0 cc0000a0 c80000a0 .*
+ 0080 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0090 c80000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 00a0 cc0000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 00b0 cc0000a0 cc0000a0 c80000a0 cc0000a0 .*
+ 00c0 cc0000a0 cc0000a0 .*
+Contents of section \.data:
+ 0000 00000000 00000000 00000000 00000000 .*
+ 0010 00000000 00000000 00000000 00000000 .*
+ 0020 00000000 00000000 00000000 00000000 .*
+ 0030 00000000 00000000 00000000 00000000 .*
+ 0040 00000000 .*
+Contents of section \.othertext:
+ 0000 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0010 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0020 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0030 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0040 6ff0fff0 .*
diff --git a/gas/testsuite/gas/sh/sh64/rel32-2.d b/gas/testsuite/gas/sh/sh64/rel32-2.d
new file mode 100644
index 0000000..14d63d4
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/rel32-2.d
@@ -0,0 +1,86 @@
+#as: --abi=32
+#objdump: -sr
+#source: rel-2.s
+#name: MOVI: PC+1-relative relocs, 32-bit ABI.
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET *TYPE *VALUE
+0+8 R_SH_IMM_LOW16_PCREL \.data\+0x0+7
+0+c R_SH_IMM_LOW16_PCREL \.data\+0x0+b
+0+10 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+f
+0+1c R_SH_IMM_LOW16_PCREL \.data\+0x0+27
+0+20 R_SH_IMM_LOW16_PCREL \.data\+0x0+27
+0+24 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+23
+0+30 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+8
+0+34 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+c
+0+38 R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+10
+0+44 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+28
+0+48 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+28
+0+4c R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+24
+0+58 R_SH_IMM_LOW16_PCREL extern2\+0xf*ffffffff
+0+5c R_SH_IMM_LOW16_PCREL extern3\+0xf*ffffffff
+0+60 R_SH_IMM_MEDLOW16_PCREL extern4\+0xf*ffffffff
+0+6c R_SH_IMM_LOW16_PCREL extern6\+0x0+f
+0+70 R_SH_IMM_LOW16_PCREL extern7\+0x0+b
+0+74 R_SH_IMM_MEDLOW16_PCREL extern8\+0x0+3
+0+80 R_SH_IMM_LOW16_PCREL gdata2\+0xf*ffffffff
+0+84 R_SH_IMM_LOW16_PCREL gdata3\+0xf*ffffffff
+0+88 R_SH_IMM_MEDLOW16_PCREL gdata4\+0xf*ffffffff
+0+94 R_SH_IMM_LOW16_PCREL gdata6\+0x0+f
+0+98 R_SH_IMM_LOW16_PCREL gdata7\+0x0+b
+0+9c R_SH_IMM_MEDLOW16_PCREL gdata8\+0x0+3
+0+a8 R_SH_IMM_LOW16_PCREL gothertext2\+0xf*ffffffff
+0+ac R_SH_IMM_LOW16_PCREL gothertext3\+0xf*ffffffff
+0+b0 R_SH_IMM_MEDLOW16_PCREL gothertext4\+0xf*ffffffff
+0+bc R_SH_IMM_LOW16_PCREL gothertext6\+0x0+f
+0+c0 R_SH_IMM_LOW16_PCREL gothertext7\+0x0+b
+0+c4 R_SH_IMM_MEDLOW16_PCREL gothertext8\+0x0+3
+0+ R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+3
+0+4 R_SH_IMM_LOW16_PCREL \.data\+0x0+7
+0+14 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+1b
+0+18 R_SH_IMM_LOW16_PCREL \.data\+0x0+1f
+0+28 R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+4
+0+2c R_SH_IMM_LOW16_PCREL \.othertext\+0x0+8
+0+3c R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+1c
+0+40 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+20
+0+50 R_SH_IMM_MEDLOW16_PCREL extern1\+0xf*ffffffff
+0+54 R_SH_IMM_LOW16_PCREL extern1\+0x0+3
+0+64 R_SH_IMM_MEDLOW16_PCREL extern5\+0x0+7
+0+68 R_SH_IMM_LOW16_PCREL extern5\+0x0+b
+0+78 R_SH_IMM_MEDLOW16_PCREL gdata1\+0xf*ffffffff
+0+7c R_SH_IMM_LOW16_PCREL gdata1\+0x0+3
+0+8c R_SH_IMM_MEDLOW16_PCREL gdata5\+0x0+7
+0+90 R_SH_IMM_LOW16_PCREL gdata5\+0x0+b
+0+a0 R_SH_IMM_MEDLOW16_PCREL gothertext1\+0xf*ffffffff
+0+a4 R_SH_IMM_LOW16_PCREL gothertext1\+0x0+3
+0+b4 R_SH_IMM_MEDLOW16_PCREL gothertext5\+0x0+7
+0+b8 R_SH_IMM_LOW16_PCREL gothertext5\+0x0+b
+
+Contents of section \.text:
+ 0000 cc0000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 0010 cc0000a0 cc0000a0 c80000a0 cc0000a0 .*
+ 0020 cc0000a0 cc0000a0 cc0000a0 c80000a0 .*
+ 0030 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0040 c80000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0050 cc0000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 0060 cc0000a0 cc0000a0 c80000a0 cc0000a0 .*
+ 0070 cc0000a0 cc0000a0 cc0000a0 c80000a0 .*
+ 0080 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0090 c80000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 00a0 cc0000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 00b0 cc0000a0 cc0000a0 c80000a0 cc0000a0 .*
+ 00c0 cc0000a0 cc0000a0 .*
+Contents of section \.data:
+ 0000 00000000 00000000 00000000 00000000 .*
+ 0010 00000000 00000000 00000000 00000000 .*
+ 0020 00000000 00000000 00000000 00000000 .*
+ 0030 00000000 00000000 00000000 00000000 .*
+ 0040 00000000 .*
+Contents of section \.othertext:
+ 0000 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0010 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0020 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0030 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0040 6ff0fff0 .*
diff --git a/gas/testsuite/gas/sh/sh64/rel32-3.d b/gas/testsuite/gas/sh/sh64/rel32-3.d
new file mode 100644
index 0000000..f739477
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/rel32-3.d
@@ -0,0 +1,86 @@
+#as: --abi=32
+#objdump: -sr
+#source: rel-3.s
+#name: MOVI: PC-relative datalabel relocs, 32-bit ABI.
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET *TYPE *VALUE
+0+8 R_SH_IMM_LOW16_PCREL \.data\+0x0+8
+0+c R_SH_IMM_LOW16_PCREL \.data\+0x0+c
+0+10 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+10
+0+1c R_SH_IMM_LOW16_PCREL \.data\+0x0+28
+0+20 R_SH_IMM_LOW16_PCREL \.data\+0x0+28
+0+24 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+24
+0+30 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+8
+0+34 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+c
+0+38 R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+10
+0+44 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+28
+0+48 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+28
+0+4c R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+24
+0+58 R_SH_IMM_LOW16_PCREL extern2
+0+5c R_SH_IMM_LOW16_PCREL extern3
+0+60 R_SH_IMM_MEDLOW16_PCREL extern4
+0+6c R_SH_IMM_LOW16_PCREL extern6\+0x0+10
+0+70 R_SH_IMM_LOW16_PCREL extern7\+0x0+c
+0+74 R_SH_IMM_MEDLOW16_PCREL extern8\+0x0+4
+0+80 R_SH_IMM_LOW16_PCREL gdata2
+0+84 R_SH_IMM_LOW16_PCREL gdata3
+0+88 R_SH_IMM_MEDLOW16_PCREL gdata4
+0+94 R_SH_IMM_LOW16_PCREL gdata6\+0x0+10
+0+98 R_SH_IMM_LOW16_PCREL gdata7\+0x0+c
+0+9c R_SH_IMM_MEDLOW16_PCREL gdata8\+0x0+4
+0+a8 R_SH_IMM_LOW16_PCREL gothertext2
+0+ac R_SH_IMM_LOW16_PCREL gothertext3
+0+b0 R_SH_IMM_MEDLOW16_PCREL gothertext4
+0+bc R_SH_IMM_LOW16_PCREL gothertext6\+0x0+10
+0+c0 R_SH_IMM_LOW16_PCREL gothertext7\+0x0+c
+0+c4 R_SH_IMM_MEDLOW16_PCREL gothertext8\+0x0+4
+0+ R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+4
+0+4 R_SH_IMM_LOW16_PCREL \.data\+0x0+8
+0+14 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+1c
+0+18 R_SH_IMM_LOW16_PCREL \.data\+0x0+20
+0+28 R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+4
+0+2c R_SH_IMM_LOW16_PCREL \.othertext\+0x0+8
+0+3c R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+1c
+0+40 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+20
+0+50 R_SH_IMM_MEDLOW16_PCREL extern1
+0+54 R_SH_IMM_LOW16_PCREL extern1\+0x0+4
+0+64 R_SH_IMM_MEDLOW16_PCREL extern5\+0x0+8
+0+68 R_SH_IMM_LOW16_PCREL extern5\+0x0+c
+0+78 R_SH_IMM_MEDLOW16_PCREL gdata1
+0+7c R_SH_IMM_LOW16_PCREL gdata1\+0x0+4
+0+8c R_SH_IMM_MEDLOW16_PCREL gdata5\+0x0+8
+0+90 R_SH_IMM_LOW16_PCREL gdata5\+0x0+c
+0+a0 R_SH_IMM_MEDLOW16_PCREL gothertext1
+0+a4 R_SH_IMM_LOW16_PCREL gothertext1\+0x0+4
+0+b4 R_SH_IMM_MEDLOW16_PCREL gothertext5\+0x0+8
+0+b8 R_SH_IMM_LOW16_PCREL gothertext5\+0x0+c
+
+Contents of section \.text:
+ 0000 cc0000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 0010 cc0000a0 cc0000a0 c80000a0 cc0000a0 .*
+ 0020 cc0000a0 cc0000a0 cc0000a0 c80000a0 .*
+ 0030 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0040 c80000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0050 cc0000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 0060 cc0000a0 cc0000a0 c80000a0 cc0000a0 .*
+ 0070 cc0000a0 cc0000a0 cc0000a0 c80000a0 .*
+ 0080 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0090 c80000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 00a0 cc0000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 00b0 cc0000a0 cc0000a0 c80000a0 cc0000a0 .*
+ 00c0 cc0000a0 cc0000a0 .*
+Contents of section \.data:
+ 0000 00000000 00000000 00000000 00000000 .*
+ 0010 00000000 00000000 00000000 00000000 .*
+ 0020 00000000 00000000 00000000 00000000 .*
+ 0030 00000000 00000000 00000000 00000000 .*
+ 0040 00000000 .*
+Contents of section \.othertext:
+ 0000 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0010 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0020 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0030 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0040 6ff0fff0 .*
diff --git a/gas/testsuite/gas/sh/sh64/rel32-4.d b/gas/testsuite/gas/sh/sh64/rel32-4.d
new file mode 100644
index 0000000..4922012
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/rel32-4.d
@@ -0,0 +1,86 @@
+#as: --abi=32
+#objdump: -sr
+#source: rel-4.s
+#name: MOVI: PC+1-relative datalabel relocs, 32-bit ABI.
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET *TYPE *VALUE
+0+8 R_SH_IMM_LOW16_PCREL \.data\+0x0+7
+0+c R_SH_IMM_LOW16_PCREL \.data\+0x0+b
+0+10 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+f
+0+1c R_SH_IMM_LOW16_PCREL \.data\+0x0+27
+0+20 R_SH_IMM_LOW16_PCREL \.data\+0x0+27
+0+24 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+23
+0+30 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+7
+0+34 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+b
+0+38 R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+f
+0+44 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+27
+0+48 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+27
+0+4c R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+23
+0+58 R_SH_IMM_LOW16_PCREL extern2\+0xf*ffffffff
+0+5c R_SH_IMM_LOW16_PCREL extern3\+0xf*ffffffff
+0+60 R_SH_IMM_MEDLOW16_PCREL extern4\+0xf*ffffffff
+0+6c R_SH_IMM_LOW16_PCREL extern6\+0x0+f
+0+70 R_SH_IMM_LOW16_PCREL extern7\+0x0+b
+0+74 R_SH_IMM_MEDLOW16_PCREL extern8\+0x0+3
+0+80 R_SH_IMM_LOW16_PCREL gdata2\+0xf*ffffffff
+0+84 R_SH_IMM_LOW16_PCREL gdata3\+0xf*ffffffff
+0+88 R_SH_IMM_MEDLOW16_PCREL gdata4\+0xf*ffffffff
+0+94 R_SH_IMM_LOW16_PCREL gdata6\+0x0+f
+0+98 R_SH_IMM_LOW16_PCREL gdata7\+0x0+b
+0+9c R_SH_IMM_MEDLOW16_PCREL gdata8\+0x0+3
+0+a8 R_SH_IMM_LOW16_PCREL gothertext2\+0xf*ffffffff
+0+ac R_SH_IMM_LOW16_PCREL gothertext3\+0xf*ffffffff
+0+b0 R_SH_IMM_MEDLOW16_PCREL gothertext4\+0xf*ffffffff
+0+bc R_SH_IMM_LOW16_PCREL gothertext6\+0x0+f
+0+c0 R_SH_IMM_LOW16_PCREL gothertext7\+0x0+b
+0+c4 R_SH_IMM_MEDLOW16_PCREL gothertext8\+0x0+3
+0+ R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+3
+0+4 R_SH_IMM_LOW16_PCREL \.data\+0x0+7
+0+14 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+1b
+0+18 R_SH_IMM_LOW16_PCREL \.data\+0x0+1f
+0+28 R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+3
+0+2c R_SH_IMM_LOW16_PCREL \.othertext\+0x0+7
+0+3c R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+1b
+0+40 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+1f
+0+50 R_SH_IMM_MEDLOW16_PCREL extern1\+0xf*ffffffff
+0+54 R_SH_IMM_LOW16_PCREL extern1\+0x0+3
+0+64 R_SH_IMM_MEDLOW16_PCREL extern5\+0x0+7
+0+68 R_SH_IMM_LOW16_PCREL extern5\+0x0+b
+0+78 R_SH_IMM_MEDLOW16_PCREL gdata1\+0xf*ffffffff
+0+7c R_SH_IMM_LOW16_PCREL gdata1\+0x0+3
+0+8c R_SH_IMM_MEDLOW16_PCREL gdata5\+0x0+7
+0+90 R_SH_IMM_LOW16_PCREL gdata5\+0x0+b
+0+a0 R_SH_IMM_MEDLOW16_PCREL gothertext1\+0xf*ffffffff
+0+a4 R_SH_IMM_LOW16_PCREL gothertext1\+0x0+3
+0+b4 R_SH_IMM_MEDLOW16_PCREL gothertext5\+0x0+7
+0+b8 R_SH_IMM_LOW16_PCREL gothertext5\+0x0+b
+
+Contents of section \.text:
+ 0000 cc0000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 0010 cc0000a0 cc0000a0 c80000a0 cc0000a0 .*
+ 0020 cc0000a0 cc0000a0 cc0000a0 c80000a0 .*
+ 0030 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0040 c80000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0050 cc0000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 0060 cc0000a0 cc0000a0 c80000a0 cc0000a0 .*
+ 0070 cc0000a0 cc0000a0 cc0000a0 c80000a0 .*
+ 0080 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0090 c80000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 00a0 cc0000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 00b0 cc0000a0 cc0000a0 c80000a0 cc0000a0 .*
+ 00c0 cc0000a0 cc0000a0 .*
+Contents of section \.data:
+ 0000 00000000 00000000 00000000 00000000 .*
+ 0010 00000000 00000000 00000000 00000000 .*
+ 0020 00000000 00000000 00000000 00000000 .*
+ 0030 00000000 00000000 00000000 00000000 .*
+ 0040 00000000 .*
+Contents of section \.othertext:
+ 0000 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0010 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0020 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0030 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0040 6ff0fff0 .*
diff --git a/gas/testsuite/gas/sh/sh64/rel32-5.d b/gas/testsuite/gas/sh/sh64/rel32-5.d
new file mode 100644
index 0000000..c2339a6
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/rel32-5.d
@@ -0,0 +1,30 @@
+#as: --abi=32
+#objdump: -sr
+#source: rel-5.s
+#name: MOVI: PC-relative reloc within .text, 32-bit ABI.
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET *TYPE *VALUE
+0+3c R_SH_IMM_LOW16_PCREL gstart6\+0x0+18
+0+40 R_SH_IMM_MEDLOW16_PCREL gstart7\+0x0+20
+0+1c R_SH_IMM_MEDLOW16_PCREL gstart2\+0x0+8
+0+20 R_SH_IMM_LOW16_PCREL gstart2\+0x0+c
+0+24 R_SH_IMM_MEDLOW16_PCREL gstart3\+0x0+3
+0+28 R_SH_IMM_LOW16_PCREL gstart3\+0x0+7
+0+2c R_SH_IMM_MEDLOW16_PCREL gstart4\+0x0+8
+0+30 R_SH_IMM_LOW16_PCREL gstart4\+0x0+c
+0+34 R_SH_IMM_MEDLOW16_PCREL gstart5\+0x0+b
+0+38 R_SH_IMM_LOW16_PCREL gstart5\+0x0+f
+
+Contents of section \.text:
+ 0000 6ff0fff0 cc0125e0 cc0111e0 cc0121e0 .*
+ 0010 cc012de0 cc016280 cc000320 cc0001e0 .*
+ 0020 c80001e0 cc0001e0 c80001e0 cc0001e0 .*
+ 0030 c80001e0 cc0001e0 c80001e0 cc000280 .*
+ 0040 cc000320 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0050 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0060 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0070 6ff0fff0 .*
+Contents of section \.data:
diff --git a/gas/testsuite/gas/sh/sh64/rel64-1.d b/gas/testsuite/gas/sh/sh64/rel64-1.d
new file mode 100644
index 0000000..27bfd45
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/rel64-1.d
@@ -0,0 +1,111 @@
+#as: --abi=64
+#objdump: -sr
+#source: rel-1.s
+#name: MOVI: PC-relative relocs, 64-bit ABI.
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET TYPE VALUE
+0+10 R_SH_IMM_LOW16_PCREL \.data\+0x0+8
+0+14 R_SH_IMM_LOW16_PCREL \.data\+0x0+c
+0+18 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+10
+0+2c R_SH_IMM_LOW16_PCREL \.data\+0x0+28
+0+30 R_SH_IMM_LOW16_PCREL \.data\+0x0+28
+0+34 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+24
+0+48 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+9
+0+4c R_SH_IMM_LOW16_PCREL \.othertext\+0x0+d
+0+50 R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+11
+0+64 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+29
+0+68 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+29
+0+6c R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+25
+0+80 R_SH_IMM_LOW16_PCREL extern2
+0+84 R_SH_IMM_LOW16_PCREL extern3
+0+88 R_SH_IMM_MEDLOW16_PCREL extern4
+0+9c R_SH_IMM_LOW16_PCREL extern6\+0x0+10
+0+a0 R_SH_IMM_LOW16_PCREL extern7\+0x0+c
+0+a4 R_SH_IMM_MEDLOW16_PCREL extern8\+0x0+4
+0+b8 R_SH_IMM_LOW16_PCREL gdata2
+0+bc R_SH_IMM_LOW16_PCREL gdata3
+0+c0 R_SH_IMM_MEDLOW16_PCREL gdata4
+0+d4 R_SH_IMM_LOW16_PCREL gdata6\+0x0+10
+0+d8 R_SH_IMM_LOW16_PCREL gdata7\+0x0+c
+0+dc R_SH_IMM_MEDLOW16_PCREL gdata8\+0x0+4
+0+f0 R_SH_IMM_LOW16_PCREL gothertext2
+0+f4 R_SH_IMM_LOW16_PCREL gothertext3
+0+f8 R_SH_IMM_MEDLOW16_PCREL gothertext4
+0+10c R_SH_IMM_LOW16_PCREL gothertext6\+0x0+10
+0+110 R_SH_IMM_LOW16_PCREL gothertext7\+0x0+c
+0+114 R_SH_IMM_MEDLOW16_PCREL gothertext8\+0x0+4
+0+ R_SH_IMM_HI16_PCREL \.data\+0x0+4
+0+4 R_SH_IMM_MEDHI16_PCREL \.data\+0x0+8
+0+8 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+c
+0+c R_SH_IMM_LOW16_PCREL \.data\+0x0+10
+0+1c R_SH_IMM_HI16_PCREL \.data\+0x0+1c
+0+20 R_SH_IMM_MEDHI16_PCREL \.data\+0x0+20
+0+24 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+24
+0+28 R_SH_IMM_LOW16_PCREL \.data\+0x0+28
+0+38 R_SH_IMM_HI16_PCREL \.othertext\+0x0+5
+0+3c R_SH_IMM_MEDHI16_PCREL \.othertext\+0x0+9
+0+40 R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+d
+0+44 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+11
+0+54 R_SH_IMM_HI16_PCREL \.othertext\+0x0+1d
+0+58 R_SH_IMM_MEDHI16_PCREL \.othertext\+0x0+21
+0+5c R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+25
+0+60 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+29
+0+70 R_SH_IMM_HI16_PCREL extern1
+0+74 R_SH_IMM_MEDHI16_PCREL extern1\+0x0+4
+0+78 R_SH_IMM_MEDLOW16_PCREL extern1\+0x0+8
+0+7c R_SH_IMM_LOW16_PCREL extern1\+0x0+c
+0+8c R_SH_IMM_HI16_PCREL extern5\+0x0+8
+0+90 R_SH_IMM_MEDHI16_PCREL extern5\+0x0+c
+0+94 R_SH_IMM_MEDLOW16_PCREL extern5\+0x0+10
+0+98 R_SH_IMM_LOW16_PCREL extern5\+0x0+14
+0+a8 R_SH_IMM_HI16_PCREL gdata1
+0+ac R_SH_IMM_MEDHI16_PCREL gdata1\+0x0+4
+0+b0 R_SH_IMM_MEDLOW16_PCREL gdata1\+0x0+8
+0+b4 R_SH_IMM_LOW16_PCREL gdata1\+0x0+c
+0+c4 R_SH_IMM_HI16_PCREL gdata5\+0x0+8
+0+c8 R_SH_IMM_MEDHI16_PCREL gdata5\+0x0+c
+0+cc R_SH_IMM_MEDLOW16_PCREL gdata5\+0x0+10
+0+d0 R_SH_IMM_LOW16_PCREL gdata5\+0x0+14
+0+e0 R_SH_IMM_HI16_PCREL gothertext1
+0+e4 R_SH_IMM_MEDHI16_PCREL gothertext1\+0x0+4
+0+e8 R_SH_IMM_MEDLOW16_PCREL gothertext1\+0x0+8
+0+ec R_SH_IMM_LOW16_PCREL gothertext1\+0x0+c
+0+fc R_SH_IMM_HI16_PCREL gothertext5\+0x0+8
+0+100 R_SH_IMM_MEDHI16_PCREL gothertext5\+0x0+c
+0+104 R_SH_IMM_MEDLOW16_PCREL gothertext5\+0x0+10
+0+108 R_SH_IMM_LOW16_PCREL gothertext5\+0x0+14
+
+Contents of section \.text:
+ 0000 cc0000a0 c80000a0 c80000a0 c80000a0 .*
+ 0010 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0020 c80000a0 c80000a0 c80000a0 cc0000a0 .*
+ 0030 cc0000a0 cc0000a0 cc0000a0 c80000a0 .*
+ 0040 c80000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 0050 cc0000a0 cc0000a0 c80000a0 c80000a0 .*
+ 0060 c80000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0070 cc0000a0 c80000a0 c80000a0 c80000a0 .*
+ 0080 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0090 c80000a0 c80000a0 c80000a0 cc0000a0 .*
+ 00a0 cc0000a0 cc0000a0 cc0000a0 c80000a0 .*
+ 00b0 c80000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 00c0 cc0000a0 cc0000a0 c80000a0 c80000a0 .*
+ 00d0 c80000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 00e0 cc0000a0 c80000a0 c80000a0 c80000a0 .*
+ 00f0 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0100 c80000a0 c80000a0 c80000a0 cc0000a0 .*
+ 0110 cc0000a0 cc0000a0 .*
+Contents of section \.data:
+ 0000 00000000 00000000 00000000 00000000 .*
+ 0010 00000000 00000000 00000000 00000000 .*
+ 0020 00000000 00000000 00000000 00000000 .*
+ 0030 00000000 00000000 00000000 00000000 .*
+ 0040 00000000 .*
+Contents of section \.othertext:
+ 0000 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0010 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0020 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0030 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0040 6ff0fff0 .*
diff --git a/gas/testsuite/gas/sh/sh64/rel64-2.d b/gas/testsuite/gas/sh/sh64/rel64-2.d
new file mode 100644
index 0000000..cbd7457
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/rel64-2.d
@@ -0,0 +1,111 @@
+#as: --abi=64
+#objdump: -sr
+#source: rel-2.s
+#name: MOVI: PC+1-relative relocs, 64-bit ABI.
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET TYPE VALUE
+0+10 R_SH_IMM_LOW16_PCREL \.data\+0x0+7
+0+14 R_SH_IMM_LOW16_PCREL \.data\+0x0+b
+0+18 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+f
+0+2c R_SH_IMM_LOW16_PCREL \.data\+0x0+27
+0+30 R_SH_IMM_LOW16_PCREL \.data\+0x0+27
+0+34 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+23
+0+48 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+8
+0+4c R_SH_IMM_LOW16_PCREL \.othertext\+0x0+c
+0+50 R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+10
+0+64 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+28
+0+68 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+28
+0+6c R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+24
+0+80 R_SH_IMM_LOW16_PCREL extern2\+0xffffffffffffffff
+0+84 R_SH_IMM_LOW16_PCREL extern3\+0xffffffffffffffff
+0+88 R_SH_IMM_MEDLOW16_PCREL extern4\+0xffffffffffffffff
+0+9c R_SH_IMM_LOW16_PCREL extern6\+0x0+f
+0+a0 R_SH_IMM_LOW16_PCREL extern7\+0x0+b
+0+a4 R_SH_IMM_MEDLOW16_PCREL extern8\+0x0+3
+0+b8 R_SH_IMM_LOW16_PCREL gdata2\+0xffffffffffffffff
+0+bc R_SH_IMM_LOW16_PCREL gdata3\+0xffffffffffffffff
+0+c0 R_SH_IMM_MEDLOW16_PCREL gdata4\+0xffffffffffffffff
+0+d4 R_SH_IMM_LOW16_PCREL gdata6\+0x0+f
+0+d8 R_SH_IMM_LOW16_PCREL gdata7\+0x0+b
+0+dc R_SH_IMM_MEDLOW16_PCREL gdata8\+0x0+3
+0+f0 R_SH_IMM_LOW16_PCREL gothertext2\+0xffffffffffffffff
+0+f4 R_SH_IMM_LOW16_PCREL gothertext3\+0xffffffffffffffff
+0+f8 R_SH_IMM_MEDLOW16_PCREL gothertext4\+0xffffffffffffffff
+0+10c R_SH_IMM_LOW16_PCREL gothertext6\+0x0+f
+0+110 R_SH_IMM_LOW16_PCREL gothertext7\+0x0+b
+0+114 R_SH_IMM_MEDLOW16_PCREL gothertext8\+0x0+3
+0+ R_SH_IMM_HI16_PCREL \.data\+0x0+3
+0+4 R_SH_IMM_MEDHI16_PCREL \.data\+0x0+7
+0+8 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+b
+0+c R_SH_IMM_LOW16_PCREL \.data\+0x0+f
+0+1c R_SH_IMM_HI16_PCREL \.data\+0x0+1b
+0+20 R_SH_IMM_MEDHI16_PCREL \.data\+0x0+1f
+0+24 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+23
+0+28 R_SH_IMM_LOW16_PCREL \.data\+0x0+27
+0+38 R_SH_IMM_HI16_PCREL \.othertext\+0x0+4
+0+3c R_SH_IMM_MEDHI16_PCREL \.othertext\+0x0+8
+0+40 R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+c
+0+44 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+10
+0+54 R_SH_IMM_HI16_PCREL \.othertext\+0x0+1c
+0+58 R_SH_IMM_MEDHI16_PCREL \.othertext\+0x0+20
+0+5c R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+24
+0+60 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+28
+0+70 R_SH_IMM_HI16_PCREL extern1\+0xffffffffffffffff
+0+74 R_SH_IMM_MEDHI16_PCREL extern1\+0x0+3
+0+78 R_SH_IMM_MEDLOW16_PCREL extern1\+0x0+7
+0+7c R_SH_IMM_LOW16_PCREL extern1\+0x0+b
+0+8c R_SH_IMM_HI16_PCREL extern5\+0x0+7
+0+90 R_SH_IMM_MEDHI16_PCREL extern5\+0x0+b
+0+94 R_SH_IMM_MEDLOW16_PCREL extern5\+0x0+f
+0+98 R_SH_IMM_LOW16_PCREL extern5\+0x0+13
+0+a8 R_SH_IMM_HI16_PCREL gdata1\+0xffffffffffffffff
+0+ac R_SH_IMM_MEDHI16_PCREL gdata1\+0x0+3
+0+b0 R_SH_IMM_MEDLOW16_PCREL gdata1\+0x0+7
+0+b4 R_SH_IMM_LOW16_PCREL gdata1\+0x0+b
+0+c4 R_SH_IMM_HI16_PCREL gdata5\+0x0+7
+0+c8 R_SH_IMM_MEDHI16_PCREL gdata5\+0x0+b
+0+cc R_SH_IMM_MEDLOW16_PCREL gdata5\+0x0+f
+0+d0 R_SH_IMM_LOW16_PCREL gdata5\+0x0+13
+0+e0 R_SH_IMM_HI16_PCREL gothertext1\+0xffffffffffffffff
+0+e4 R_SH_IMM_MEDHI16_PCREL gothertext1\+0x0+3
+0+e8 R_SH_IMM_MEDLOW16_PCREL gothertext1\+0x0+7
+0+ec R_SH_IMM_LOW16_PCREL gothertext1\+0x0+b
+0+fc R_SH_IMM_HI16_PCREL gothertext5\+0x0+7
+0+100 R_SH_IMM_MEDHI16_PCREL gothertext5\+0x0+b
+0+104 R_SH_IMM_MEDLOW16_PCREL gothertext5\+0x0+f
+0+108 R_SH_IMM_LOW16_PCREL gothertext5\+0x0+13
+
+Contents of section \.text:
+ 0000 cc0000a0 c80000a0 c80000a0 c80000a0 .*
+ 0010 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0020 c80000a0 c80000a0 c80000a0 cc0000a0 .*
+ 0030 cc0000a0 cc0000a0 cc0000a0 c80000a0 .*
+ 0040 c80000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 0050 cc0000a0 cc0000a0 c80000a0 c80000a0 .*
+ 0060 c80000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0070 cc0000a0 c80000a0 c80000a0 c80000a0 .*
+ 0080 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0090 c80000a0 c80000a0 c80000a0 cc0000a0 .*
+ 00a0 cc0000a0 cc0000a0 cc0000a0 c80000a0 .*
+ 00b0 c80000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 00c0 cc0000a0 cc0000a0 c80000a0 c80000a0 .*
+ 00d0 c80000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 00e0 cc0000a0 c80000a0 c80000a0 c80000a0 .*
+ 00f0 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0100 c80000a0 c80000a0 c80000a0 cc0000a0 .*
+ 0110 cc0000a0 cc0000a0 .*
+Contents of section \.data:
+ 0000 00000000 00000000 00000000 00000000 .*
+ 0010 00000000 00000000 00000000 00000000 .*
+ 0020 00000000 00000000 00000000 00000000 .*
+ 0030 00000000 00000000 00000000 00000000 .*
+ 0040 00000000 .*
+Contents of section \.othertext:
+ 0000 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0010 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0020 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0030 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0040 6ff0fff0 .*
diff --git a/gas/testsuite/gas/sh/sh64/rel64-3.d b/gas/testsuite/gas/sh/sh64/rel64-3.d
new file mode 100644
index 0000000..2d1cfc0
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/rel64-3.d
@@ -0,0 +1,111 @@
+#as: --abi=64
+#objdump: -sr
+#source: rel-3.s
+#name: MOVI: PC-relative datalabel relocs, 64-bit ABI.
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET TYPE VALUE
+0+10 R_SH_IMM_LOW16_PCREL \.data\+0x0+8
+0+14 R_SH_IMM_LOW16_PCREL \.data\+0x0+c
+0+18 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+10
+0+2c R_SH_IMM_LOW16_PCREL \.data\+0x0+28
+0+30 R_SH_IMM_LOW16_PCREL \.data\+0x0+28
+0+34 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+24
+0+48 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+8
+0+4c R_SH_IMM_LOW16_PCREL \.othertext\+0x0+c
+0+50 R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+10
+0+64 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+28
+0+68 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+28
+0+6c R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+24
+0+80 R_SH_IMM_LOW16_PCREL extern2
+0+84 R_SH_IMM_LOW16_PCREL extern3
+0+88 R_SH_IMM_MEDLOW16_PCREL extern4
+0+9c R_SH_IMM_LOW16_PCREL extern6\+0x0+10
+0+a0 R_SH_IMM_LOW16_PCREL extern7\+0x0+c
+0+a4 R_SH_IMM_MEDLOW16_PCREL extern8\+0x0+4
+0+b8 R_SH_IMM_LOW16_PCREL gdata2
+0+bc R_SH_IMM_LOW16_PCREL gdata3
+0+c0 R_SH_IMM_MEDLOW16_PCREL gdata4
+0+d4 R_SH_IMM_LOW16_PCREL gdata6\+0x0+10
+0+d8 R_SH_IMM_LOW16_PCREL gdata7\+0x0+c
+0+dc R_SH_IMM_MEDLOW16_PCREL gdata8\+0x0+4
+0+f0 R_SH_IMM_LOW16_PCREL gothertext2
+0+f4 R_SH_IMM_LOW16_PCREL gothertext3
+0+f8 R_SH_IMM_MEDLOW16_PCREL gothertext4
+0+10c R_SH_IMM_LOW16_PCREL gothertext6\+0x0+10
+0+110 R_SH_IMM_LOW16_PCREL gothertext7\+0x0+c
+0+114 R_SH_IMM_MEDLOW16_PCREL gothertext8\+0x0+4
+0+ R_SH_IMM_HI16_PCREL \.data\+0x0+4
+0+4 R_SH_IMM_MEDHI16_PCREL \.data\+0x0+8
+0+8 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+c
+0+c R_SH_IMM_LOW16_PCREL \.data\+0x0+10
+0+1c R_SH_IMM_HI16_PCREL \.data\+0x0+1c
+0+20 R_SH_IMM_MEDHI16_PCREL \.data\+0x0+20
+0+24 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+24
+0+28 R_SH_IMM_LOW16_PCREL \.data\+0x0+28
+0+38 R_SH_IMM_HI16_PCREL \.othertext\+0x0+4
+0+3c R_SH_IMM_MEDHI16_PCREL \.othertext\+0x0+8
+0+40 R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+c
+0+44 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+10
+0+54 R_SH_IMM_HI16_PCREL \.othertext\+0x0+1c
+0+58 R_SH_IMM_MEDHI16_PCREL \.othertext\+0x0+20
+0+5c R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+24
+0+60 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+28
+0+70 R_SH_IMM_HI16_PCREL extern1
+0+74 R_SH_IMM_MEDHI16_PCREL extern1\+0x0+4
+0+78 R_SH_IMM_MEDLOW16_PCREL extern1\+0x0+8
+0+7c R_SH_IMM_LOW16_PCREL extern1\+0x0+c
+0+8c R_SH_IMM_HI16_PCREL extern5\+0x0+8
+0+90 R_SH_IMM_MEDHI16_PCREL extern5\+0x0+c
+0+94 R_SH_IMM_MEDLOW16_PCREL extern5\+0x0+10
+0+98 R_SH_IMM_LOW16_PCREL extern5\+0x0+14
+0+a8 R_SH_IMM_HI16_PCREL gdata1
+0+ac R_SH_IMM_MEDHI16_PCREL gdata1\+0x0+4
+0+b0 R_SH_IMM_MEDLOW16_PCREL gdata1\+0x0+8
+0+b4 R_SH_IMM_LOW16_PCREL gdata1\+0x0+c
+0+c4 R_SH_IMM_HI16_PCREL gdata5\+0x0+8
+0+c8 R_SH_IMM_MEDHI16_PCREL gdata5\+0x0+c
+0+cc R_SH_IMM_MEDLOW16_PCREL gdata5\+0x0+10
+0+d0 R_SH_IMM_LOW16_PCREL gdata5\+0x0+14
+0+e0 R_SH_IMM_HI16_PCREL gothertext1
+0+e4 R_SH_IMM_MEDHI16_PCREL gothertext1\+0x0+4
+0+e8 R_SH_IMM_MEDLOW16_PCREL gothertext1\+0x0+8
+0+ec R_SH_IMM_LOW16_PCREL gothertext1\+0x0+c
+0+fc R_SH_IMM_HI16_PCREL gothertext5\+0x0+8
+0+100 R_SH_IMM_MEDHI16_PCREL gothertext5\+0x0+c
+0+104 R_SH_IMM_MEDLOW16_PCREL gothertext5\+0x0+10
+0+108 R_SH_IMM_LOW16_PCREL gothertext5\+0x0+14
+
+Contents of section \.text:
+ 0000 cc0000a0 c80000a0 c80000a0 c80000a0 .*
+ 0010 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0020 c80000a0 c80000a0 c80000a0 cc0000a0 .*
+ 0030 cc0000a0 cc0000a0 cc0000a0 c80000a0 .*
+ 0040 c80000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 0050 cc0000a0 cc0000a0 c80000a0 c80000a0 .*
+ 0060 c80000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0070 cc0000a0 c80000a0 c80000a0 c80000a0 .*
+ 0080 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0090 c80000a0 c80000a0 c80000a0 cc0000a0 .*
+ 00a0 cc0000a0 cc0000a0 cc0000a0 c80000a0 .*
+ 00b0 c80000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 00c0 cc0000a0 cc0000a0 c80000a0 c80000a0 .*
+ 00d0 c80000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 00e0 cc0000a0 c80000a0 c80000a0 c80000a0 .*
+ 00f0 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0100 c80000a0 c80000a0 c80000a0 cc0000a0 .*
+ 0110 cc0000a0 cc0000a0 .*
+Contents of section \.data:
+ 0000 00000000 00000000 00000000 00000000 .*
+ 0010 00000000 00000000 00000000 00000000 .*
+ 0020 00000000 00000000 00000000 00000000 .*
+ 0030 00000000 00000000 00000000 00000000 .*
+ 0040 00000000 .*
+Contents of section \.othertext:
+ 0000 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0010 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0020 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0030 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0040 6ff0fff0 .*
diff --git a/gas/testsuite/gas/sh/sh64/rel64-4.d b/gas/testsuite/gas/sh/sh64/rel64-4.d
new file mode 100644
index 0000000..cc95cd9
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/rel64-4.d
@@ -0,0 +1,111 @@
+#as: --abi=64
+#objdump: -sr
+#source: rel-4.s
+#name: MOVI: PC+1-relative datalabel relocs, 64-bit ABI.
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET TYPE VALUE
+0+10 R_SH_IMM_LOW16_PCREL \.data\+0x0+7
+0+14 R_SH_IMM_LOW16_PCREL \.data\+0x0+b
+0+18 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+f
+0+2c R_SH_IMM_LOW16_PCREL \.data\+0x0+27
+0+30 R_SH_IMM_LOW16_PCREL \.data\+0x0+27
+0+34 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+23
+0+48 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+7
+0+4c R_SH_IMM_LOW16_PCREL \.othertext\+0x0+b
+0+50 R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+f
+0+64 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+27
+0+68 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+27
+0+6c R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+23
+0+80 R_SH_IMM_LOW16_PCREL extern2\+0xffffffffffffffff
+0+84 R_SH_IMM_LOW16_PCREL extern3\+0xffffffffffffffff
+0+88 R_SH_IMM_MEDLOW16_PCREL extern4\+0xffffffffffffffff
+0+9c R_SH_IMM_LOW16_PCREL extern6\+0x0+f
+0+a0 R_SH_IMM_LOW16_PCREL extern7\+0x0+b
+0+a4 R_SH_IMM_MEDLOW16_PCREL extern8\+0x0+3
+0+b8 R_SH_IMM_LOW16_PCREL gdata2\+0xffffffffffffffff
+0+bc R_SH_IMM_LOW16_PCREL gdata3\+0xffffffffffffffff
+0+c0 R_SH_IMM_MEDLOW16_PCREL gdata4\+0xffffffffffffffff
+0+d4 R_SH_IMM_LOW16_PCREL gdata6\+0x0+f
+0+d8 R_SH_IMM_LOW16_PCREL gdata7\+0x0+b
+0+dc R_SH_IMM_MEDLOW16_PCREL gdata8\+0x0+3
+0+f0 R_SH_IMM_LOW16_PCREL gothertext2\+0xffffffffffffffff
+0+f4 R_SH_IMM_LOW16_PCREL gothertext3\+0xffffffffffffffff
+0+f8 R_SH_IMM_MEDLOW16_PCREL gothertext4\+0xffffffffffffffff
+0+10c R_SH_IMM_LOW16_PCREL gothertext6\+0x0+f
+0+110 R_SH_IMM_LOW16_PCREL gothertext7\+0x0+b
+0+114 R_SH_IMM_MEDLOW16_PCREL gothertext8\+0x0+3
+0+ R_SH_IMM_HI16_PCREL \.data\+0x0+3
+0+4 R_SH_IMM_MEDHI16_PCREL \.data\+0x0+7
+0+8 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+b
+0+c R_SH_IMM_LOW16_PCREL \.data\+0x0+f
+0+1c R_SH_IMM_HI16_PCREL \.data\+0x0+1b
+0+20 R_SH_IMM_MEDHI16_PCREL \.data\+0x0+1f
+0+24 R_SH_IMM_MEDLOW16_PCREL \.data\+0x0+23
+0+28 R_SH_IMM_LOW16_PCREL \.data\+0x0+27
+0+38 R_SH_IMM_HI16_PCREL \.othertext\+0x0+3
+0+3c R_SH_IMM_MEDHI16_PCREL \.othertext\+0x0+7
+0+40 R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+b
+0+44 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+f
+0+54 R_SH_IMM_HI16_PCREL \.othertext\+0x0+1b
+0+58 R_SH_IMM_MEDHI16_PCREL \.othertext\+0x0+1f
+0+5c R_SH_IMM_MEDLOW16_PCREL \.othertext\+0x0+23
+0+60 R_SH_IMM_LOW16_PCREL \.othertext\+0x0+27
+0+70 R_SH_IMM_HI16_PCREL extern1\+0xffffffffffffffff
+0+74 R_SH_IMM_MEDHI16_PCREL extern1\+0x0+3
+0+78 R_SH_IMM_MEDLOW16_PCREL extern1\+0x0+7
+0+7c R_SH_IMM_LOW16_PCREL extern1\+0x0+b
+0+8c R_SH_IMM_HI16_PCREL extern5\+0x0+7
+0+90 R_SH_IMM_MEDHI16_PCREL extern5\+0x0+b
+0+94 R_SH_IMM_MEDLOW16_PCREL extern5\+0x0+f
+0+98 R_SH_IMM_LOW16_PCREL extern5\+0x0+13
+0+a8 R_SH_IMM_HI16_PCREL gdata1\+0xffffffffffffffff
+0+ac R_SH_IMM_MEDHI16_PCREL gdata1\+0x0+3
+0+b0 R_SH_IMM_MEDLOW16_PCREL gdata1\+0x0+7
+0+b4 R_SH_IMM_LOW16_PCREL gdata1\+0x0+b
+0+c4 R_SH_IMM_HI16_PCREL gdata5\+0x0+7
+0+c8 R_SH_IMM_MEDHI16_PCREL gdata5\+0x0+b
+0+cc R_SH_IMM_MEDLOW16_PCREL gdata5\+0x0+f
+0+d0 R_SH_IMM_LOW16_PCREL gdata5\+0x0+13
+0+e0 R_SH_IMM_HI16_PCREL gothertext1\+0xffffffffffffffff
+0+e4 R_SH_IMM_MEDHI16_PCREL gothertext1\+0x0+3
+0+e8 R_SH_IMM_MEDLOW16_PCREL gothertext1\+0x0+7
+0+ec R_SH_IMM_LOW16_PCREL gothertext1\+0x0+b
+0+fc R_SH_IMM_HI16_PCREL gothertext5\+0x0+7
+0+100 R_SH_IMM_MEDHI16_PCREL gothertext5\+0x0+b
+0+104 R_SH_IMM_MEDLOW16_PCREL gothertext5\+0x0+f
+0+108 R_SH_IMM_LOW16_PCREL gothertext5\+0x0+13
+
+Contents of section \.text:
+ 0000 cc0000a0 c80000a0 c80000a0 c80000a0 .*
+ 0010 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0020 c80000a0 c80000a0 c80000a0 cc0000a0 .*
+ 0030 cc0000a0 cc0000a0 cc0000a0 c80000a0 .*
+ 0040 c80000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 0050 cc0000a0 cc0000a0 c80000a0 c80000a0 .*
+ 0060 c80000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0070 cc0000a0 c80000a0 c80000a0 c80000a0 .*
+ 0080 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0090 c80000a0 c80000a0 c80000a0 cc0000a0 .*
+ 00a0 cc0000a0 cc0000a0 cc0000a0 c80000a0 .*
+ 00b0 c80000a0 c80000a0 cc0000a0 cc0000a0 .*
+ 00c0 cc0000a0 cc0000a0 c80000a0 c80000a0 .*
+ 00d0 c80000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 00e0 cc0000a0 c80000a0 c80000a0 c80000a0 .*
+ 00f0 cc0000a0 cc0000a0 cc0000a0 cc0000a0 .*
+ 0100 c80000a0 c80000a0 c80000a0 cc0000a0 .*
+ 0110 cc0000a0 cc0000a0 .*
+Contents of section \.data:
+ 0000 00000000 00000000 00000000 00000000 .*
+ 0010 00000000 00000000 00000000 00000000 .*
+ 0020 00000000 00000000 00000000 00000000 .*
+ 0030 00000000 00000000 00000000 00000000 .*
+ 0040 00000000 .*
+Contents of section \.othertext:
+ 0000 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0010 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0020 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0030 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0040 6ff0fff0 .*
diff --git a/gas/testsuite/gas/sh/sh64/rel64-5.d b/gas/testsuite/gas/sh/sh64/rel64-5.d
new file mode 100644
index 0000000..db41915
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/rel64-5.d
@@ -0,0 +1,40 @@
+#as: --abi=64
+#objdump: -sr
+#source: rel-5.s
+#name: MOVI: PC-relative reloc within .text, 64-bit ABI.
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET TYPE VALUE
+0+5c R_SH_IMM_LOW16_PCREL gstart6\+0x0+18
+0+60 R_SH_IMM_MEDLOW16_PCREL gstart7\+0x0+20
+0+1c R_SH_IMM_HI16_PCREL gstart2\+0x0+8
+0+20 R_SH_IMM_MEDHI16_PCREL gstart2\+0x0+c
+0+24 R_SH_IMM_MEDLOW16_PCREL gstart2\+0x0+10
+0+28 R_SH_IMM_LOW16_PCREL gstart2\+0x0+14
+0+2c R_SH_IMM_HI16_PCREL gstart3\+0x0+3
+0+30 R_SH_IMM_MEDHI16_PCREL gstart3\+0x0+7
+0+34 R_SH_IMM_MEDLOW16_PCREL gstart3\+0x0+b
+0+38 R_SH_IMM_LOW16_PCREL gstart3\+0x0+f
+0+3c R_SH_IMM_HI16_PCREL gstart4\+0x0+8
+0+40 R_SH_IMM_MEDHI16_PCREL gstart4\+0x0+c
+0+44 R_SH_IMM_MEDLOW16_PCREL gstart4\+0x0+10
+0+48 R_SH_IMM_LOW16_PCREL gstart4\+0x0+14
+0+4c R_SH_IMM_HI16_PCREL gstart5\+0x0+b
+0+50 R_SH_IMM_MEDHI16_PCREL gstart5\+0x0+f
+0+54 R_SH_IMM_MEDLOW16_PCREL gstart5\+0x0+13
+0+58 R_SH_IMM_LOW16_PCREL gstart5\+0x0+17
+
+Contents of section \.text:
+ 0000 6ff0fff0 cc01a5e0 cc0191e0 cc01a1e0 .*
+ 0010 cc01ade0 cc01e280 cc000320 cc0001e0 .*
+ 0020 c80001e0 c80001e0 c80001e0 cc0001e0 .*
+ 0030 c80001e0 c80001e0 c80001e0 cc0001e0 .*
+ 0040 c80001e0 c80001e0 c80001e0 cc0001e0 .*
+ 0050 c80001e0 c80001e0 c80001e0 cc000280 .*
+ 0060 cc000320 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0070 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0080 6ff0fff0 6ff0fff0 6ff0fff0 6ff0fff0 .*
+ 0090 6ff0fff0 .*
+Contents of section \.data:
diff --git a/gas/testsuite/gas/sh/sh64/relax-1.d b/gas/testsuite/gas/sh/sh64/relax-1.d
new file mode 100644
index 0000000..97cdd68
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/relax-1.d
@@ -0,0 +1,30 @@
+#as: --abi=64
+#objdump: -dr
+#source: relax-1.s
+#name: Assembler PT relaxation limit, from first to second state.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+
+0+4 <start2>:
+[ ]+4:[ ]+cc000990[ ]+movi 2,r25
+[ ]+8:[ ]+c8000590[ ]+shori 1,r25
+[ ]+c:[ ]+6bf56630[ ]+ptrel/l r25,tr3
+
+0+10 <x1>:
+[ ]+10:[ ]+e9fffe40[ ]+pta/l 2000c <x0>,tr4
+[ ]+\.\.\.
+
+0+2000c <x0>:
+[ ]+2000c:[ ]+ea000650[ ]+pta/l 10 <x1>,tr5
+[ ]+20010:[ ]+ea000260[ ]+pta/l 10 <x1>,tr6
+[ ]+20014:[ ]+cffff590[ ]+movi -3,r25
+[ ]+20018:[ ]+cbffd590[ ]+shori 65525,r25
+[ ]+2001c:[ ]+6bf56660[ ]+ptrel/l r25,tr6
+[ ]+20020:[ ]+cffff590[ ]+movi -3,r25
+[ ]+20024:[ ]+cbffa590[ ]+shori 65513,r25
+[ ]+20028:[ ]+6bf56670[ ]+ptrel/l r25,tr7
diff --git a/gas/testsuite/gas/sh/sh64/relax-1.s b/gas/testsuite/gas/sh/sh64/relax-1.s
new file mode 100644
index 0000000..807b236
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/relax-1.s
@@ -0,0 +1,18 @@
+! Check limits of PT assembler relaxation states. Unfortunately, we can't
+! check the 32 and 48 bit limit on a host with 32-bit longs, so we just
+! check the first state. This also checks that a PT expansion without a
+! relocation to 32 bits works.
+
+ .mode SHmedia
+start:
+ nop
+start2:
+ pt x0,tr3
+x1:
+ pt x0,tr4
+ .space 32767*4-4,0
+x0:
+ pt x1,tr5
+ pt x1,tr6
+ pt x1,tr6
+ pt x1,tr7
diff --git a/gas/testsuite/gas/sh/sh64/relax-2.d b/gas/testsuite/gas/sh/sh64/relax-2.d
new file mode 100644
index 0000000..4280f44
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/relax-2.d
@@ -0,0 +1,30 @@
+#as: --abi=64
+#objdump: -dr
+#source: relax-2.s
+#name: Assembler PTB relaxation limit, from first to second state.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+
+0+4 <start2>:
+[ ]+4:[ ]+cc000990[ ]+movi 2,r25
+[ ]+8:[ ]+c8000190[ ]+shori 0,r25
+[ ]+c:[ ]+6bf56630[ ]+ptrel/l r25,tr3
+
+0+10 <[ax]1>:
+[ ]+10:[ ]+edfffe40[ ]+ptb/l 2000c <[ax]0>,tr4
+[ ]+\.\.\.
+
+0+2000c <[ax]0>:
+[ ]+2000c:[ ]+ee000650[ ]+ptb/l 10 <[ax]1>,tr5
+[ ]+20010:[ ]+ee000260[ ]+ptb/l 10 <[ax]1>,tr6
+[ ]+20014:[ ]+cffff590[ ]+movi -3,r25
+[ ]+20018:[ ]+cbffd190[ ]+shori 65524,r25
+[ ]+2001c:[ ]+6bf56660[ ]+ptrel/l r25,tr6
+[ ]+20020:[ ]+cffff590[ ]+movi -3,r25
+[ ]+20024:[ ]+cbffa190[ ]+shori 65512,r25
+[ ]+20028:[ ]+6bf56670[ ]+ptrel/l r25,tr7
diff --git a/gas/testsuite/gas/sh/sh64/relax-2.s b/gas/testsuite/gas/sh/sh64/relax-2.s
new file mode 100644
index 0000000..9d3a323
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/relax-2.s
@@ -0,0 +1,23 @@
+! Check relaxation for PTB. This is like relax-1.s, but presumably we can
+! have bugs in the slight differences in limit-checking compared to PT and
+! PTA.
+
+ .mode SHmedia
+start:
+ nop
+start2:
+ ptb x0,tr3
+ .mode SHcompact
+x1:
+ .mode SHmedia
+a1:
+ ptb x0,tr4
+ .space 32767*4-4,0
+ .mode SHcompact
+x0:
+ .mode SHmedia
+a0:
+ ptb x1,tr5
+ ptb x1,tr6
+ ptb x1,tr6
+ ptb x1,tr7
diff --git a/gas/testsuite/gas/sh/sh64/relax-3.d b/gas/testsuite/gas/sh/sh64/relax-3.d
new file mode 100644
index 0000000..b0a93b2
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/relax-3.d
@@ -0,0 +1,43 @@
+#as: --abi=64
+#objdump: -dr
+#source: relax-3.s
+#name: Assembler PC-rel MOVI relaxation limit, from first to second state.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+6ff0fff0[ ]+nop
+
+0+4 <start2>:
+[ ]+4:[ ]+cc000030[ ]+movi 0,r3
+[ ]+8:[ ]+ca001030[ ]+shori 32772,r3
+
+0+c <x1>:
+[ ]+c:[ ]+cdfffc40[ ]+movi 32767,r4
+[ ]+\.\.\.
+
+0+800c <x0>:
+[ ]+800c:[ ]+ce000050[ ]+movi -32768,r5
+[ ]+8010:[ ]+cffffc60[ ]+movi -1,r6
+[ ]+8014:[ ]+c9fffc60[ ]+shori 32767,r6
+[ ]+8018:[ ]+cffffc70[ ]+movi -1,r7
+[ ]+801c:[ ]+cbfffc70[ ]+shori 65535,r7
+[ ]+8020:[ ]+cbfffc70[ ]+shori 65535,r7
+[ ]+8024:[ ]+ca000070[ ]+shori 32768,r7
+[ ]+8028:[ ]+cc000080[ ]+movi 0,r8
+[ ]+802c:[ ]+c8000080[ ]+shori 0,r8
+[ ]+8030:[ ]+c8000080[ ]+shori 0,r8
+[ ]+8034:[ ]+c9fffc80[ ]+shori 32767,r8
+[ ]+8038:[ ]+cc000080[ ]+movi 0,r8
+[ ]+803c:[ ]+c8000080[ ]+shori 0,r8
+[ ]+8040:[ ]+c8000080[ ]+shori 0,r8
+[ ]+8044:[ ]+c8004080[ ]+shori 16,r8
+Disassembly of section \.text\.another:
+
+0+ <y0>:
+[ ]+0:[ ]+cc000090[ ]+movi 0,r9
+[ ]+4:[ ]+c8000090[ ]+shori 0,r9
+[ ]+8:[ ]+c8000090[ ]+shori 0,r9
+[ ]+c:[ ]+c8002090[ ]+shori 8,r9
diff --git a/gas/testsuite/gas/sh/sh64/relax-3.s b/gas/testsuite/gas/sh/sh64/relax-3.s
new file mode 100644
index 0000000..b2ec30a
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/relax-3.s
@@ -0,0 +1,32 @@
+! Check relaxation for MOVI PC-relative expansions. Unfortunately, we
+! can't check the 32 and 48 bit limit on a host with 32-bit longs, so we
+! just check going from first state to the second state.
+
+ .mode SHmedia
+ .text
+start:
+ nop
+start2:
+ movi (x0-4-$),r3
+x1:
+ movi (x0-1-$),r4
+ .space 32768-4,0
+x0:
+ movi (x1-$),r5
+ movi (x1+3-$),r6
+
+! These PC-relative expressions are here because of past bugs leading to
+! premature symbol evaluation and assignment when they were exposed to
+! relaxation.
+! The expected result may need future tweaking if advances are done in
+! relaxation. At the time of this writing the expressions are not
+! relaxed although the numbers will be in the right range finally.
+
+ movi (x1-x0),r7
+ movi (x0-1-x1),r8
+ movi (y1-y0),r8
+
+ .section .text.another,"ax"
+y0:
+ movi (x1-start2),r9
+y1:
diff --git a/gas/testsuite/gas/sh/sh64/sh64.exp b/gas/testsuite/gas/sh/sh64/sh64.exp
new file mode 100644
index 0000000..70e72a2
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/sh64.exp
@@ -0,0 +1,27 @@
+# Copyright (C) 2000 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# DejaGnu@cygnus.com
+
+if [istarget sh64-*-*] then {
+ set rd_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+ foreach rdtest $rd_test_list {
+ # We need to strip the ".d", but can leave the dirname.
+ verbose [file rootname $rdtest]
+ run_dump_test [file rootname $rdtest]
+ }
+}
diff --git a/gas/testsuite/gas/sh/sh64/shift-1.s b/gas/testsuite/gas/sh/sh64/shift-1.s
new file mode 100644
index 0000000..b4967c7
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/shift-1.s
@@ -0,0 +1,42 @@
+! Check that shift expressions translate to the proper reloc for MOVI and
+! SHORI for local and external symbols. This is the 32-bit subset.
+ .text
+ .mode SHmedia
+start:
+ movi localsym & 65535,r4
+ movi (localsym >> 0) & 65535,r4
+ movi (localsym >> 16) & 65535,r4
+
+ movi externsym & 65535,r4
+ movi (externsym >> 0) & 65535,r4
+ movi (externsym >> 16) & 65535,r4
+
+ shori localsym & 65535,r4
+ shori (localsym >> 0) & 65535,r4
+ shori (localsym >> 16) & 65535,r4
+
+ shori externsym & 65535,r4
+ shori (externsym >> 0) & 65535,r4
+ shori (externsym >> 16) & 65535,r4
+
+ movi (localsym + 42) & 65535,r4
+ movi ((localsym + 43) >> 0) & 65535,r4
+ movi ((localsym + 44) >> 16) & 65535,r4
+
+ movi (externsym + 45) & 65535,r4
+ movi ((externsym + 46) >> 0) & 65535,r4
+ movi ((externsym + 47) >> 16) & 65535,r4
+
+ shori (localsym + 42) & 65535,r4
+ shori ((localsym + 43) >> 0) & 65535,r4
+ shori ((localsym + 44) >> 16) & 65535,r4
+
+ shori (externsym + 45) & 65535,r4
+ shori ((externsym + 46) >> 0) & 65535,r4
+ shori ((externsym + 47) >> 16) & 65535,r4
+
+ .data
+! Just make localsym have a non-zero offset into .data.
+ .long 0
+localsym:
+ .long 0
diff --git a/gas/testsuite/gas/sh/sh64/shift-2.s b/gas/testsuite/gas/sh/sh64/shift-2.s
new file mode 100644
index 0000000..082ea37
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/shift-2.s
@@ -0,0 +1,34 @@
+! Check that shift expressions translate to the proper reloc for MOVI and
+! SHORI for local and external symbols. This is the 64-bit subset.
+ .text
+ .mode SHmedia
+start:
+ movi (localsym >> 32) & 65535,r4
+ movi (localsym >> 48) & 65535,r4
+
+ movi ((localsym + 44) >> 32) & 65535,r4
+ movi ((localsym + 43) >> 48) & 65535,r4
+
+ movi (externsym >> 32) & 65535,r4
+ movi (externsym >> 48) & 65535,r4
+
+ movi ((externsym + 41) >> 32) & 65535,r4
+ movi ((externsym + 42) >> 48) & 65535,r4
+
+ shori (localsym >> 32) & 65535,r4
+ shori (localsym >> 48) & 65535,r4
+
+ shori ((localsym + 44) >> 32) & 65535,r4
+ shori ((localsym + 43) >> 48) & 65535,r4
+
+ shori (externsym >> 32) & 65535,r4
+ shori (externsym >> 48) & 65535,r4
+
+ shori ((externsym + 41) >> 32) & 65535,r4
+ shori ((externsym + 42) >> 48) & 65535,r4
+
+ .data
+! Just make localsym have a non-zero offset into .data.
+ .long 0
+localsym:
+ .long 0
diff --git a/gas/testsuite/gas/sh/sh64/shift-3.s b/gas/testsuite/gas/sh/sh64/shift-3.s
new file mode 100644
index 0000000..6d9bff3
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/shift-3.s
@@ -0,0 +1,7 @@
+! This should not get an internal error and it should emit the expected
+! relocs, even though the symbol looks local and is undefined.
+ .text
+ .mode SHmedia
+start:
+ movi .LC0 & 65535, r1
+ movi (.LC0 >> 16) & 65535, r3
diff --git a/gas/testsuite/gas/sh/sh64/shift32-1.d b/gas/testsuite/gas/sh/sh64/shift32-1.d
new file mode 100644
index 0000000..8e1d428
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/shift32-1.d
@@ -0,0 +1,58 @@
+#as: --abi=32
+#objdump: -dr
+#source: shift-1.s
+#name: Shift expressions, 32-bit ABI.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+cc000040[ ]+movi 0,r4
+[ ]+0:[ ]+R_SH_IMM_LOW16 \.data\+0x4
+[ ]+4:[ ]+cc000040[ ]+movi 0,r4
+[ ]+4:[ ]+R_SH_IMM_LOW16 \.data\+0x4
+[ ]+8:[ ]+cc000040[ ]+movi 0,r4
+[ ]+8:[ ]+R_SH_IMM_MEDLOW16 \.data\+0x4
+[ ]+c:[ ]+cc000040[ ]+movi 0,r4
+[ ]+c:[ ]+R_SH_IMM_LOW16 externsym
+[ ]+10:[ ]+cc000040[ ]+movi 0,r4
+[ ]+10:[ ]+R_SH_IMM_LOW16 externsym
+[ ]+14:[ ]+cc000040[ ]+movi 0,r4
+[ ]+14:[ ]+R_SH_IMM_MEDLOW16 externsym
+[ ]+18:[ ]+c8000040[ ]+shori 0,r4
+[ ]+18:[ ]+R_SH_IMM_LOW16 \.data\+0x4
+[ ]+1c:[ ]+c8000040[ ]+shori 0,r4
+[ ]+1c:[ ]+R_SH_IMM_LOW16 \.data\+0x4
+[ ]+20:[ ]+c8000040[ ]+shori 0,r4
+[ ]+20:[ ]+R_SH_IMM_MEDLOW16 \.data\+0x4
+[ ]+24:[ ]+c8000040[ ]+shori 0,r4
+[ ]+24:[ ]+R_SH_IMM_LOW16 externsym
+[ ]+28:[ ]+c8000040[ ]+shori 0,r4
+[ ]+28:[ ]+R_SH_IMM_LOW16 externsym
+[ ]+2c:[ ]+c8000040[ ]+shori 0,r4
+[ ]+2c:[ ]+R_SH_IMM_MEDLOW16 externsym
+[ ]+30:[ ]+cc000040[ ]+movi 0,r4
+[ ]+30:[ ]+R_SH_IMM_LOW16 \.data\+0x2e
+[ ]+34:[ ]+cc000040[ ]+movi 0,r4
+[ ]+34:[ ]+R_SH_IMM_LOW16 \.data\+0x2f
+[ ]+38:[ ]+cc000040[ ]+movi 0,r4
+[ ]+38:[ ]+R_SH_IMM_MEDLOW16 \.data\+0x30
+[ ]+3c:[ ]+cc000040[ ]+movi 0,r4
+[ ]+3c:[ ]+R_SH_IMM_LOW16 externsym\+0x2d
+[ ]+40:[ ]+cc000040[ ]+movi 0,r4
+[ ]+40:[ ]+R_SH_IMM_LOW16 externsym\+0x2e
+[ ]+44:[ ]+cc000040[ ]+movi 0,r4
+[ ]+44:[ ]+R_SH_IMM_MEDLOW16 externsym\+0x2f
+[ ]+48:[ ]+c8000040[ ]+shori 0,r4
+[ ]+48:[ ]+R_SH_IMM_LOW16 \.data\+0x2e
+[ ]+4c:[ ]+c8000040[ ]+shori 0,r4
+[ ]+4c:[ ]+R_SH_IMM_LOW16 \.data\+0x2f
+[ ]+50:[ ]+c8000040[ ]+shori 0,r4
+[ ]+50:[ ]+R_SH_IMM_MEDLOW16 \.data\+0x30
+[ ]+54:[ ]+c8000040[ ]+shori 0,r4
+[ ]+54:[ ]+R_SH_IMM_LOW16 externsym\+0x2d
+[ ]+58:[ ]+c8000040[ ]+shori 0,r4
+[ ]+58:[ ]+R_SH_IMM_LOW16 externsym\+0x2e
+[ ]+5c:[ ]+c8000040[ ]+shori 0,r4
+[ ]+5c:[ ]+R_SH_IMM_MEDLOW16 externsym\+0x2f
diff --git a/gas/testsuite/gas/sh/sh64/shift32-3.d b/gas/testsuite/gas/sh/sh64/shift32-3.d
new file mode 100644
index 0000000..e952705
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/shift32-3.d
@@ -0,0 +1,14 @@
+#as: --abi=32
+#objdump: -dr
+#source: shift-3.s
+#name: Shift expression, local but undefined symbol, 32-bit ABI.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+cc000010[ ]+movi 0,r1
+[ ]+0:[ ]+R_SH_IMM_LOW16 \.LC0
+[ ]+4:[ ]+cc000030[ ]+movi 0,r3
+[ ]+4:[ ]+R_SH_IMM_MEDLOW16 \.LC0
diff --git a/gas/testsuite/gas/sh/sh64/shift32-noexp-3.d b/gas/testsuite/gas/sh/sh64/shift32-noexp-3.d
new file mode 100644
index 0000000..0a965f1
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/shift32-noexp-3.d
@@ -0,0 +1,14 @@
+#as: --abi=32 -no-expand
+#objdump: -dr
+#source: shift-3.s
+#name: Shift expression, local but undefined symbol, 32-bit ABI with -no-expand.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+cc000010[ ]+movi 0,r1
+[ ]+0:[ ]+R_SH_IMM_LOW16 \.LC0
+[ ]+4:[ ]+cc000030[ ]+movi 0,r3
+[ ]+4:[ ]+R_SH_IMM_MEDLOW16 \.LC0
diff --git a/gas/testsuite/gas/sh/sh64/shift64-1.d b/gas/testsuite/gas/sh/sh64/shift64-1.d
new file mode 100644
index 0000000..2d85ac0
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/shift64-1.d
@@ -0,0 +1,58 @@
+#as: --abi=64
+#objdump: -dr
+#source: shift-1.s
+#name: Shift expressions, 64-bit ABI, 32-bit subset.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+cc000040[ ]+movi 0,r4
+[ ]+0:[ ]+R_SH_IMM_LOW16 \.data\+0x4
+[ ]+4:[ ]+cc000040[ ]+movi 0,r4
+[ ]+4:[ ]+R_SH_IMM_LOW16 \.data\+0x4
+[ ]+8:[ ]+cc000040[ ]+movi 0,r4
+[ ]+8:[ ]+R_SH_IMM_MEDLOW16 \.data\+0x4
+[ ]+c:[ ]+cc000040[ ]+movi 0,r4
+[ ]+c:[ ]+R_SH_IMM_LOW16 externsym
+[ ]+10:[ ]+cc000040[ ]+movi 0,r4
+[ ]+10:[ ]+R_SH_IMM_LOW16 externsym
+[ ]+14:[ ]+cc000040[ ]+movi 0,r4
+[ ]+14:[ ]+R_SH_IMM_MEDLOW16 externsym
+[ ]+18:[ ]+c8000040[ ]+shori 0,r4
+[ ]+18:[ ]+R_SH_IMM_LOW16 \.data\+0x4
+[ ]+1c:[ ]+c8000040[ ]+shori 0,r4
+[ ]+1c:[ ]+R_SH_IMM_LOW16 \.data\+0x4
+[ ]+20:[ ]+c8000040[ ]+shori 0,r4
+[ ]+20:[ ]+R_SH_IMM_MEDLOW16 \.data\+0x4
+[ ]+24:[ ]+c8000040[ ]+shori 0,r4
+[ ]+24:[ ]+R_SH_IMM_LOW16 externsym
+[ ]+28:[ ]+c8000040[ ]+shori 0,r4
+[ ]+28:[ ]+R_SH_IMM_LOW16 externsym
+[ ]+2c:[ ]+c8000040[ ]+shori 0,r4
+[ ]+2c:[ ]+R_SH_IMM_MEDLOW16 externsym
+[ ]+30:[ ]+cc000040[ ]+movi 0,r4
+[ ]+30:[ ]+R_SH_IMM_LOW16 \.data\+0x2e
+[ ]+34:[ ]+cc000040[ ]+movi 0,r4
+[ ]+34:[ ]+R_SH_IMM_LOW16 \.data\+0x2f
+[ ]+38:[ ]+cc000040[ ]+movi 0,r4
+[ ]+38:[ ]+R_SH_IMM_MEDLOW16 \.data\+0x30
+[ ]+3c:[ ]+cc000040[ ]+movi 0,r4
+[ ]+3c:[ ]+R_SH_IMM_LOW16 externsym\+0x2d
+[ ]+40:[ ]+cc000040[ ]+movi 0,r4
+[ ]+40:[ ]+R_SH_IMM_LOW16 externsym\+0x2e
+[ ]+44:[ ]+cc000040[ ]+movi 0,r4
+[ ]+44:[ ]+R_SH_IMM_MEDLOW16 externsym\+0x2f
+[ ]+48:[ ]+c8000040[ ]+shori 0,r4
+[ ]+48:[ ]+R_SH_IMM_LOW16 \.data\+0x2e
+[ ]+4c:[ ]+c8000040[ ]+shori 0,r4
+[ ]+4c:[ ]+R_SH_IMM_LOW16 \.data\+0x2f
+[ ]+50:[ ]+c8000040[ ]+shori 0,r4
+[ ]+50:[ ]+R_SH_IMM_MEDLOW16 \.data\+0x30
+[ ]+54:[ ]+c8000040[ ]+shori 0,r4
+[ ]+54:[ ]+R_SH_IMM_LOW16 externsym\+0x2d
+[ ]+58:[ ]+c8000040[ ]+shori 0,r4
+[ ]+58:[ ]+R_SH_IMM_LOW16 externsym\+0x2e
+[ ]+5c:[ ]+c8000040[ ]+shori 0,r4
+[ ]+5c:[ ]+R_SH_IMM_MEDLOW16 externsym\+0x2f
diff --git a/gas/testsuite/gas/sh/sh64/shift64-2.d b/gas/testsuite/gas/sh/sh64/shift64-2.d
new file mode 100644
index 0000000..65fdedc
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/shift64-2.d
@@ -0,0 +1,42 @@
+#as: --abi=64
+#objdump: -dr
+#source: shift-2.s
+#name: Shift expressions, 64-bit ABI, 64-bit subset.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+cc000040[ ]+movi 0,r4
+[ ]+0:[ ]+R_SH_IMM_MEDHI16 \.data\+0x4
+[ ]+4:[ ]+cc000040[ ]+movi 0,r4
+[ ]+4:[ ]+R_SH_IMM_HI16 \.data\+0x4
+[ ]+8:[ ]+cc000040[ ]+movi 0,r4
+[ ]+8:[ ]+R_SH_IMM_MEDHI16 \.data\+0x30
+[ ]+c:[ ]+cc000040[ ]+movi 0,r4
+[ ]+c:[ ]+R_SH_IMM_HI16 \.data\+0x2f
+[ ]+10:[ ]+cc000040[ ]+movi 0,r4
+[ ]+10:[ ]+R_SH_IMM_MEDHI16 externsym
+[ ]+14:[ ]+cc000040[ ]+movi 0,r4
+[ ]+14:[ ]+R_SH_IMM_HI16 externsym
+[ ]+18:[ ]+cc000040[ ]+movi 0,r4
+[ ]+18:[ ]+R_SH_IMM_MEDHI16 externsym\+0x29
+[ ]+1c:[ ]+cc000040[ ]+movi 0,r4
+[ ]+1c:[ ]+R_SH_IMM_HI16 externsym\+0x2a
+[ ]+20:[ ]+c8000040[ ]+shori 0,r4
+[ ]+20:[ ]+R_SH_IMM_MEDHI16 \.data\+0x4
+[ ]+24:[ ]+c8000040[ ]+shori 0,r4
+[ ]+24:[ ]+R_SH_IMM_HI16 \.data\+0x4
+[ ]+28:[ ]+c8000040[ ]+shori 0,r4
+[ ]+28:[ ]+R_SH_IMM_MEDHI16 \.data\+0x30
+[ ]+2c:[ ]+c8000040[ ]+shori 0,r4
+[ ]+2c:[ ]+R_SH_IMM_HI16 \.data\+0x2f
+[ ]+30:[ ]+c8000040[ ]+shori 0,r4
+[ ]+30:[ ]+R_SH_IMM_MEDHI16 externsym
+[ ]+34:[ ]+c8000040[ ]+shori 0,r4
+[ ]+34:[ ]+R_SH_IMM_HI16 externsym
+[ ]+38:[ ]+c8000040[ ]+shori 0,r4
+[ ]+38:[ ]+R_SH_IMM_MEDHI16 externsym\+0x29
+[ ]+3c:[ ]+c8000040[ ]+shori 0,r4
+[ ]+3c:[ ]+R_SH_IMM_HI16 externsym\+0x2a
diff --git a/gas/testsuite/gas/sh/sh64/shift64-3.d b/gas/testsuite/gas/sh/sh64/shift64-3.d
new file mode 100644
index 0000000..c7df151
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/shift64-3.d
@@ -0,0 +1,14 @@
+#as: --abi=64
+#objdump: -dr
+#source: shift-3.s
+#name: Shift expression, local but undefined symbol, 64-bit ABI.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+cc000010[ ]+movi 0,r1
+[ ]+0:[ ]+R_SH_IMM_LOW16 \.LC0
+[ ]+4:[ ]+cc000030[ ]+movi 0,r3
+[ ]+4:[ ]+R_SH_IMM_MEDLOW16 \.LC0
diff --git a/gas/testsuite/gas/sh/sh64/shift64-noexp-3.d b/gas/testsuite/gas/sh/sh64/shift64-noexp-3.d
new file mode 100644
index 0000000..5addd56
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/shift64-noexp-3.d
@@ -0,0 +1,14 @@
+#as: --abi=64 -no-expand
+#objdump: -dr
+#source: shift-3.s
+#name: Shift expression, local but undefined symbol, 64-bit ABI with -no-expand.
+
+.*: file format .*-sh64
+
+Disassembly of section \.text:
+
+[0]+ <start>:
+[ ]+0:[ ]+cc000010[ ]+movi 0,r1
+[ ]+0:[ ]+R_SH_IMM_LOW16 \.LC0
+[ ]+4:[ ]+cc000030[ ]+movi 0,r3
+[ ]+4:[ ]+R_SH_IMM_MEDLOW16 \.LC0
diff --git a/gas/testsuite/gas/sh/sh64/syntax-1.d b/gas/testsuite/gas/sh/sh64/syntax-1.d
new file mode 100644
index 0000000..1134819
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/syntax-1.d
@@ -0,0 +1,157 @@
+#as: --isa=shmedia --no-exp
+#objdump: -d
+#name: Minimum SH64 Syntax Support.
+
+.*: file format elf64-sh64
+
+Disassembly of section .text:
+
+0000000000000000 <.*>:
+ 0: 88100410 ld.l r1,4,r1
+ 4: 88100410 ld.l r1,4,r1
+ 8: e8003a00 pta/l 40 <.*>,tr0
+ c: e8003600 pta/l 40 <.*>,tr0
+ 10: e8003000 pta/u 40 <.*>,tr0
+ 14: e8002c00 pta/u 40 <.*>,tr0
+ 18: e8002a00 pta/l 40 <.*>,tr0
+ 1c: e8002600 pta/l 40 <.*>,tr0
+ 20: ec002000 ptb/u 40 <.*>,tr0
+ 24: ec001c00 ptb/u 40 <.*>,tr0
+ 28: ec001a00 ptb/l 40 <.*>,tr0
+ 2c: ec001600 ptb/l 40 <.*>,tr0
+ 30: e8001200 pta/l 40 <.*>,tr0
+ 34: e8000e00 pta/l 40 <.*>,tr0
+ 38: ec000a00 ptb/l 40 <.*>,tr0
+ 3c: ec000600 ptb/l 40 <.*>,tr0
+ 40: 040983f0 or r0,r32,r63
+ 44: 240ffc00 getcon sr,r0
+ 48: 27fffc00 getcon usr,r0
+ 4c: 4405fc00 gettr tr0,r0
+ 50: 4475fc00 gettr tr7,r0
+ 54: 380003f0 fmov.s fr0,fr63
+ 58: 380103e0 fmov.d dr0,dr62
+ 5c: 140e0000 ftrv.s mtrx0,fv0,fv0
+ 60: 170ef3c0 ftrv.s mtrx48,fv60,fv60
+ 64: 240ffc00 getcon sr,r0
+ 68: 241ffc00 getcon ssr,r0
+ 6c: 242ffc00 getcon pssr,r0
+ 70: 244ffc00 getcon intevt,r0
+ 74: 245ffc00 getcon expevt,r0
+ 78: 246ffc00 getcon pexpevt,r0
+ 7c: 247ffc00 getcon tra,r0
+ 80: 248ffc00 getcon spc,r0
+ 84: 249ffc00 getcon pspc,r0
+ 88: 24affc00 getcon resvec,r0
+ 8c: 24bffc00 getcon vbr,r0
+ 90: 24dffc00 getcon tea,r0
+ 94: 250ffc00 getcon dcr,r0
+ 98: 251ffc00 getcon kcr0,r0
+ 9c: 252ffc00 getcon kcr1,r0
+ a0: 27effc00 getcon ctc,r0
+ a4: 27fffc00 getcon usr,r0
+
+00000000000000a8 <.*>:
+ a8: e0 04 mov #4,r0
+ aa: 00 09 nop
+
+00000000000000ac <.*>:
+ ac: cc001000 movi 4,r0
+
+00000000000000b0 <.*>:
+ b0: 50 02 mov.l @\(8,r0\),r0
+ b2: 00 09 nop
+
+00000000000000b4 <.*>:
+ b4: b0000400 ld.uw r0,2,r0
+ b8: 84000400 ld.w r0,2,r0
+ bc: a4000400 st.w r0,2,r0
+ c0: 88000400 ld.l r0,4,r0
+ c4: a8000400 st.l r0,4,r0
+ c8: 94000400 fld.s r0,4,fr0
+ cc: b4000400 fst.s r0,4,fr0
+ d0: e8000600 pta/l d4 <.*>,tr0
+ d4: ec000a00 ptb/l dc <.*>,tr0
+ d8: 8c000400 ld.q r0,8,r0
+ dc: ac000400 st.q r0,8,r0
+ e0: 9c000400 fld.d r0,8,dr0
+ e4: bc000400 fst.d r0,8,dr0
+ e8: 98000400 fld.p r0,8,fp0
+ ec: b8000400 fst.p r0,8,fp0
+ f0: e00407f0 alloco r0,32
+ f4: e00507f0 icbi r0,32
+ f8: e00907f0 ocbi r0,32
+ fc: e00807f0 ocbp r0,32
+ 100: e00c07f0 ocbwb r0,32
+ 104: e00107f0 prefi r0,32
+
+0000000000000108 <.*>:
+ 108: 90 01 mov.w 10e <.*>,r0 ! 0x8101
+ 10a: 85 01 mov.w @\(2,r0\),r0
+ 10c: c5 01 mov.w @\(2,gbr\),r0
+ 10e: 81 01 mov.w r0,@\(2,r0\)
+ 110: c1 01 mov.w r0,@\(2,gbr\)
+ 112: 8b 01 bf 118 <.*>
+ 114: 89 01 bt 11a <.*>
+ 116: a0 01 bra 11c <.*>
+ 118: b0 01 bsr 11e <.*>
+ 11a: d0 00 mov.l 11c <.*>,r0 ! 0x5001c601
+ 11c: 50 01 mov.l @\(4,r0\),r0
+ 11e: c6 01 mov.l @\(4,gbr\),r0
+ 120: c7 01 mova 128 <.*>,r0
+ 122: 10 01 mov.l r0,@\(4,r0\)
+ 124: c2 01 mov.l r0,@\(4,gbr\)
+ 126: 00 09 nop
+
+0000000000000128 <.*>:
+ 128: 00000139 .long 0x00000139
+ 12c: 0000013d .long 0x0000013d
+ 130: 00000138 .long 0x00000138
+ 134: 00000138 .long 0x00000138
+
+0000000000000138 <.*>:
+ 138: 00 00 .word 0x0000
+ 13a: 01 40 .word 0x0140
+ 13c: 00 00 .word 0x0000
+ 13e: 01 61 .word 0x0161
+
+0000000000000140 <.*>:
+ 140: cc000000 movi 0,r0
+ 144: c8000000 shori 0,r0
+ 148: 6bf10200 ptabs/l r0,tr0
+ 14c: 4401fd20 blink tr0,r18
+ 150: cc000000 movi 0,r0
+ 154: c8000000 shori 0,r0
+ 158: 6bf10200 ptabs/l r0,tr0
+ 15c: 4401fd20 blink tr0,r18
+ 160: cfff7000 movi -36,r0
+ 164: cfffe400 movi -7,r0
+ 168: ebfffa00 pta/l 160 <.*>,tr0
+
+000000000000016c <.*>:
+ 16c: 0000016d .long 0x0000016d
+
+0000000000000170 <.*>:
+ 170: 00000171 .long 0x00000171
+ 174: cfffd000 movi -12,r0
+ 178: cfffc000 movi -16,r0
+
+000000000000017c <.*>:
+ 17c: c7 01 mova 184 <.*>,r0
+ 17e: 60 12 mov.l @r1,r0
+ 180: 30 1c add r1,r0
+ 182: 00 03 bsrf r0
+
+0000000000000184 <.*>:
+ 184: 00 00 .word 0x0000
+ 186: 00 05 mov.w r0,@\(r0,r0\)
+
+0000000000000188 <.*>:
+ 188: cc002400 movi 9,r0
+ 18c: cc001c00 movi 7,r0
+ 190: cc004000 movi 16,r0
+ 194: cc001000 movi 4,r0
+ 198: cffff800 movi -2,r0
+ 19c: cc000400 movi 1,r0
+ 1a0: cc002400 movi 9,r0
+ 1a4: cc006000 movi 24,r0
+ 1a8: cc002000 movi 8,r0
diff --git a/gas/testsuite/gas/sh/sh64/syntax-1.s b/gas/testsuite/gas/sh/sh64/syntax-1.s
new file mode 100644
index 0000000..0e5bc9f
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/syntax-1.s
@@ -0,0 +1,199 @@
+! Verify that minimum support is provided as per SH-5/ST50-047-02.
+
+ .text
+ .mode shmedia
+start:
+
+! Both all-upper and all-lower must be supported. PTA/PTB without /L
+! or /U is equivalent to with /L
+
+ ld.l r1,4,r1
+ LD.L r1,4,r1
+ pta/l .L1,tr0
+ PTA/L .L1,tr0
+ pta/u .L1,tr0
+ PTA/U .L1,tr0
+ pta/l .L1,tr0
+ PTA/L .L1,tr0
+ ptb/u .L2,tr0
+ PTB/U .L2,tr0
+ ptb/l .L2,tr0
+ PTB/L .L2,tr0
+ pta .L1,tr0
+ PTA .L1,tr0
+ ptb .L2,tr0
+ PTB .L2,tr0
+.L1:
+ .mode shcompact
+.L2:
+ .align 2
+ .mode shmedia
+
+! All register names accepted, either case.
+
+ or r0,r32,r63
+ GETCON CR0,R0
+ getcon cr63,r0
+ GETTR TR0,R0
+ gettr tr7,r0
+ FMOV.S FR0,FR63
+ fmov.d dr0,dr62
+ FTRV.S MTRX0,FV0,fv0
+ ftrv.s mtrx48,FV60,FV60
+
+! All control register names
+
+ getcon sr,r0
+ getcon ssr,r0
+ getcon pssr,r0
+ getcon intevt,r0
+ getcon expevt,r0
+ getcon pexpevt,r0
+ getcon tra,r0
+ getcon spc,r0
+ getcon pspc,r0
+ getcon resvec,r0
+ getcon vbr,r0
+ getcon tea,r0
+ getcon dcr,r0
+ getcon kcr0,r0
+ getcon kcr1,r0
+ getcon ctc,r0
+ getcon usr,r0
+
+! immediates
+
+ .mode shcompact
+s1:
+ mov #4,r0
+
+ .align 2
+ .mode shmedia
+s2:
+ movi 4,r0
+
+! Scaled operands - user gives scaled value
+
+ .mode shcompact
+s3:
+ mov.l @(8,r0),r0
+
+ .align 2
+ .mode shmedia
+s4:
+ ld.uw r0,2,r0
+ ld.w r0,2,r0
+ st.w r0,2,r0
+ ld.l r0,4,r0
+ st.l r0,4,r0
+ fld.s r0,4,fr0
+ fst.s r0,4,fr0
+ pta .+4,tr0
+ ptb .+7,tr0
+ ld.q r0,8,r0
+ st.q r0,8,r0
+ fld.d r0,8,dr0
+ fst.d r0,8,dr0
+ fld.p r0,8,fp0
+ fst.p r0,8,fp0
+ alloco r0,32
+ icbi r0,32
+ ocbi r0,32
+ ocbp r0,32
+ ocbwb r0,32
+ prefi r0,32
+
+ .mode shcompact
+s5:
+ mov.w @(6,pc),r0
+ mov.w @(2,r0),r0
+ mov.w @(2,gbr),r0
+ mov.w r0,@(2,r0)
+ mov.w r0,@(2,gbr)
+ bf .+6
+ bt .+6
+ bra .+6
+ bsr .+6
+ mov.l @(4,pc),r0
+ mov.l @(4,r0),r0
+ mov.l @(4,gbr),r0
+ mova @(6,pc),r0
+ mov.l r0,@(4,r0)
+ mov.l r0,@(4,gbr)
+
+! branchlabel vs datalabel
+
+ .align 2
+ .mode shmedia
+s6:
+ .long .L3
+ .long .L3 + 4
+ .long datalabel .L3
+ .long DATALABEL .L3
+.L3:
+ .mode shcompact
+
+s7:
+ .long .L4
+ .long .L5
+.L4:
+
+ .align 2
+ .mode shmedia
+s8:
+
+ movi (.L4 >> 16) & 65535,r0
+ shori .L4 & 65535, r0
+ ptabs r0,tr0
+ blink tr0,r18
+
+ movi (.L5 >> 16) & 65535,r0
+ shori .L5 & 65535, r0
+ ptabs r0,tr0
+ blink tr0,r18
+.L5:
+
+ movi (.L4-DATALABEL .L6), r0
+.L6:
+ movi (.L5-DATALABEL .L7), r0
+.L7:
+
+ pt .L5,tr0
+
+! Expressions
+
+! Symbols
+
+abcdefghijklmnopqrstuvwxyz0123456789_:
+ .long abcdefghijklmnopqrstuvwxyz0123456789_
+_x:
+ .long _x
+
+! program counter
+
+ movi .L7-$,r0
+.L8: movi .L7-.L8,r0
+
+ .mode shcompact
+s9:
+ mova @(litpool-$,pc), r0
+ mov.l @r1,r0
+ add r1,r0
+ bsrf r0
+litpool:
+ .long s10 - DATALABEL $
+
+! operators
+
+ .align 2
+ .mode shmedia
+s10:
+ movi 8+1,r0
+ movi 8-1,r0
+ movi 8<<1,r0
+ movi 8>>1,r0
+ movi ~1,r0
+ movi 5&3,r0
+ movi 8|1,r0
+ movi 8*3,r0
+ movi 24/3,r0
diff --git a/gas/testsuite/gas/sh/sh64/syntax-2.d b/gas/testsuite/gas/sh/sh64/syntax-2.d
new file mode 100644
index 0000000..9c57087
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/syntax-2.d
@@ -0,0 +1,11 @@
+#as: --isa=shmedia
+#objdump: -d
+#name: Minimum SH64 Syntax Support - Pseudos.
+
+dump.o: file format elf64-sh64
+
+Disassembly of section .text:
+
+0000000000000000 <.*>:
+ 0: e8000a00 pta/l 8 <.*>,tr0
+ 4: ec000600 ptb/l 8 <.*>,tr0
diff --git a/gas/testsuite/gas/sh/sh64/syntax-2.s b/gas/testsuite/gas/sh/sh64/syntax-2.s
new file mode 100644
index 0000000..3140daa
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/syntax-2.s
@@ -0,0 +1,10 @@
+ .text
+start:
+
+! pseudo-ops
+
+ pt .L4,tr0
+ pt .L5,tr0
+.L4:
+ .mode shcompact
+.L5:
diff --git a/gas/testsuite/gas/sh/sh64/ua-1.s b/gas/testsuite/gas/sh/sh64/ua-1.s
new file mode 100644
index 0000000..2a2b63e
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/ua-1.s
@@ -0,0 +1,16 @@
+! Check that unaligned pseudos emit the expected relocs and contents
+! whether aligned or not.
+
+ .section .rodata,"a"
+start:
+ .uaquad 0x123456789abcdef
+ .byte 42
+ .uaword 0x4a21
+ .ualong 0x43b1abcd
+ .ualong externsym0 + 3
+ .uaquad 0x12c456d89ab1d0f
+ .uaquad externsym1 + 41
+ .byte 2
+ .uaquad 0x1a34b67c9ab0d4f
+ .ualong externsym2 + 42
+ .uaquad externsym3 + 43
diff --git a/gas/testsuite/gas/sh/sh64/ua32-1.d b/gas/testsuite/gas/sh/sh64/ua32-1.d
new file mode 100644
index 0000000..9e7f8d4
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/ua32-1.d
@@ -0,0 +1,25 @@
+#as: --abi=32
+#objdump: -sr
+#source: ua-1.s
+#name: Unaligned pseudos, 32-bit ABI.
+
+# Note that the relocs for externsym0 + 3 and externsym2 + 42 are
+# partial-in-place, i.e. REL-like, and are not displayed correctly.
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.rodata\]:
+OFFSET *TYPE *VALUE
+0+0f R_SH_DIR32 externsym0
+0+1b R_SH_64 externsym1\+0x0+29
+0+2c R_SH_DIR32 externsym2
+0+30 R_SH_64 externsym3\+0x0+2b
+
+
+Contents of section \.text:
+Contents of section \.data:
+Contents of section \.rodata:
+ 0000 01234567 89abcdef 2a4a2143 b1abcd00 .*
+ 0010 00000301 2c456d89 ab1d0f00 00000000 .*
+ 0020 00000002 01a34b67 c9ab0d4f 0000002a .*
+ 0030 00000000 00000000 .*
diff --git a/gas/testsuite/gas/sh/sh64/ua64-1.d b/gas/testsuite/gas/sh/sh64/ua64-1.d
new file mode 100644
index 0000000..a977f15
--- /dev/null
+++ b/gas/testsuite/gas/sh/sh64/ua64-1.d
@@ -0,0 +1,25 @@
+#as: --abi=64
+#objdump: -sr
+#name: Unaligned pseudos, 64-bit ABI.
+#source: ua-1.s
+
+# Note that the relocs for externsym0 + 3 and externsym2 + 42 are
+# partial-in-place, i.e. REL-like, and are not displayed correctly.
+
+.*: file format .*-sh64
+
+RELOCATION RECORDS FOR \[\.rodata\]:
+OFFSET TYPE VALUE
+0+0f R_SH_DIR32 externsym0
+0+1b R_SH_64 externsym1\+0x0000000000000029
+0+2c R_SH_DIR32 externsym2
+0+30 R_SH_64 externsym3\+0x000000000000002b
+
+
+Contents of section \.text:
+Contents of section \.data:
+Contents of section \.rodata:
+ 0000 01234567 89abcdef 2a4a2143 b1abcd00 .*
+ 0010 00000301 2c456d89 ab1d0f00 00000000 .*
+ 0020 00000002 01a34b67 c9ab0d4f 0000002a .*
+ 0030 00000000 00000000 .*