[AArch64] Fix SVE testsuite failures for ILP32 (PR 83846)
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / neg_1.c
blob61cf245de7f79bd955914dfc565f560ac13ace57
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fno-inline --save-temps" } */
4 extern void abort (void);
6 long long
7 neg64 (long long a)
9 /* { dg-final { scan-assembler "neg\tx\[0-9\]+" } } */
10 return 0 - a;
13 long long
14 neg64_in_dreg (long long a)
16 /* { dg-final { scan-assembler "neg\td\[0-9\]+, d\[0-9\]+" } } */
17 register long long x asm ("d8") = a;
18 register long long y asm ("d9");
19 asm volatile ("" : : "w" (x));
20 y = 0 - x;
21 asm volatile ("" : : "w" (y));
22 return y;
25 int
26 neg32 (int a)
28 /* { dg-final { scan-assembler "neg\tw\[0-9\]+" } } */
29 return 0 - a;
32 int
33 neg32_in_sreg (int a)
35 /* { dg-final { scan-assembler "neg\tv\[0-9\]+\.2s, v\[0-9\]+\.2s" } } */
36 register int x asm ("s8") = a;
37 register int y asm ("s9");
38 asm volatile ("" : : "w" (x));
39 y = 0 - x;
40 asm volatile ("" : : "w" (y));
41 return y;
44 int
45 main (void)
47 long long a;
48 int b;
49 a = 61;
50 b = 313;
52 if (neg64 (a) != -61)
53 abort ();
55 if (neg64_in_dreg (a) != -61)
56 abort ();
58 if (neg32 (b) != -313)
59 abort ();
61 if (neg32_in_sreg (b) != -313)
62 abort ();
64 return 0;