Skip to content

Commit d307c77

Browse files
committed
X86: Add asm modifier tests for 64-bit PIC
1 parent 1917412 commit d307c77

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2+
; RUN: llc -mtriple=x86_64 -relocation-model=pic < %s | FileCheck %s
3+
4+
@var = internal global i32 0, align 4
5+
6+
define dso_local void @test_a() nounwind {
7+
; CHECK-LABEL: test_a:
8+
; CHECK: # %bb.0:
9+
; CHECK-NEXT: #APP
10+
; CHECK-NEXT: #TEST 42 var(%rip)#
11+
; CHECK-NEXT: #NO_APP
12+
; CHECK-NEXT: retq
13+
tail call void asm sideeffect "#TEST ${0:a} ${1:a}#", "i,i"(i32 42, ptr @var)
14+
ret void
15+
}

llvm/test/CodeGen/X86/asm-modifier.ll

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
22
; RUN: llc -mtriple=i686 < %s | FileCheck %s --check-prefixes=CHECK,X86
33
; RUN: llc -mtriple=x86_64 < %s | FileCheck %s --check-prefixes=CHECK,X64
4+
;; Certain constraints should not be used for PIC. See asm-modifier-pic.ll for PIC-specific tests.
45

56
@var = internal global i32 0, align 4
67

78
define dso_local void @test_a() nounwind {
89
; CHECK-LABEL: test_a:
910
; CHECK: # %bb.0:
1011
; CHECK-NEXT: #APP
11-
; CHECK-NEXT: #TEST var#
12+
; CHECK-NEXT: #TEST 42 var#
1213
; CHECK-NEXT: #NO_APP
1314
; CHECK-NEXT: ret{{[l|q]}}
14-
tail call void asm sideeffect "#TEST ${0:c}#", "i"(ptr nonnull @var)
15+
tail call void asm sideeffect "#TEST ${0:a} ${1:a}#", "i,i"(i32 42, ptr @var)
1516
ret void
1617
}
1718

1819
define dso_local void @test_c() nounwind {
1920
; CHECK-LABEL: test_c:
2021
; CHECK: # %bb.0:
2122
; CHECK-NEXT: #APP
22-
; CHECK-NEXT: #TEST 42
23-
; CHECK-NEXT: #NO_APP
24-
; CHECK-NEXT: #APP
25-
; CHECK-NEXT: #TEST var
23+
; CHECK-NEXT: #TEST 42 var#
2624
; CHECK-NEXT: #NO_APP
2725
; CHECK-NEXT: ret{{[l|q]}}
28-
tail call void asm sideeffect "#TEST ${0:c}", "i"(i32 42)
29-
tail call void asm sideeffect "#TEST ${0:c}", "i"(ptr nonnull @var)
26+
tail call void asm sideeffect "#TEST ${0:c} ${1:c}#", "i,i"(i32 42, ptr @var)
3027
ret void
3128
}
3229

@@ -82,4 +79,3 @@ entry:
8279
tail call void asm sideeffect "call __x86_indirect_thunk_${0:V}", "r,~{dirflag},~{fpsr},~{flags}"(ptr %p)
8380
ret void
8481
}
85-

0 commit comments

Comments
 (0)