]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
MSP430: Tweaks to generation of 430X instructions
authorJozef Lawrynowicz <jozef.l@mittosystems.com>
Thu, 24 Oct 2019 13:34:54 +0000 (13:34 +0000)
committerJozef Lawrynowicz <jozefl@gcc.gnu.org>
Thu, 24 Oct 2019 13:34:54 +0000 (13:34 +0000)
gcc/ChangeLog:

2019-10-24  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

* config/msp430/constraints.md: Allow post_inc for "Ya" constraint.
* config/msp430/msp430.md (430x_shift_left): Use RLAM when the constant
shift amount is between 1 and 4.
(430x_arithmetic_shift_right): Use RRAM when the constant shift amount
is between 1 and 4.

gcc/testsuite/ChangeLog:

2019-10-24  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

* gcc.target/msp430/emulate-slli.c: Skip for -mcpu=msp430.
Add shift by a constant 5 bits.
Update scan-assembler directives.
* gcc.target/msp430/emulate-srai.c: Likewise.
* gcc.target/msp430/emulate-srli.c: Skip for -mcpu=msp430.

From-SVN: r277394

gcc/ChangeLog
gcc/config/msp430/constraints.md
gcc/config/msp430/msp430.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/msp430/emulate-slli.c
gcc/testsuite/gcc.target/msp430/emulate-srai.c
gcc/testsuite/gcc.target/msp430/emulate-srli.c

index d09b72d2b163a2bda188352640902193ffd3930f..eb0a2f9b51089b1b7a5797307739e7e35df31d36 100644 (file)
@@ -1,3 +1,11 @@
+2019-10-24  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
+
+       * config/msp430/constraints.md: Allow post_inc for "Ya" constraint.
+       * config/msp430/msp430.md (430x_shift_left): Use RLAM when the constant
+       shift amount is between 1 and 4.
+       (430x_arithmetic_shift_right): Use RRAM when the constant shift amount
+       is between 1 and 4.
+
 2019-10-24  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/92205
index d01bcf9a242ba54b56a3355538b46cf7851c8d87..49fc769ec74795ac74166bef2e1b9671c52a42dc 100644 (file)
@@ -82,6 +82,7 @@
                  (match_test ("CONST_INT_P (XEXP (XEXP (op, 0), 1))"))
                  (match_test ("IN_RANGE (INTVAL (XEXP (XEXP (op, 0), 1)), HOST_WIDE_INT_M1U << 15, (1 << 15)-1)"))))
        (match_code "reg" "0")
+       (match_code "post_inc" "0")
        )))
 
 (define_constraint "Yc"
index e5ba445c60d12d064e283adf3625356d9522a986..ed4c370261a82d8374cfa84e42e0e8c5a6d7f7ef 100644 (file)
                   (match_operand    2 "immediate_operand" "n")))]
   "msp430x"
   "*
-  if (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 16)
-    return \"rpt\t%2 { rlax.w\t%0\";
+  if (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 5)
+    return \"RLAM.W\t%2, %0\";
+  else if (INTVAL (operands[2]) >= 5 && INTVAL (operands[2]) < 16)
+    return \"RPT\t%2 { RLAX.W\t%0\";
   return \"# nop left shift\";
   "
 )
                     (match_operand    2 "immediate_operand" "n")))]
   "msp430x"
   "*
-  if (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 16)
-    return \"rpt\t%2 { rrax.w\t%0\";
+  if (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 5)
+    return \"RRAM.W\t%2, %0\";
+  else if (INTVAL (operands[2]) >= 5 && INTVAL (operands[2]) < 16)
+    return \"RPT\t%2 { RRAX.W\t%0\";
   return \"# nop arith right shift\";
   "
 )
index 2742e10bb6f32d09e2b94217b8ec454d78432070..ee43703ea541232b706fbd40683d547f433712b8 100644 (file)
@@ -1,3 +1,11 @@
+2019-10-24  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
+
+       * gcc.target/msp430/emulate-slli.c: Skip for -mcpu=msp430.
+       Add shift by a constant 5 bits.
+       Update scan-assembler directives.
+       * gcc.target/msp430/emulate-srai.c: Likewise.
+       * gcc.target/msp430/emulate-srli.c: Skip for -mcpu=msp430.
+
 2019-10-24  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/92205
index 0ed09d55d8c2f51f049faf6f3c8304cf9f2660b3..1c8459cfec5b29da8dba937058a8658e27e59c02 100644 (file)
@@ -1,15 +1,19 @@
 /* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-mcpu=msp430" } { "" } } */
 /* { dg-options "-Os" } */
 /* { dg-final { scan-assembler-not "mspabi_slli" } } */
-/* { dg-final { scan-assembler "rlax" } } */
+/* { dg-final { scan-assembler "RLAM.W\t#4" } } */
+/* { dg-final { scan-assembler "RPT\t#5 \{ RLAX.W" } } */
 
 /* Ensure that HImode shifts with source operand in memory are emulated with a
    rotate instructions.  */
 
 int a;
+int b;
 
 void
 foo (void)
 {
   a = a << 4;
+  b = b << 5;
 }
index 66291717a020bd7f54aff7645e6befdfad64506c..f3f6dae94eaa797cc960691b01b88896ca49398b 100644 (file)
@@ -1,15 +1,19 @@
 /* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-mcpu=msp430" } { "" } } */
 /* { dg-options "-Os" } */
 /* { dg-final { scan-assembler-not "mspabi_srai" } } */
-/* { dg-final { scan-assembler "rrax" } } */
+/* { dg-final { scan-assembler "RRAM.W\t#4" } } */
+/* { dg-final { scan-assembler "RPT\t#5 \{ RRAX.W" } } */
 
 /* Ensure that HImode shifts with source operand in memory are emulated with a
    rotate instructions.  */
 
 int a;
+int b;
 
 void
 foo (void)
 {
   a = a >> 4;
+  b = b >> 5;
 }
index c10f30b2779366eaa1acaa806fe22ad0abbd9907..f870d13f86b765b791ab8cd76fb5b23e67d345aa 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-mcpu=msp430" } { "" } } */
 /* { dg-options "-Os" } */
 /* { dg-final { scan-assembler-not "mspabi_srli" } } */
 /* { dg-final { scan-assembler "rrum" } } */