xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/asm-modifier.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; ModuleID = 'asm.c'
3*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
4*9880d681SAndroid Build Coastguard Workertarget triple = "i386-apple-darwin9.6"
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdefine i32 @test1() nounwind {
7*9880d681SAndroid Build Coastguard Workerentry:
8*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test1:
9*9880d681SAndroid Build Coastguard Worker; CHECK: movw	%gs:6, %ax
10*9880d681SAndroid Build Coastguard Worker  %asmtmp.i = tail call i16 asm "movw\09%gs:${1:a}, ${0:w}", "=r,ir,~{dirflag},~{fpsr},~{flags}"(i32 6) nounwind ; <i16> [#uses=1]
11*9880d681SAndroid Build Coastguard Worker  %0 = zext i16 %asmtmp.i to i32                  ; <i32> [#uses=1]
12*9880d681SAndroid Build Coastguard Worker  ret i32 %0
13*9880d681SAndroid Build Coastguard Worker}
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Workerdefine zeroext i16 @test2(i32 %address) nounwind {
16*9880d681SAndroid Build Coastguard Workerentry:
17*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test2:
18*9880d681SAndroid Build Coastguard Worker; CHECK: movw	%gs:(%eax), %ax
19*9880d681SAndroid Build Coastguard Worker  %asmtmp = tail call i16 asm "movw\09%gs:${1:a}, ${0:w}", "=r,ir,~{dirflag},~{fpsr},~{flags}"(i32 %address) nounwind ; <i16> [#uses=1]
20*9880d681SAndroid Build Coastguard Worker  ret i16 %asmtmp
21*9880d681SAndroid Build Coastguard Worker}
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker@n = global i32 42                                ; <i32*> [#uses=3]
24*9880d681SAndroid Build Coastguard Worker@y = common global i32 0                          ; <i32*> [#uses=3]
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Workerdefine void @test3() nounwind {
27*9880d681SAndroid Build Coastguard Workerentry:
28*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test3:
29*9880d681SAndroid Build Coastguard Worker; CHECK: movl _n, %eax
30*9880d681SAndroid Build Coastguard Worker  call void asm sideeffect "movl ${0:a}, %eax", "ir,~{dirflag},~{fpsr},~{flags},~{eax}"(i32* @n) nounwind
31*9880d681SAndroid Build Coastguard Worker  ret void
32*9880d681SAndroid Build Coastguard Worker}
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Workerdefine void @test4() nounwind {
35*9880d681SAndroid Build Coastguard Workerentry:
36*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test4:
37*9880d681SAndroid Build Coastguard Worker; CHECK: movl	L_y$non_lazy_ptr, %ecx
38*9880d681SAndroid Build Coastguard Worker; CHECK: movl (%ecx), %eax
39*9880d681SAndroid Build Coastguard Worker  call void asm sideeffect "movl ${0:a}, %eax", "ir,~{dirflag},~{fpsr},~{flags},~{eax}"(i32* @y) nounwind
40*9880d681SAndroid Build Coastguard Worker  ret void
41*9880d681SAndroid Build Coastguard Worker}
42