| 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 } } */ |
| 12 |
|
| 13 |
int |
| 14 |
test_00 (volatile char* x) |
| 15 |
{ |
| 16 |
return x[5]; |
| 17 |
} |
| 18 |
|
| 19 |
void |
| 20 |
test_100 (volatile char* x, char y) |
| 21 |
{ |
| 22 |
x[5] = y; |
| 23 |
} |
| 24 |
|
| 25 |
int |
| 26 |
test_01 (volatile short* x) |
| 27 |
{ |
| 28 |
return x[5]; |
| 29 |
} |
| 30 |
|
| 31 |
void |
| 32 |
test_101 (volatile short* x, short y) |
| 33 |
{ |
| 34 |
x[5] = y; |
| 35 |
} |
| 36 |
|
| 37 |
int |
| 38 |
test_02 (volatile int* x) |
| 39 |
{ |
| 40 |
return x[5]; |
| 41 |
} |
| 42 |
|
| 43 |
void |
| 44 |
test_102 (volatile int* x, int y) |
| 45 |
{ |
| 46 |
x[5] = y; |
| 47 |
} |
| 48 |
|
| 49 |
long long |
| 50 |
test_03 (volatile long long* x) |
| 51 |
{ |
| 52 |
return x[5]; |
| 53 |
} |
| 54 |
|
| 55 |
void |
| 56 |
test_103 (volatile long long* x, long long y) |
| 57 |
{ |
| 58 |
x[5] = y; |
| 59 |
} |
| 60 |
|
| 61 |
unsigned int |
| 62 |
test_04 (volatile unsigned char* x) |
| 63 |
{ |
| 64 |
// expected 1x extu.b or movu.b |
| 65 |
return x[5]; |
| 66 |
} |
| 67 |
|
| 68 |
void |
| 69 |
test_104 (volatile unsigned char* x, unsigned char y) |
| 70 |
{ |
| 71 |
x[5] = y; |
| 72 |
} |
| 73 |
|
| 74 |
unsigned int |
| 75 |
test_05 (volatile unsigned short* x) |
| 76 |
{ |
| 77 |
// expected 1x extu.w or movu.w |
| 78 |
return x[5]; |
| 79 |
} |
| 80 |
|
| 81 |
void |
| 82 |
test_105 (volatile unsigned short* x, unsigned short y) |
| 83 |
{ |
| 84 |
x[5] = y; |
| 85 |
} |
| 86 |
|
| 87 |
unsigned int |
| 88 |
test_06 (volatile unsigned int* x) |
| 89 |
{ |
| 90 |
return x[5]; |
| 91 |
} |
| 92 |
|
| 93 |
void |
| 94 |
test_106 (volatile unsigned int* x, unsigned int y) |
| 95 |
{ |
| 96 |
x[5] = y; |
| 97 |
} |
| 98 |
|
| 99 |
unsigned long long |
| 100 |
test_07 (volatile unsigned long long* x) |
| 101 |
{ |
| 102 |
return x[5]; |
| 103 |
} |
| 104 |
|
| 105 |
void |
| 106 |
test_107 (volatile unsigned long long* x, unsigned long long y) |
| 107 |
{ |
| 108 |
x[5] = y; |
| 109 |
} |