2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / sh / pr52483-2.c
blob91b485ef443640895562def9add71fe9a882c137
1 /* Check that loads/stores from/to volatile mems utilize displacement
2 addressing modes and do not result in redundant sign/zero extensions. */
3 /* { dg-do compile } */
4 /* { dg-options "-O1" } */
5 /* { dg-final { scan-assembler-times "@\\(5," 4 } } */
6 /* { dg-final { scan-assembler-times "@\\(10," 4 } } */
7 /* { dg-final { scan-assembler-times "@\\(20," 4 } } */
8 /* { dg-final { scan-assembler-times "@\\(40," 4 } } */
9 /* { dg-final { scan-assembler-times "@\\(44," 4 } } */
10 /* { dg-final { scan-assembler-not "exts" } } */
11 /* { dg-final { scan-assembler-times "extu|movu" 2 } } */
13 int
14 test_00 (volatile char* x)
16 return x[5];
19 void
20 test_100 (volatile char* x, char y)
22 x[5] = y;
25 int
26 test_01 (volatile short* x)
28 return x[5];
31 void
32 test_101 (volatile short* x, short y)
34 x[5] = y;
37 int
38 test_02 (volatile int* x)
40 return x[5];
43 void
44 test_102 (volatile int* x, int y)
46 x[5] = y;
49 long long
50 test_03 (volatile long long* x)
52 return x[5];
55 void
56 test_103 (volatile long long* x, long long y)
58 x[5] = y;
61 unsigned int
62 test_04 (volatile unsigned char* x)
64 // expected 1x extu.b or movu.b
65 return x[5];
68 void
69 test_104 (volatile unsigned char* x, unsigned char y)
71 x[5] = y;
74 unsigned int
75 test_05 (volatile unsigned short* x)
77 // expected 1x extu.w or movu.w
78 return x[5];
81 void
82 test_105 (volatile unsigned short* x, unsigned short y)
84 x[5] = y;
87 unsigned int
88 test_06 (volatile unsigned int* x)
90 return x[5];
93 void
94 test_106 (volatile unsigned int* x, unsigned int y)
96 x[5] = y;
99 unsigned long long
100 test_07 (volatile unsigned long long* x)
102 return x[5];
105 void
106 test_107 (volatile unsigned long long* x, unsigned long long y)
108 x[5] = y;