| 1 |
// REQUIRES: x86-registered-target |
| 2 |
// RUN: %clang_cc1 -triple x86_64 %s -S -o /dev/null -DWARN -verify |
| 3 |
// RUN: %clang_cc1 -triple x86_64 %s -S -o /dev/null -Werror -verify |
| 4 |
// RUN: %clang_cc1 -triple x86_64-linux-gnu %s -S -o - | FileCheck %s |
| 5 |
void f(void) { |
| 6 |
asm("movaps %xmm3, (%esi, 2)"); |
| 7 |
// expected-note@1 {{instantiated into assembly here}} |
| 8 |
#ifdef WARN |
| 9 |
// expected-warning@-3 {{scale factor without index register is ignored}} |
| 10 |
#else |
| 11 |
// expected-error@-5 {{scale factor without index register is ignored}} |
| 12 |
#endif |
| 13 |
} |
| 14 |
|
| 15 |
static unsigned var[1] = {}; |
| 16 |
void g(void) { asm volatile("movd %%xmm0, %0" |
| 17 |
: |
| 18 |
: "m"(var)); } |
| 19 |
|
| 20 |
void pr40890(void) { |
| 21 |
struct s { |
| 22 |
int a, b; |
| 23 |
} s; |
| 24 |
__asm__ __volatile__("\n#define S_A abcd%0\n" : : "n"(&((struct s*)0)->a)); |
| 25 |
__asm__ __volatile__("\n#define S_B abcd%0\n" : : "n"(&((struct s*)0)->b)); |
| 26 |
__asm__ __volatile__("\n#define BEEF abcd%0\n" : : "n"((int*)0xdeadbeeeeeef)); |
| 27 |
__asm__ __volatile__("movabsq %0, %%rax" : : "n"(4624529908474429119)); |
| 28 |
|
| 29 |
// CHECK-LABEL: pr40890 |
| 30 |
// CHECK: #define S_A abcd$0 |
| 31 |
// CHECK: #define S_B abcd$4 |
| 32 |
// CHECK: #define BEEF abcd$244837814038255 |
| 33 |
// CHECK: movabsq $4624529908474429119, %rax |
| 34 |
} |