diff options
Diffstat (limited to 'gas')
-rw-r--r-- | gas/config/loongarch-parse.y | 32 | ||||
-rw-r--r-- | gas/config/tc-aarch64.c | 2 | ||||
-rw-r--r-- | gas/config/tc-aarch64.h | 2 | ||||
-rw-r--r-- | gas/config/tc-i386.c | 2 | ||||
-rw-r--r-- | gas/config/tc-i386.h | 2 | ||||
-rw-r--r-- | gas/config/tc-m68k.c | 15 | ||||
-rw-r--r-- | gas/testsuite/gas/loongarch/div_zero.l | 4 | ||||
-rw-r--r-- | gas/testsuite/gas/loongarch/div_zero.s | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/loongarch/fix_op.d | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/loongarch/fix_op.s | 5 | ||||
-rw-r--r-- | gas/testsuite/gas/loongarch/insn_alias_32.d | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/loongarch/insn_alias_32.s | 5 | ||||
-rw-r--r-- | gas/testsuite/gas/loongarch/loongarch.exp | 1 |
13 files changed, 57 insertions, 21 deletions
diff --git a/gas/config/loongarch-parse.y b/gas/config/loongarch-parse.y index 97055fe..b75040c 100644 --- a/gas/config/loongarch-parse.y +++ b/gas/config/loongarch-parse.y @@ -207,29 +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: if (opr1 < 0) - as_warn(_("Right shift of negative numbers may be changed " - "from arithmetic right shift to logical right shift!")); - /* Algorithm right shift. */ - opr1 = (offsetT)opr1 >> (offsetT)opr2; + 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/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/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 0e836f7..d2008f4 100644 --- a/gas/testsuite/gas/loongarch/loongarch.exp +++ b/gas/testsuite/gas/loongarch/loongarch.exp @@ -37,5 +37,6 @@ if [istarget loongarch*-*-*] { run_list_test "illegal-operand" run_list_test "pseudo_op_option_fail" run_list_test "negative_right_shift" + run_list_test "div_zero" } } |