blob: b8f0661225f822dd4c1df9aadff0e8d5f292fe63 [file] [log] [blame]
Matthias Braun6b898be2017-08-02 00:28:10 +00001; RUN: llc < %s -mtriple=i686-pc-win32 | FileCheck %s
Andrey Turetskiy1052ac22016-02-16 12:47:45 +00002
3; PR26575
4; Assertion `(Disp->isImm() || Disp->isGlobal()) && (Other.Disp->isImm() || Other.Disp->isGlobal()) && "Address displacement operand is always an immediate or a global"' failed.
5
6target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
7target triple = "i686-pc-windows-msvc"
8
Nikita Popov2f448bf2022-06-22 14:33:12 +02009declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture readonly, i32, i1) argmemonly nounwind
Andrey Turetskiy1052ac22016-02-16 12:47:45 +000010declare <2 x i64> @_mm_xor_si128(<2 x i64>, <2 x i64>) optsize
11declare <2 x i64> @llvm.x86.pclmulqdq(<2 x i64>, <2 x i64>, i8) nounwind readnone
12declare <4 x float> @_mm_castsi128_ps(<2 x i64>) optsize
13
Andrey Turetskiy0babd262016-02-20 10:58:28 +000014; Check that the LEA optimization pass works with CPI address displacements.
Nikita Popov2f448bf2022-06-22 14:33:12 +020015define void @test1(ptr nocapture readonly %src, i32 %len) #0 {
Andrey Turetskiy1052ac22016-02-16 12:47:45 +000016 %parts = alloca [4 x i32], align 4
Nikita Popov2f448bf2022-06-22 14:33:12 +020017 call void @llvm.memcpy.p0.p0.i32(ptr %parts, ptr %src, i32 %len, i1 false)
Andrey Turetskiy1052ac22016-02-16 12:47:45 +000018 %call0 = tail call <2 x i64> @_mm_xor_si128(<2 x i64> undef, <2 x i64> <i64 -9187201950435737472, i64 -9187201950435737472>)
19 %tmp0 = tail call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> undef, <2 x i64> <i64 7631803798, i64 5708721108>, i8 16)
20 %call1 = tail call <4 x float> @_mm_castsi128_ps(<2 x i64> %tmp0)
21 ret void
Andrey Turetskiy0babd262016-02-20 10:58:28 +000022; CHECK-LABEL: test1:
Zvi Rackover839d15a2016-09-26 06:42:07 +000023; CHECK: movl %esp,
Andrey Turetskiy1052ac22016-02-16 12:47:45 +000024; CHECK: calll _memcpy
25; CHECK: movaps __xmm@{{[0-9a-f]+}}, %xmm1
26; CHECK: calll __mm_xor_si128
27; CHECK: pclmulqdq $16, __xmm@{{[0-9a-f]+}}, %xmm0
28; CHECK: jmp __mm_castsi128_ps
29}
30
Andrey Turetskiy0babd262016-02-20 10:58:28 +000031declare i32 @GetLastError(...)
32declare void @IsolationAwareDeactivateActCtx(i32, i32)
Nikita Popov2f448bf2022-06-22 14:33:12 +020033declare ptr @llvm.localaddress()
Andrey Turetskiy0babd262016-02-20 10:58:28 +000034declare void @llvm.localescape(...)
Nikita Popov2f448bf2022-06-22 14:33:12 +020035declare ptr @llvm.localrecover(ptr, ptr, i32)
Andrey Turetskiy0babd262016-02-20 10:58:28 +000036
37@IsolationAwarePrivateT_SqbjaYRiRY = common global i32 0, align 4
38
39; Check that the MCSymbol objects are created to be used in "\01?fin$0@0@test2@@".
40define void @test2() #0 {
41entry:
42 %fActivateActCtxSuccess = alloca i32, align 4
43 %proc = alloca i32, align 4
44 %ulpCookie = alloca i32, align 4
Nikita Popov2f448bf2022-06-22 14:33:12 +020045 call void (...) @llvm.localescape(ptr nonnull %fActivateActCtxSuccess, ptr nonnull %proc, ptr nonnull %ulpCookie)
46 %tmp0 = tail call ptr @llvm.localaddress()
47 call fastcc void @"\01?fin$0@0@test2@@"(ptr %tmp0)
Andrey Turetskiy0babd262016-02-20 10:58:28 +000048 ret void
49; CHECK-LABEL: test2:
Krzysztof Parzyszek52396bb2018-03-27 16:44:41 +000050; CHECK: .set Ltest2$frame_escape_0, 8
51; CHECK: .set Ltest2$frame_escape_1, 4
52; CHECK: .set Ltest2$frame_escape_2, 0
Andrey Turetskiy0babd262016-02-20 10:58:28 +000053; CHECK: calll "?fin$0@0@test2@@"
54}
55
56; Check that the LEA optimization pass works with MCSymbol address displacements.
Nikita Popov2f448bf2022-06-22 14:33:12 +020057define internal fastcc void @"\01?fin$0@0@test2@@"(ptr readonly %frame_pointer) unnamed_addr noinline nounwind optsize {
Andrey Turetskiy0babd262016-02-20 10:58:28 +000058entry:
Nikita Popov2f448bf2022-06-22 14:33:12 +020059 %tmp0 = tail call ptr @llvm.localrecover(ptr @test2, ptr %frame_pointer, i32 1)
60 %tmp1 = tail call ptr @llvm.localrecover(ptr @test2, ptr %frame_pointer, i32 2)
61 %tmp2 = load i32, ptr @IsolationAwarePrivateT_SqbjaYRiRY, align 4
Andrey Turetskiy0babd262016-02-20 10:58:28 +000062 %tobool = icmp eq i32 %tmp2, 0
63 br i1 %tobool, label %if.end, label %land.lhs.true
64
65land.lhs.true:
Nikita Popov2f448bf2022-06-22 14:33:12 +020066 %tmp3 = tail call ptr @llvm.localrecover(ptr @test2, ptr %frame_pointer, i32 0)
67 %tmp4 = load i32, ptr %tmp3, align 4
Andrey Turetskiy0babd262016-02-20 10:58:28 +000068 %tobool1 = icmp eq i32 %tmp4, 0
69 br i1 %tobool1, label %if.end, label %if.then
70
71if.then:
Nikita Popov2f448bf2022-06-22 14:33:12 +020072 %tmp5 = load i32, ptr %tmp0, align 4
Andrey Turetskiy0babd262016-02-20 10:58:28 +000073 %tobool2 = icmp eq i32 %tmp5, 0
74 br i1 %tobool2, label %cond.end, label %cond.true
75
76cond.true:
Nikita Popov2f448bf2022-06-22 14:33:12 +020077 %call = tail call i32 @GetLastError()
Andrey Turetskiy0babd262016-02-20 10:58:28 +000078 br label %cond.end
79
80cond.end:
Nikita Popov2f448bf2022-06-22 14:33:12 +020081 %tmp6 = load i32, ptr %tmp1, align 4
Andrey Turetskiy0babd262016-02-20 10:58:28 +000082 tail call void @IsolationAwareDeactivateActCtx(i32 0, i32 %tmp6)
83 br label %if.end
84
85if.end:
86 ret void
87; CHECK-LABEL: "?fin$0@0@test2@@":
88; CHECK: cmpl $0, Ltest2$frame_escape_0([[REG1:%[a-z]+]])
89; CHECK: leal Ltest2$frame_escape_1([[REG1]]), [[REG2:%[a-z]+]]
90; CHECK: leal Ltest2$frame_escape_2([[REG1]]), [[REG3:%[a-z]+]]
91; CHECK: cmpl $0, ([[REG2]])
92; CHECK: pushl ([[REG3]])
93}
94
serge-sans-paille4ab30412021-05-24 19:43:40 +020095attributes #0 = { nounwind optsize "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+pclmul,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3" "unsafe-fp-math"="false" "use-soft-float"="false" }