Matthias Braun | 6b898be | 2017-08-02 00:28:10 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -mtriple=i686-pc-win32 | FileCheck %s |
Andrey Turetskiy | 1052ac2 | 2016-02-16 12:47:45 +0000 | [diff] [blame] | 2 | |
| 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 | |
| 6 | target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" |
| 7 | target triple = "i686-pc-windows-msvc" |
| 8 | |
Nikita Popov | 2f448bf | 2022-06-22 14:33:12 +0200 | [diff] [blame] | 9 | declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture readonly, i32, i1) argmemonly nounwind |
Andrey Turetskiy | 1052ac2 | 2016-02-16 12:47:45 +0000 | [diff] [blame] | 10 | declare <2 x i64> @_mm_xor_si128(<2 x i64>, <2 x i64>) optsize |
| 11 | declare <2 x i64> @llvm.x86.pclmulqdq(<2 x i64>, <2 x i64>, i8) nounwind readnone |
| 12 | declare <4 x float> @_mm_castsi128_ps(<2 x i64>) optsize |
| 13 | |
Andrey Turetskiy | 0babd26 | 2016-02-20 10:58:28 +0000 | [diff] [blame] | 14 | ; Check that the LEA optimization pass works with CPI address displacements. |
Nikita Popov | 2f448bf | 2022-06-22 14:33:12 +0200 | [diff] [blame] | 15 | define void @test1(ptr nocapture readonly %src, i32 %len) #0 { |
Andrey Turetskiy | 1052ac2 | 2016-02-16 12:47:45 +0000 | [diff] [blame] | 16 | %parts = alloca [4 x i32], align 4 |
Nikita Popov | 2f448bf | 2022-06-22 14:33:12 +0200 | [diff] [blame] | 17 | call void @llvm.memcpy.p0.p0.i32(ptr %parts, ptr %src, i32 %len, i1 false) |
Andrey Turetskiy | 1052ac2 | 2016-02-16 12:47:45 +0000 | [diff] [blame] | 18 | %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 Turetskiy | 0babd26 | 2016-02-20 10:58:28 +0000 | [diff] [blame] | 22 | ; CHECK-LABEL: test1: |
Zvi Rackover | 839d15a | 2016-09-26 06:42:07 +0000 | [diff] [blame] | 23 | ; CHECK: movl %esp, |
Andrey Turetskiy | 1052ac2 | 2016-02-16 12:47:45 +0000 | [diff] [blame] | 24 | ; 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 Turetskiy | 0babd26 | 2016-02-20 10:58:28 +0000 | [diff] [blame] | 31 | declare i32 @GetLastError(...) |
| 32 | declare void @IsolationAwareDeactivateActCtx(i32, i32) |
Nikita Popov | 2f448bf | 2022-06-22 14:33:12 +0200 | [diff] [blame] | 33 | declare ptr @llvm.localaddress() |
Andrey Turetskiy | 0babd26 | 2016-02-20 10:58:28 +0000 | [diff] [blame] | 34 | declare void @llvm.localescape(...) |
Nikita Popov | 2f448bf | 2022-06-22 14:33:12 +0200 | [diff] [blame] | 35 | declare ptr @llvm.localrecover(ptr, ptr, i32) |
Andrey Turetskiy | 0babd26 | 2016-02-20 10:58:28 +0000 | [diff] [blame] | 36 | |
| 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@@". |
| 40 | define void @test2() #0 { |
| 41 | entry: |
| 42 | %fActivateActCtxSuccess = alloca i32, align 4 |
| 43 | %proc = alloca i32, align 4 |
| 44 | %ulpCookie = alloca i32, align 4 |
Nikita Popov | 2f448bf | 2022-06-22 14:33:12 +0200 | [diff] [blame] | 45 | 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 Turetskiy | 0babd26 | 2016-02-20 10:58:28 +0000 | [diff] [blame] | 48 | ret void |
| 49 | ; CHECK-LABEL: test2: |
Krzysztof Parzyszek | 52396bb | 2018-03-27 16:44:41 +0000 | [diff] [blame] | 50 | ; CHECK: .set Ltest2$frame_escape_0, 8 |
| 51 | ; CHECK: .set Ltest2$frame_escape_1, 4 |
| 52 | ; CHECK: .set Ltest2$frame_escape_2, 0 |
Andrey Turetskiy | 0babd26 | 2016-02-20 10:58:28 +0000 | [diff] [blame] | 53 | ; CHECK: calll "?fin$0@0@test2@@" |
| 54 | } |
| 55 | |
| 56 | ; Check that the LEA optimization pass works with MCSymbol address displacements. |
Nikita Popov | 2f448bf | 2022-06-22 14:33:12 +0200 | [diff] [blame] | 57 | define internal fastcc void @"\01?fin$0@0@test2@@"(ptr readonly %frame_pointer) unnamed_addr noinline nounwind optsize { |
Andrey Turetskiy | 0babd26 | 2016-02-20 10:58:28 +0000 | [diff] [blame] | 58 | entry: |
Nikita Popov | 2f448bf | 2022-06-22 14:33:12 +0200 | [diff] [blame] | 59 | %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 Turetskiy | 0babd26 | 2016-02-20 10:58:28 +0000 | [diff] [blame] | 62 | %tobool = icmp eq i32 %tmp2, 0 |
| 63 | br i1 %tobool, label %if.end, label %land.lhs.true |
| 64 | |
| 65 | land.lhs.true: |
Nikita Popov | 2f448bf | 2022-06-22 14:33:12 +0200 | [diff] [blame] | 66 | %tmp3 = tail call ptr @llvm.localrecover(ptr @test2, ptr %frame_pointer, i32 0) |
| 67 | %tmp4 = load i32, ptr %tmp3, align 4 |
Andrey Turetskiy | 0babd26 | 2016-02-20 10:58:28 +0000 | [diff] [blame] | 68 | %tobool1 = icmp eq i32 %tmp4, 0 |
| 69 | br i1 %tobool1, label %if.end, label %if.then |
| 70 | |
| 71 | if.then: |
Nikita Popov | 2f448bf | 2022-06-22 14:33:12 +0200 | [diff] [blame] | 72 | %tmp5 = load i32, ptr %tmp0, align 4 |
Andrey Turetskiy | 0babd26 | 2016-02-20 10:58:28 +0000 | [diff] [blame] | 73 | %tobool2 = icmp eq i32 %tmp5, 0 |
| 74 | br i1 %tobool2, label %cond.end, label %cond.true |
| 75 | |
| 76 | cond.true: |
Nikita Popov | 2f448bf | 2022-06-22 14:33:12 +0200 | [diff] [blame] | 77 | %call = tail call i32 @GetLastError() |
Andrey Turetskiy | 0babd26 | 2016-02-20 10:58:28 +0000 | [diff] [blame] | 78 | br label %cond.end |
| 79 | |
| 80 | cond.end: |
Nikita Popov | 2f448bf | 2022-06-22 14:33:12 +0200 | [diff] [blame] | 81 | %tmp6 = load i32, ptr %tmp1, align 4 |
Andrey Turetskiy | 0babd26 | 2016-02-20 10:58:28 +0000 | [diff] [blame] | 82 | tail call void @IsolationAwareDeactivateActCtx(i32 0, i32 %tmp6) |
| 83 | br label %if.end |
| 84 | |
| 85 | if.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-paille | 4ab3041 | 2021-05-24 19:43:40 +0200 | [diff] [blame] | 95 | attributes #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" } |