1 ; RUN: llc < %s -march=x86 -mtriple=i386-linux-gnu -mcpu=penryn -mattr=sse4.1 | FileCheck %s --check-prefix=X32
2 ; RUN: llc < %s -mtriple=x86_64-linux -mcpu=penryn -mattr=sse4.1 | FileCheck %s --check-prefix=X64
3 ; RUN: llc < %s -mtriple=x86_64-win32 -mcpu=penryn -mattr=sse4.1 | FileCheck %s --check-prefix=X64
5 define i32 @test1() nounwind readonly {
7 %tmp = load i32* addrspace(256)* getelementptr (i32* addrspace(256)* inttoptr (i32 72 to i32* addrspace(256)*), i32 31) ; <i32*> [#uses=1]
8 %tmp1 = load i32* %tmp ; <i32> [#uses=1]
12 ; X32: movl %gs:196, %eax
13 ; X32: movl (%eax), %eax
17 ; X64: movq %gs:320, %rax
18 ; X64: movl (%rax), %eax
21 define i64 @test2(void (i8*)* addrspace(256)* %tmp8) nounwind {
23 %tmp9 = load void (i8*)* addrspace(256)* %tmp8, align 8
24 tail call void %tmp9(i8* undef) nounwind optsize
30 ; X32: movl {{.*}}(%esp), %eax
31 ; X32: calll *%gs:(%eax)
34 ; X64: callq *%gs:([[A0:%rdi|%rcx]])
39 define <2 x i64> @pmovsxwd_1(i64 addrspace(256)* %p) nounwind readonly {
41 %0 = load i64 addrspace(256)* %p
42 %tmp2 = insertelement <2 x i64> zeroinitializer, i64 %0, i32 0
43 %1 = bitcast <2 x i64> %tmp2 to <8 x i16>
44 %2 = tail call <4 x i32> @llvm.x86.sse41.pmovsxwd(<8 x i16> %1) nounwind readnone
45 %3 = bitcast <4 x i32> %2 to <2 x i64>
48 ; X32-LABEL: pmovsxwd_1:
49 ; X32: movl 4(%esp), %eax
50 ; X32: pmovsxwd %gs:(%eax), %xmm0
53 ; X64-LABEL: pmovsxwd_1:
54 ; X64: pmovsxwd %gs:([[A0]]), %xmm0
58 ; The two loads here both look identical to selection DAG, except for their
59 ; address spaces. Make sure they aren't CSE'd.
60 define i32 @test_no_cse() nounwind readonly {
62 %tmp = load i32* addrspace(256)* getelementptr (i32* addrspace(256)* inttoptr (i32 72 to i32* addrspace(256)*), i32 31) ; <i32*> [#uses=1]
63 %tmp1 = load i32* %tmp ; <i32> [#uses=1]
64 %tmp2 = load i32* addrspace(257)* getelementptr (i32* addrspace(257)* inttoptr (i32 72 to i32* addrspace(257)*), i32 31) ; <i32*> [#uses=1]
65 %tmp3 = load i32* %tmp2 ; <i32> [#uses=1]
66 %tmp4 = add i32 %tmp1, %tmp3
69 ; X32-LABEL: test_no_cse:
74 declare <4 x i32> @llvm.x86.sse41.pmovsxwd(<8 x i16>) nounwind readnone