diff options
Diffstat (limited to 'gas')
23 files changed, 155 insertions, 28 deletions
diff --git a/gas/config/loongarch-parse.y b/gas/config/loongarch-parse.y index ac35dee..b75040c 100644 --- a/gas/config/loongarch-parse.y +++ b/gas/config/loongarch-parse.y @@ -207,26 +207,41 @@ emit_bin (int op) switch (op) { case '*': - opr1 = opr1 * opr2; + opr1 = (valueT) opr1 * (valueT) opr2; break; case '/': - opr1 = opr1 / opr2; + if (opr2 == 0) + { + as_warn (_("Divide by zero!")); + opr1 = 0; + } + else + opr1 = opr1 / opr2; break; case '%': - opr1 = opr1 % opr2; + if (opr2 == 0) + { + as_warn (_("Divide by zero!")); + opr1 = 0; + } + else + opr1 = opr1 % opr2; break; case '+': - opr1 = opr1 + opr2; + opr1 = (valueT) opr1 + (valueT) opr2; break; case '-': - opr1 = opr1 - opr2; + opr1 = (valueT) opr1 - (valueT) opr2; break; case LEFT_OP: - opr1 = opr1 << opr2; + opr1 = (valueT) opr1 << opr2; break; case RIGHT_OP: - /* Algorithm right shift. */ - opr1 = (offsetT)opr1 >> (offsetT)opr2; + if (opr1 < 0) + as_warn (_("Right shift of negative numbers may be changed " + "from arithmetic right shift to logical right shift!")); + /* Arithmetic right shift. */ + opr1 = opr1 >> opr2; break; case '<': opr1 = opr1 < opr2; diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c index 19759cd..eb5784e 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -1887,8 +1887,8 @@ static const pseudo_typeS coff_pseudo_table[] = {"loc", obj_coff_loc, 0}, {"optim", s_ignore, 0}, /* For sun386i cc (?) */ {"weak", obj_coff_weak, 0}, -#if defined TC_TIC4X - /* The tic4x uses sdef instead of def. */ +#if defined (TC_TIC4X) || defined (TC_TIC54X) + /* The tic4x and tic54x use sdef instead of def. */ {"sdef", obj_coff_def, 0}, #endif #if defined(SEH_CMDS) diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index e071ad1..75aee15 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -9121,7 +9121,7 @@ aarch64_sframe_cfa_ra_offset (void) return (offsetT) SFRAME_CFA_FIXED_RA_INVALID; } -/* Get the abi/arch indentifier for SFrame. */ +/* Get the abi/arch identifier for SFrame. */ unsigned char aarch64_sframe_get_abi_arch (void) diff --git a/gas/config/tc-aarch64.h b/gas/config/tc-aarch64.h index acf1ce4..c2d0511 100644 --- a/gas/config/tc-aarch64.h +++ b/gas/config/tc-aarch64.h @@ -309,7 +309,7 @@ extern bool aarch64_sframe_ra_tracking_p (void); extern offsetT aarch64_sframe_cfa_ra_offset (void); #define sframe_cfa_ra_offset aarch64_sframe_cfa_ra_offset -/* The abi/arch indentifier for SFrame. */ +/* The abi/arch identifier for SFrame. */ unsigned char aarch64_sframe_get_abi_arch (void); #define sframe_get_abi_arch aarch64_sframe_get_abi_arch diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 2c61353..3e7040a 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -11968,7 +11968,7 @@ x86_sframe_cfa_ra_offset (void) return (offsetT) -8; } -/* The abi/arch indentifier for SFrame. */ +/* The abi/arch identifier for SFrame. */ unsigned char x86_sframe_get_abi_arch (void) { diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index 3fb7920..19eb0bc 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -471,7 +471,7 @@ extern bool x86_sframe_ra_tracking_p (void); extern offsetT x86_sframe_cfa_ra_offset (void); #define sframe_cfa_ra_offset x86_sframe_cfa_ra_offset -/* The abi/arch indentifier for SFrame. */ +/* The abi/arch identifier for SFrame. */ extern unsigned char x86_sframe_get_abi_arch (void); #define sframe_get_abi_arch x86_sframe_get_abi_arch diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index 0f36741..46b26d4 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -6754,7 +6754,6 @@ s_mri_for (int qual) struct mri_control_info *n; char *buf; char *s; - char ex[2]; /* The syntax is FOR.q var = init { TO | DOWNTO } end [ BY by ] DO.e @@ -6935,12 +6934,14 @@ s_mri_for (int qual) mri_assemble (buf); /* bcc bottom. */ - ex[0] = TOLOWER (extent); - ex[1] = '\0'; - if (up) - sprintf (buf, "blt%s %s", ex, n->bottom); - else - sprintf (buf, "bgt%s %s", ex, n->bottom); + s = buf; + *s++ = 'b'; + *s++ = up ? 'l' : 'g'; + *s++ = 't'; + if (extent != '\0') + *s++ = TOLOWER (extent); + *s++ = ' '; + strcpy (s, n->bottom); mri_assemble (buf); /* Put together the add or sub instruction used by ENDF. */ diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index a0cfeea..b846134 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -343,7 +343,7 @@ s390_parse_cpu (const char *arg, S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX }, { STRING_COMMA_LEN ("z16"), STRING_COMMA_LEN ("arch14"), S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX }, - { STRING_COMMA_LEN (""), STRING_COMMA_LEN ("arch15"), + { STRING_COMMA_LEN ("z17"), STRING_COMMA_LEN ("arch15"), S390_INSTR_FLAG_HTM | S390_INSTR_FLAG_VX } }; static struct diff --git a/gas/doc/as.texi b/gas/doc/as.texi index d68a9bc..40d45f7 100644 --- a/gas/doc/as.texi +++ b/gas/doc/as.texi @@ -1944,7 +1944,8 @@ Specify which s390 processor variant is the target, @samp{g5} (or @samp{arch6}), @samp{z9-109}, @samp{z9-ec} (or @samp{arch7}), @samp{z10} (or @samp{arch8}), @samp{z196} (or @samp{arch9}), @samp{zEC12} (or @samp{arch10}), @samp{z13} (or @samp{arch11}), @samp{z14} (or @samp{arch12}), @samp{z15} -(or @samp{arch13}), @samp{z16} (or @samp{arch14}), or @samp{arch15}. +(or @samp{arch13}), @samp{z16} (or @samp{arch14}), or @samp{z17} (or +@samp{arch15}). @item -mregnames @itemx -mno-regnames Allow or disallow symbolic names for registers. diff --git a/gas/doc/c-s390.texi b/gas/doc/c-s390.texi index f1a5483..5499222 100644 --- a/gas/doc/c-s390.texi +++ b/gas/doc/c-s390.texi @@ -18,7 +18,8 @@ and eleven chip levels. The architecture modes are the Enterprise System Architecture (ESA) and the newer z/Architecture mode. The chip levels are g5 (or arch3), g6, z900 (or arch5), z990 (or arch6), z9-109, z9-ec (or arch7), z10 (or arch8), z196 (or arch9), zEC12 (or arch10), z13 -(or arch11), z14 (or arch12), z15 (or arch13), z16 (or arch14), or arch15. +(or arch11), z14 (or arch12), z15 (or arch13), z16 (or arch14), or +z17 (arch15). @menu * s390 Options:: Command-line Options. @@ -73,7 +74,7 @@ are recognized: @code{z14} (or @code{arch12}), @code{z15} (or @code{arch13}), @code{z16} (or @code{arch14}), and -@code{arch15}. +@code{z17} (or @code{arch15}). Assembling an instruction that is not supported on the target processor results in an error message. diff --git a/gas/testsuite/gas/aarch64/pac_ab_key.d b/gas/testsuite/gas/aarch64/pac_ab_key.d index 4012d14..04d5fa4 100644 --- a/gas/testsuite/gas/aarch64/pac_ab_key.d +++ b/gas/testsuite/gas/aarch64/pac_ab_key.d @@ -7,7 +7,7 @@ .+: file .+ -Contents of the .eh_frame section: +Contents of the \.eh_frame section: 0+ 0+10 0+ CIE Version: 1 diff --git a/gas/testsuite/gas/aarch64/pac_compat_cfi_window_save.d b/gas/testsuite/gas/aarch64/pac_compat_cfi_window_save.d index 8e59086..6ef77ae 100644 --- a/gas/testsuite/gas/aarch64/pac_compat_cfi_window_save.d +++ b/gas/testsuite/gas/aarch64/pac_compat_cfi_window_save.d @@ -22,7 +22,7 @@ .+: file .+ -Contents of the .eh_frame section: +Contents of the \.eh_frame section: 0+ 0+10 0+ CIE Version: 1 diff --git a/gas/testsuite/gas/aarch64/pac_negate_ra_state.d b/gas/testsuite/gas/aarch64/pac_negate_ra_state.d index f49cebc..fa29c7f 100644 --- a/gas/testsuite/gas/aarch64/pac_negate_ra_state.d +++ b/gas/testsuite/gas/aarch64/pac_negate_ra_state.d @@ -4,7 +4,7 @@ .+: file .+ -Contents of the .eh_frame section: +Contents of the \.eh_frame section: 0+ 0+10 0+ CIE Version: 1 diff --git a/gas/testsuite/gas/loongarch/div_zero.l b/gas/testsuite/gas/loongarch/div_zero.l new file mode 100644 index 0000000..b30c665 --- /dev/null +++ b/gas/testsuite/gas/loongarch/div_zero.l @@ -0,0 +1,4 @@ +#source: div_zero.s +.*: Assembler messages: +.*: Warning: Divide by zero! +.*: Warning: Divide by zero! diff --git a/gas/testsuite/gas/loongarch/div_zero.s b/gas/testsuite/gas/loongarch/div_zero.s new file mode 100644 index 0000000..44a5c26 --- /dev/null +++ b/gas/testsuite/gas/loongarch/div_zero.s @@ -0,0 +1,2 @@ +addi.w $a0,$a1,2/0 +addi.d $a0,$a1,4%0 diff --git a/gas/testsuite/gas/loongarch/fix_op.d b/gas/testsuite/gas/loongarch/fix_op.d index 7125f2e..05e7403 100644 --- a/gas/testsuite/gas/loongarch/fix_op.d +++ b/gas/testsuite/gas/loongarch/fix_op.d @@ -132,3 +132,6 @@ Disassembly of section .text: [ ]+1e8:[ ]+00df04a4 [ ]+bstrpick.d[ ]+[ ]+\$a0, \$a1, 0x1f, 0x1 [ ]+1ec:[ ]+00e000a4 [ ]+bstrpick.d[ ]+[ ]+\$a0, \$a1, 0x20, 0x0 [ ]+1f0:[ ]+00ff00a4 [ ]+bstrpick.d[ ]+[ ]+\$a0, \$a1, 0x3f, 0x0 +[ ]+1f4:[ ]+00006004 [ ]+rdcntvl.w[ ]+[ ]+\$a0 +[ ]+1f8:[ ]+000060a0 [ ]+rdcntid.w[ ]+[ ]+\$a1 +[ ]+1fc:[ ]+00006404 [ ]+rdcntvh.w[ ]+[ ]+\$a0 diff --git a/gas/testsuite/gas/loongarch/fix_op.s b/gas/testsuite/gas/loongarch/fix_op.s index d0523f9..876913b 100644 --- a/gas/testsuite/gas/loongarch/fix_op.s +++ b/gas/testsuite/gas/loongarch/fix_op.s @@ -123,3 +123,8 @@ bstrpick.d $r4,$r5,0,0 bstrpick.d $r4,$r5,31,1 bstrpick.d $r4,$r5,32,0 bstrpick.d $r4,$r5,63,0 + +# LA32R aliases +rdcntvl.w $r4 +rdcntid.w $r5 +rdcntvh.w $r4 diff --git a/gas/testsuite/gas/loongarch/insn_alias_32.d b/gas/testsuite/gas/loongarch/insn_alias_32.d index 753eae7..3aa716f 100644 --- a/gas/testsuite/gas/loongarch/insn_alias_32.d +++ b/gas/testsuite/gas/loongarch/insn_alias_32.d @@ -17,3 +17,6 @@ Disassembly of section .text: 18: 60000080 blt \$a0, \$zero, 0 # 18 <L1\+0x18> 1c: 64000080 bge \$a0, \$zero, 0 # 1c <L1\+0x1c> 20: 64000004 bge \$zero, \$a0, 0 # 20 <L1\+0x20> + 24: 00006004 rdtimel.w \$a0, \$zero + 28: 000060a0 rdtimel.w \$zero, \$a1 + 2c: 00006406 rdtimeh.w \$a2, \$zero diff --git a/gas/testsuite/gas/loongarch/insn_alias_32.s b/gas/testsuite/gas/loongarch/insn_alias_32.s index 8027e32..492e52a 100644 --- a/gas/testsuite/gas/loongarch/insn_alias_32.s +++ b/gas/testsuite/gas/loongarch/insn_alias_32.s @@ -8,3 +8,8 @@ L1: bltz $a0,.L1 bgez $a0,.L1 blez $a0,.L1 + + # LA32R aliases + rdcntvl.w $a0 + rdcntid.w $a1 + rdcntvh.w $a2 diff --git a/gas/testsuite/gas/loongarch/loongarch.exp b/gas/testsuite/gas/loongarch/loongarch.exp index 87595b9..d2008f4 100644 --- a/gas/testsuite/gas/loongarch/loongarch.exp +++ b/gas/testsuite/gas/loongarch/loongarch.exp @@ -36,5 +36,7 @@ if [istarget loongarch*-*-*] { if [istarget loongarch64-*-*] { run_list_test "illegal-operand" run_list_test "pseudo_op_option_fail" + run_list_test "negative_right_shift" + run_list_test "div_zero" } } diff --git a/gas/testsuite/gas/loongarch/negative_right_shift.d b/gas/testsuite/gas/loongarch/negative_right_shift.d new file mode 100644 index 0000000..4237710 --- /dev/null +++ b/gas/testsuite/gas/loongarch/negative_right_shift.d @@ -0,0 +1,40 @@ +#as: +#objdump: -d +#skip: loongarch32-*-* +#warning_output: negative_right_shift.l + +.*: file format .* + + +Disassembly of section \.text: + +0+ <directives>: + 0: 03400000 nop + 4: 00000001 \.word 0x00000001 + 8: 00000001 \.word 0x00000001 + +0+c <insns>: + c: 02bff9ac addi.w \$t0, \$t1, -2 + 10: 02fff9ac addi.d \$t0, \$t1, -2 + 14: 13fff9ac addu16i.d \$t0, \$t1, -2 + 18: 15ffffcc lu12i.w \$t0, -2 + 1c: 17ffffcc lu32i.d \$t0, -2 + 20: 033ff9ac lu52i.d \$t0, \$t1, -2 + 24: 023ff9ac slti \$t0, \$t1, -2 + 28: 027ff9ac sltui \$t0, \$t1, -2 + 2c: 19ffffcc pcaddi \$t0, -2 + 30: 1dffffcc pcaddu12i \$t0, -2 + 34: 1fffffcc pcaddu18i \$t0, -2 + 38: 1bffffcc pcalau12i \$t0, -2 + 3c: 02bffdac addi.w \$t0, \$t1, -1 + 40: 02fffdac addi.d \$t0, \$t1, -1 + 44: 13fffdac addu16i.d \$t0, \$t1, -1 + 48: 15ffffec lu12i.w \$t0, -1 + 4c: 17ffffec lu32i.d \$t0, -1 + 50: 033ffdac lu52i.d \$t0, \$t1, -1 + 54: 023ffdac slti \$t0, \$t1, -1 + 58: 027ffdac sltui \$t0, \$t1, -1 + 5c: 19ffffec pcaddi \$t0, -1 + 60: 1dffffec pcaddu12i \$t0, -1 + 64: 1fffffec pcaddu18i \$t0, -1 + 68: 1bffffec pcalau12i \$t0, -1 diff --git a/gas/testsuite/gas/loongarch/negative_right_shift.l b/gas/testsuite/gas/loongarch/negative_right_shift.l new file mode 100644 index 0000000..6edb2a5 --- /dev/null +++ b/gas/testsuite/gas/loongarch/negative_right_shift.l @@ -0,0 +1,13 @@ +.*: Assembler messages: +.*: Warning: Right shift of negative numbers may be changed from arithmetic right shift to logical right shift! +.*: Warning: Right shift of negative numbers may be changed from arithmetic right shift to logical right shift! +.*: Warning: Right shift of negative numbers may be changed from arithmetic right shift to logical right shift! +.*: Warning: Right shift of negative numbers may be changed from arithmetic right shift to logical right shift! +.*: Warning: Right shift of negative numbers may be changed from arithmetic right shift to logical right shift! +.*: Warning: Right shift of negative numbers may be changed from arithmetic right shift to logical right shift! +.*: Warning: Right shift of negative numbers may be changed from arithmetic right shift to logical right shift! +.*: Warning: Right shift of negative numbers may be changed from arithmetic right shift to logical right shift! +.*: Warning: Right shift of negative numbers may be changed from arithmetic right shift to logical right shift! +.*: Warning: Right shift of negative numbers may be changed from arithmetic right shift to logical right shift! +.*: Warning: Right shift of negative numbers may be changed from arithmetic right shift to logical right shift! +.*: Warning: Right shift of negative numbers may be changed from arithmetic right shift to logical right shift! diff --git a/gas/testsuite/gas/loongarch/negative_right_shift.s b/gas/testsuite/gas/loongarch/negative_right_shift.s new file mode 100644 index 0000000..c6a8a1e --- /dev/null +++ b/gas/testsuite/gas/loongarch/negative_right_shift.s @@ -0,0 +1,32 @@ +directives: +.align -1>>62 +.word -1>>63 +.4byte -1>>63 + +insns: +addi.w $t0, $t1, -1<<1 +addi.d $t0, $t1, -1<<1 +addu16i.d $t0, $t1, -1<<1 +lu12i.w $t0, -1<<1 +lu32i.d $t0, -1<<1 +lu52i.d $t0, $t1, -1<<1 +slti $t0, $t1, -1<<1 +sltui $t0, $t1, -1<<1 +pcaddi $t0, -1<<1 +pcaddu12i $t0, -1<<1 +pcaddu18i $t0, -1<<1 +pcalau12i $t0, -1<<1 + +# warn +addi.w $t0, $t1, -1>>63 +addi.d $t0, $t1, -1>>63 +addu16i.d $t0, $t1, -1>>63 +lu12i.w $t0, -1>>63 +lu32i.d $t0, -1>>63 +lu52i.d $t0, $t1, -1>>63 +slti $t0, $t1, -1>>63 +sltui $t0, $t1, -1>>63 +pcaddi $t0, -1>>63 +pcaddu12i $t0, -1>>63 +pcaddu18i $t0, -1>>63 +pcalau12i $t0, -1>>63 |