public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] s390: Fix tests rosbg_si_srl and rxsbg_si_srl
@ 2024-02-29 12:14 Stefan Schulze Frielinghaus
  2024-03-11  9:56 ` Andreas Krebbel
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Schulze Frielinghaus @ 2024-02-29 12:14 UTC (permalink / raw)
  To: krebbel, gcc-patches; +Cc: Stefan Schulze Frielinghaus

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(-)

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 ();
   }
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] s390: Fix tests rosbg_si_srl and rxsbg_si_srl
  2024-02-29 12:14 [PATCH] s390: Fix tests rosbg_si_srl and rxsbg_si_srl Stefan Schulze Frielinghaus
@ 2024-03-11  9:56 ` Andreas Krebbel
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Krebbel @ 2024-03-11  9:56 UTC (permalink / raw)
  To: Stefan Schulze Frielinghaus, gcc-patches

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-11  9:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-29 12:14 [PATCH] s390: Fix tests rosbg_si_srl and rxsbg_si_srl Stefan Schulze Frielinghaus
2024-03-11  9:56 ` Andreas Krebbel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).