diff mbox series

s390: Fix tests rosbg_si_srl and rxsbg_si_srl

Message ID 20240229121427.1200023-1-stefansf@linux.ibm.com
State New
Headers show
Series s390: Fix tests rosbg_si_srl and rxsbg_si_srl | expand

Commit Message

Stefan Schulze Frielinghaus Feb. 29, 2024, 12:14 p.m. UTC
Starting with r14-2047-gd0e891406b16dc two SI mode tests are optimized
into DI mode.  Thus, the scan-assembler directives fail.  For example
RTL expression

(ior:SI (subreg:SI (lshiftrt:DI (reg:DI 69)
            (const_int 2 [0x2])) 4)
    (subreg:SI (reg:DI 68) 4))

is optimized into

(ior:DI (lshiftrt:DI (reg:DI 69)
        (const_int 2 [0x2]))
    (reg:DI 68))

Fixed by moving operands into memory in order to enforce SI mode
computation.

Furthermore, in r9-6056-g290dfd9bc7bea2 the starting bit position of the
scan-assembler directive for rosbg was incorrectly set to 32 which
actually should be 32+SHIFT_AMOUNT, i.e., in this particular case 34.

gcc/testsuite/ChangeLog:

	* gcc.target/s390/md/rXsbg_mode_sXl.c: Fix tests rosbg_si_srl
	and rxsbg_si_srl.
---
 .../gcc.target/s390/md/rXsbg_mode_sXl.c        | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

Comments

Andreas Krebbel March 11, 2024, 9:56 a.m. UTC | #1
On 2/29/24 13:14, Stefan Schulze Frielinghaus wrote:
> Starting with r14-2047-gd0e891406b16dc two SI mode tests are optimized
> into DI mode.  Thus, the scan-assembler directives fail.  For example
> RTL expression
> 
> (ior:SI (subreg:SI (lshiftrt:DI (reg:DI 69)
>             (const_int 2 [0x2])) 4)
>     (subreg:SI (reg:DI 68) 4))
> 
> is optimized into
> 
> (ior:DI (lshiftrt:DI (reg:DI 69)
>         (const_int 2 [0x2]))
>     (reg:DI 68))
> 
> Fixed by moving operands into memory in order to enforce SI mode
> computation.
> 
> Furthermore, in r9-6056-g290dfd9bc7bea2 the starting bit position of the
> scan-assembler directive for rosbg was incorrectly set to 32 which
> actually should be 32+SHIFT_AMOUNT, i.e., in this particular case 34.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.target/s390/md/rXsbg_mode_sXl.c: Fix tests rosbg_si_srl
> 	and rxsbg_si_srl.

Ok, thanks!

Andreas
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/s390/md/rXsbg_mode_sXl.c b/gcc/testsuite/gcc.target/s390/md/rXsbg_mode_sXl.c
index ede813818ff..cf454d2783c 100644
--- a/gcc/testsuite/gcc.target/s390/md/rXsbg_mode_sXl.c
+++ b/gcc/testsuite/gcc.target/s390/md/rXsbg_mode_sXl.c
@@ -22,6 +22,8 @@ 
     { dg-skip-if "" { *-*-* } { "*" } { "-march=*" } }
 */
 
+unsigned int a, b;
+
 __attribute__ ((noinline)) unsigned int
 si_sll (unsigned int x)
 {
@@ -42,11 +44,11 @@  rosbg_si_sll (unsigned int a, unsigned int b)
 /* { dg-final { scan-assembler-times "rosbg\t%r.,%r.,32,62,1" 1 } } */
 
 __attribute__ ((noinline)) unsigned int
-rosbg_si_srl (unsigned int a, unsigned int b)
+rosbg_si_srl (void)
 {
   return a | (b >> 2);
 }
-/* { dg-final { scan-assembler-times "rosbg\t%r.,%r.,32,63,62" 1 } } */
+/* { dg-final { scan-assembler-times "rosbg\t%r.,%r.,34,63,62" 1 } } */
 
 __attribute__ ((noinline)) unsigned int
 rxsbg_si_sll (unsigned int a, unsigned int b)
@@ -56,11 +58,11 @@  rxsbg_si_sll (unsigned int a, unsigned int b)
 /* { dg-final { scan-assembler-times "rxsbg\t%r.,%r.,32,62,1" 1 } } */
 
 __attribute__ ((noinline)) unsigned int
-rxsbg_si_srl (unsigned int a, unsigned int b)
+rxsbg_si_srl (void)
 {
   return a ^ (b >> 2);
 }
-/* { dg-final { scan-assembler-times "rxsbg\t%r.,%r.,32,63,62" 1 } } */
+/* { dg-final { scan-assembler-times "rxsbg\t%r.,%r.,34,63,62" 1 } } */
 
 __attribute__ ((noinline)) unsigned long long
 di_sll (unsigned long long x)
@@ -108,21 +110,21 @@  main (void)
   /* SIMode */
   {
     unsigned int r;
-    unsigned int a = 0x12488421u;
-    unsigned int b = 0x88881111u;
+    a = 0x12488421u;
+    b = 0x88881111u;
     unsigned int csll = si_sll (b);
     unsigned int csrl = si_srl (b);
 
     r = rosbg_si_sll (a, b);
     if (r != (a | csll))
       __builtin_abort ();
-    r = rosbg_si_srl (a, b);
+    r = rosbg_si_srl ();
     if (r != (a | csrl))
       __builtin_abort ();
     r = rxsbg_si_sll (a, b);
     if (r != (a ^ csll))
       __builtin_abort ();
-    r = rxsbg_si_srl (a, b);
+    r = rxsbg_si_srl ();
     if (r != (a ^ csrl))
       __builtin_abort ();
   }