diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-02-14 12:17:42 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-02-14 12:17:42 +0000 |
commit | 608e665946afc2b89050fcf0b99070db2c006bee (patch) | |
tree | d332f023fbc1365c9129fe463cb61d4147ac16ec /test/CodeGen/X86 | |
parent | ec304151b74f9254d7029ee4d197ce1f7cbe501a (diff) |
Notes
Diffstat (limited to 'test/CodeGen/X86')
-rw-r--r-- | test/CodeGen/X86/coff-comdat.ll | 16 | ||||
-rw-r--r-- | test/CodeGen/X86/constant-combines.ll | 35 | ||||
-rw-r--r-- | test/CodeGen/X86/dllexport-x86_64.ll | 6 | ||||
-rw-r--r-- | test/CodeGen/X86/dllexport.ll | 11 | ||||
-rw-r--r-- | test/CodeGen/X86/fold-vex.ll | 39 | ||||
-rw-r--r-- | test/CodeGen/X86/global-sections.ll | 8 | ||||
-rw-r--r-- | test/CodeGen/X86/pr15267.ll | 75 | ||||
-rw-r--r-- | test/CodeGen/X86/pshufb-mask-comments.ll | 12 | ||||
-rw-r--r-- | test/CodeGen/X86/seh-basic.ll | 175 | ||||
-rw-r--r-- | test/CodeGen/X86/seh-safe-div.ll | 196 | ||||
-rw-r--r-- | test/CodeGen/X86/sse-unaligned-mem-feature.ll (renamed from test/CodeGen/X86/2010-01-07-UAMemFeature.ll) | 6 | ||||
-rw-r--r-- | test/CodeGen/X86/win_cst_pool.ll | 8 |
12 files changed, 175 insertions, 412 deletions
diff --git a/test/CodeGen/X86/coff-comdat.ll b/test/CodeGen/X86/coff-comdat.ll index dcbbe1097d539..44e1cb236e912 100644 --- a/test/CodeGen/X86/coff-comdat.ll +++ b/test/CodeGen/X86/coff-comdat.ll @@ -73,20 +73,20 @@ $vftable = comdat largest ; CHECK: .globl @v8@0 ; CHECK: .section .text,"xr",discard,@f8@0 ; CHECK: .globl @f8@0 -; CHECK: .section .bss,"wb",associative,_f1 +; CHECK: .section .bss,"bw",associative,_f1 ; CHECK: .globl _v1 -; CHECK: .section .bss,"wb",associative,_f2 +; CHECK: .section .bss,"bw",associative,_f2 ; CHECK: .globl _v2 -; CHECK: .section .bss,"wb",associative,_f3 +; CHECK: .section .bss,"bw",associative,_f3 ; CHECK: .globl _v3 -; CHECK: .section .bss,"wb",associative,_f4 +; CHECK: .section .bss,"bw",associative,_f4 ; CHECK: .globl _v4 -; CHECK: .section .bss,"wb",associative,_f5 +; CHECK: .section .bss,"bw",associative,_f5 ; CHECK: .globl _v5 -; CHECK: .section .bss,"wb",associative,_f6 +; CHECK: .section .bss,"bw",associative,_f6 ; CHECK: .globl _v6 -; CHECK: .section .bss,"wb",same_size,_f6 +; CHECK: .section .bss,"bw",same_size,_f6 ; CHECK: .globl _f6 -; CHECK: .section .rdata,"rd",largest,_vftable +; CHECK: .section .rdata,"dr",largest,_vftable ; CHECK: .globl _vftable ; CHECK: _vftable = L_some_name+4 diff --git a/test/CodeGen/X86/constant-combines.ll b/test/CodeGen/X86/constant-combines.ll new file mode 100644 index 0000000000000..d2a6ef4f5d254 --- /dev/null +++ b/test/CodeGen/X86/constant-combines.ll @@ -0,0 +1,35 @@ +; RUN: llc < %s | FileCheck %s + +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-unknown" + +define void @PR22524({ float, float }* %arg) { +; Check that we can materialize the zero constants we store in two places here, +; and at least form a legal store of the floating point value at the end. +; The DAG combiner at one point contained bugs that given enough permutations +; would incorrectly form an illegal operation for the last of these stores when +; it folded it to a zero too late to legalize the zero store operation. If this +; ever starts forming a zero store instead of movss, the test case has stopped +; being useful. +; +; CHECK-LABEL: PR22524: +entry: + %0 = getelementptr inbounds { float, float }* %arg, i32 0, i32 1 + store float 0.000000e+00, float* %0, align 4 +; CHECK: movl $0, 4(%rdi) + + %1 = getelementptr inbounds { float, float }* %arg, i64 0, i32 0 + %2 = bitcast float* %1 to i64* + %3 = load i64* %2, align 8 + %4 = trunc i64 %3 to i32 + %5 = lshr i64 %3, 32 + %6 = trunc i64 %5 to i32 + %7 = bitcast i32 %6 to float + %8 = fmul float %7, 0.000000e+00 + %9 = bitcast float* %1 to i32* + store i32 %6, i32* %9, align 4 +; CHECK: movl $0, (%rdi) + store float %8, float* %0, align 4 +; CHECK: movss %{{.*}}, 4(%rdi) + ret void +} diff --git a/test/CodeGen/X86/dllexport-x86_64.ll b/test/CodeGen/X86/dllexport-x86_64.ll index c673f5d485f9e..cf4557d127166 100644 --- a/test/CodeGen/X86/dllexport-x86_64.ll +++ b/test/CodeGen/X86/dllexport-x86_64.ll @@ -40,18 +40,18 @@ define weak_odr dllexport void @weak1() { ; CHECK: .globl Var1 @Var1 = dllexport global i32 1, align 4 -; CHECK: .rdata,"rd" +; CHECK: .rdata,"dr" ; CHECK: .globl Var2 @Var2 = dllexport unnamed_addr constant i32 1 ; CHECK: .comm Var3 @Var3 = common dllexport global i32 0, align 4 -; CHECK: .section .data,"wd",discard,WeakVar1 +; CHECK: .section .data,"dw",discard,WeakVar1 ; CHECK: .globl WeakVar1 @WeakVar1 = weak_odr dllexport global i32 1, align 4 -; CHECK: .section .rdata,"rd",discard,WeakVar2 +; CHECK: .section .rdata,"dr",discard,WeakVar2 ; CHECK: .globl WeakVar2 @WeakVar2 = weak_odr dllexport unnamed_addr constant i32 1 diff --git a/test/CodeGen/X86/dllexport.ll b/test/CodeGen/X86/dllexport.ll index 5035aa1533013..145b48aaf6358 100644 --- a/test/CodeGen/X86/dllexport.ll +++ b/test/CodeGen/X86/dllexport.ll @@ -21,6 +21,8 @@ define dllexport void @f2() unnamed_addr { ret void } +declare dllexport void @not_defined() + ; CHECK: .globl _stdfun@0 define dllexport x86_stdcallcc void @stdfun() nounwind { ret void @@ -59,18 +61,18 @@ define weak_odr dllexport void @weak1() { ; CHECK: .globl _Var1 @Var1 = dllexport global i32 1, align 4 -; CHECK: .rdata,"rd" +; CHECK: .rdata,"dr" ; CHECK: .globl _Var2 @Var2 = dllexport unnamed_addr constant i32 1 ; CHECK: .comm _Var3 @Var3 = common dllexport global i32 0, align 4 -; CHECK: .section .data,"wd",discard,_WeakVar1 +; CHECK: .section .data,"dw",discard,_WeakVar1 ; CHECK: .globl _WeakVar1 @WeakVar1 = weak_odr dllexport global i32 1, align 4 -; CHECK: .section .rdata,"rd",discard,_WeakVar2 +; CHECK: .section .rdata,"dr",discard,_WeakVar2 ; CHECK: .globl _WeakVar2 @WeakVar2 = weak_odr dllexport unnamed_addr constant i32 1 @@ -91,7 +93,6 @@ define weak_odr dllexport void @weak1() { ; CHECK: _weak_alias = _f1 @weak_alias = weak_odr dllexport alias void()* @f1 - ; CHECK: .section .drectve ; CHECK-CL: " /EXPORT:_Var1,DATA" ; CHECK-CL: " /EXPORT:_Var2,DATA" @@ -100,6 +101,7 @@ define weak_odr dllexport void @weak1() { ; CHECK-CL: " /EXPORT:_WeakVar2,DATA" ; CHECK-CL: " /EXPORT:_f1" ; CHECK-CL: " /EXPORT:_f2" +; CHECK-CL-NOT: not_exported ; CHECK-CL: " /EXPORT:_stdfun@0" ; CHECK-CL: " /EXPORT:@fastfun@0" ; CHECK-CL: " /EXPORT:_thisfun" @@ -117,6 +119,7 @@ define weak_odr dllexport void @weak1() { ; CHECK-GCC: " -export:WeakVar2,data" ; CHECK-GCC: " -export:f1" ; CHECK-GCC: " -export:f2" +; CHECK-CL-NOT: not_exported ; CHECK-GCC: " -export:stdfun@0" ; CHECK-GCC: " -export:@fastfun@0" ; CHECK-GCC: " -export:thisfun" diff --git a/test/CodeGen/X86/fold-vex.ll b/test/CodeGen/X86/fold-vex.ll index 2bb5b441c7c00..5a8b1d8cbfdf6 100644 --- a/test/CodeGen/X86/fold-vex.ll +++ b/test/CodeGen/X86/fold-vex.ll @@ -1,16 +1,31 @@ -; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=corei7-avx | FileCheck %s +; Use CPU parameters to ensure that a CPU-specific attribute is not overriding the AVX definition. -;CHECK: @test -; No need to load from memory. The operand will be loaded as part of th AND instr. -;CHECK-NOT: vmovaps -;CHECK: vandps -;CHECK: ret +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=corei7-avx | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=btver2 | FileCheck %s +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=-avx | FileCheck %s --check-prefix=SSE +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=corei7-avx -mattr=-avx | FileCheck %s --check-prefix=SSE +; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=btver2 -mattr=-avx | FileCheck %s --check-prefix=SSE -define void @test1(<8 x i32>* %p0, <8 x i32> %in1) nounwind { -entry: - %in0 = load <8 x i32>* %p0, align 2 - %a = and <8 x i32> %in0, %in1 - store <8 x i32> %a, <8 x i32>* undef - ret void +; No need to load unaligned operand from memory using an explicit instruction with AVX. +; The operand should be folded into the AND instr. + +; With SSE, folding memory operands into math/logic ops requires 16-byte alignment +; unless specially configured on some CPUs such as AMD Family 10H. + +define <4 x i32> @test1(<4 x i32>* %p0, <4 x i32> %in1) nounwind { + %in0 = load <4 x i32>* %p0, align 2 + %a = and <4 x i32> %in0, %in1 + ret <4 x i32> %a + +; CHECK-LABEL: @test1 +; CHECK-NOT: vmovups +; CHECK: vandps (%rdi), %xmm0, %xmm0 +; CHECK-NEXT: ret + +; SSE-LABEL: @test1 +; SSE: movups (%rdi), %xmm1 +; SSE-NEXT: andps %xmm1, %xmm0 +; SSE-NEXT: ret } diff --git a/test/CodeGen/X86/global-sections.ll b/test/CodeGen/X86/global-sections.ll index fa1169d8a8e31..d6e45ad79ea91 100644 --- a/test/CodeGen/X86/global-sections.ll +++ b/test/CodeGen/X86/global-sections.ll @@ -48,7 +48,7 @@ define void @F1() { ; LINUX-SECTIONS: .section .rodata.G3,"a",@progbits ; LINUX-SECTIONS: .globl G3 -; WIN32-SECTIONS: .section .rdata,"rd",one_only,_G3 +; WIN32-SECTIONS: .section .rdata,"dr",one_only,_G3 ; WIN32-SECTIONS: .globl _G3 @@ -126,7 +126,7 @@ define void @F1() { ; LINUX-SECTIONS: .section .rodata.G7,"aMS",@progbits,1 ; LINUX-SECTIONS: .globl G7 -; WIN32-SECTIONS: .section .rdata,"rd",one_only,_G7 +; WIN32-SECTIONS: .section .rdata,"dr",one_only,_G7 ; WIN32-SECTIONS: .globl _G7 @@ -189,7 +189,7 @@ define void @F1() { ; LINUX-SECTIONS: .asciz "foo" ; LINUX-SECTIONS: .size .LG14, 4 -; WIN32-SECTIONS: .section .rdata,"rd" +; WIN32-SECTIONS: .section .rdata,"dr" ; WIN32-SECTIONS: L_G14: ; WIN32-SECTIONS: .asciz "foo" @@ -211,5 +211,5 @@ define void @F1() { ; LINUX-SECTIONS: .section .rodata.G15,"aM",@progbits,8 ; LINUX-SECTIONS: G15: -; WIN32-SECTIONS: .section .rdata,"rd",one_only,_G15 +; WIN32-SECTIONS: .section .rdata,"dr",one_only,_G15 ; WIN32-SECTIONS: _G15: diff --git a/test/CodeGen/X86/pr15267.ll b/test/CodeGen/X86/pr15267.ll index b4dc5fd47168e..90df9905fe1a6 100644 --- a/test/CodeGen/X86/pr15267.ll +++ b/test/CodeGen/X86/pr15267.ll @@ -4,8 +4,7 @@ define <4 x i3> @test1(<4 x i3>* %in) nounwind { %ret = load <4 x i3>* %in, align 1 ret <4 x i3> %ret } - -; CHECK: test1 +; CHECK-LABEL: test1 ; CHECK: movzwl ; CHECK: shrl $3 ; CHECK: andl $7 @@ -25,7 +24,7 @@ define <4 x i1> @test2(<4 x i1>* %in) nounwind { ret <4 x i1> %ret } -; CHECK: test2 +; CHECK-LABEL: test2 ; CHECK: movzbl ; CHECK: shrl ; CHECK: andl $1 @@ -46,7 +45,7 @@ define <4 x i64> @test3(<4 x i1>* %in) nounwind { ret <4 x i64> %sext } -; CHECK: test3 +; CHECK-LABEL: test3 ; CHECK: movzbl ; CHECK: movq ; CHECK: shlq @@ -67,3 +66,71 @@ define <4 x i64> @test3(<4 x i1>* %in) nounwind { ; CHECK: vpunpcklqdq ; CHECK: vinsertf128 ; CHECK: ret + +define <16 x i4> @test4(<16 x i4>* %in) nounwind { + %ret = load <16 x i4>* %in, align 1 + ret <16 x i4> %ret +} + +; CHECK-LABEL: test4 +; CHECK: movl +; CHECK-NEXT: shrl +; CHECK-NEXT: andl +; CHECK-NEXT: movl +; CHECK-NEXT: andl +; CHECK-NEXT: vmovd +; CHECK-NEXT: vpinsrb +; CHECK-NEXT: movl +; CHECK-NEXT: shrl +; CHECK-NEXT: andl +; CHECK-NEXT: vpinsrb +; CHECK-NEXT: movl +; CHECK-NEXT: shrl +; CHECK-NEXT: andl +; CHECK-NEXT: vpinsrb +; CHECK-NEXT: movl +; CHECK-NEXT: shrl +; CHECK-NEXT: andl +; CHECK-NEXT: vpinsrb +; CHECK-NEXT: movl +; CHECK-NEXT: shrl +; CHECK-NEXT: andl +; CHECK-NEXT: vpinsrb +; CHECK-NEXT: movl +; CHECK-NEXT: shrl +; CHECK-NEXT: andl +; CHECK-NEXT: vpinsrb +; CHECK-NEXT: movl +; CHECK-NEXT: shrl +; CHECK-NEXT: vpinsrb +; CHECK-NEXT: movq +; CHECK-NEXT: shrq +; CHECK-NEXT: andl +; CHECK-NEXT: vpinsrb +; CHECK-NEXT: movq +; CHECK-NEXT: shrq +; CHECK-NEXT: andl +; CHECK-NEXT: vpinsrb +; CHECK-NEXT: movq +; CHECK-NEXT: shrq +; CHECK-NEXT: andl +; CHECK-NEXT: vpinsrb +; CHECK-NEXT: movq +; CHECK-NEXT: shrq +; CHECK-NEXT: andl +; CHECK-NEXT: vpinsrb +; CHECK-NEXT: movq +; CHECK-NEXT: shrq +; CHECK-NEXT: andl +; CHECK-NEXT: vpinsrb +; CHECK-NEXT: movq +; CHECK-NEXT: shrq +; CHECK-NEXT: andl +; CHECK-NEXT: vpinsrb +; CHECK-NEXT: movq +; CHECK-NEXT: shrq +; CHECK-NEXT: andl +; CHECK-NEXT: vpinsrb +; CHECK-NEXT: shrq +; CHECK-NEXT: vpinsrb +; CHECK-NEXT: retq diff --git a/test/CodeGen/X86/pshufb-mask-comments.ll b/test/CodeGen/X86/pshufb-mask-comments.ll index 303c4a684761c..ca5a02ce8d3a1 100644 --- a/test/CodeGen/X86/pshufb-mask-comments.ll +++ b/test/CodeGen/X86/pshufb-mask-comments.ll @@ -37,4 +37,16 @@ define <16 x i8> @test4(<2 x i64>* %V) { ret <16 x i8> %1 } +define <16 x i8> @test5() { +; CHECK-LABEL: test5 +; CHECK: pshufb {{.*}} + store <2 x i64> <i64 1, i64 0>, <2 x i64>* undef, align 16 + %l = load <2 x i64>* undef, align 16 + %shuffle = shufflevector <2 x i64> %l, <2 x i64> undef, <2 x i32> zeroinitializer + store <2 x i64> %shuffle, <2 x i64>* undef, align 16 + %1 = load <16 x i8>* undef, align 16 + %2 = call <16 x i8> @llvm.x86.ssse3.pshuf.b.128(<16 x i8> undef, <16 x i8> %1) + ret <16 x i8> %2 +} + declare <16 x i8> @llvm.x86.ssse3.pshuf.b.128(<16 x i8>, <16 x i8>) nounwind readnone diff --git a/test/CodeGen/X86/seh-basic.ll b/test/CodeGen/X86/seh-basic.ll deleted file mode 100644 index 69d70d70948c1..0000000000000 --- a/test/CodeGen/X86/seh-basic.ll +++ /dev/null @@ -1,175 +0,0 @@ -; RUN: llc -mtriple x86_64-pc-windows-msvc < %s | FileCheck %s - -define void @two_invoke_merged() { -entry: - invoke void @try_body() - to label %again unwind label %lpad - -again: - invoke void @try_body() - to label %done unwind label %lpad - -done: - ret void - -lpad: - %vals = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) - catch i8* bitcast (i32 (i8*, i8*)* @filt0 to i8*) - catch i8* bitcast (i32 (i8*, i8*)* @filt1 to i8*) - %sel = extractvalue { i8*, i32 } %vals, 1 - call void @use_selector(i32 %sel) - ret void -} - -; Normal path code - -; CHECK-LABEL: {{^}}two_invoke_merged: -; CHECK: .seh_proc two_invoke_merged -; CHECK: .seh_handler __C_specific_handler, @unwind, @except -; CHECK: .Ltmp0: -; CHECK: callq try_body -; CHECK-NEXT: .Ltmp1: -; CHECK: .Ltmp2: -; CHECK: callq try_body -; CHECK-NEXT: .Ltmp3: -; CHECK: retq - -; Landing pad code - -; CHECK: .Ltmp5: -; CHECK: movl $1, %ecx -; CHECK: jmp -; CHECK: .Ltmp6: -; CHECK: movl $2, %ecx -; CHECK: callq use_selector - -; CHECK: .seh_handlerdata -; CHECK-NEXT: .long 2 -; CHECK-NEXT: .long .Ltmp0@IMGREL -; CHECK-NEXT: .long .Ltmp3@IMGREL+1 -; CHECK-NEXT: .long filt0@IMGREL -; CHECK-NEXT: .long .Ltmp5@IMGREL -; CHECK-NEXT: .long .Ltmp0@IMGREL -; CHECK-NEXT: .long .Ltmp3@IMGREL+1 -; CHECK-NEXT: .long filt1@IMGREL -; CHECK-NEXT: .long .Ltmp6@IMGREL -; CHECK: .text -; CHECK: .seh_endproc - -define void @two_invoke_gap() { -entry: - invoke void @try_body() - to label %again unwind label %lpad - -again: - call void @do_nothing_on_unwind() - invoke void @try_body() - to label %done unwind label %lpad - -done: - ret void - -lpad: - %vals = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) - catch i8* bitcast (i32 (i8*, i8*)* @filt0 to i8*) - %sel = extractvalue { i8*, i32 } %vals, 1 - call void @use_selector(i32 %sel) - ret void -} - -; Normal path code - -; CHECK-LABEL: {{^}}two_invoke_gap: -; CHECK: .seh_proc two_invoke_gap -; CHECK: .seh_handler __C_specific_handler, @unwind, @except -; CHECK: .Ltmp11: -; CHECK: callq try_body -; CHECK-NEXT: .Ltmp12: -; CHECK: callq do_nothing_on_unwind -; CHECK: .Ltmp13: -; CHECK: callq try_body -; CHECK-NEXT: .Ltmp14: -; CHECK: retq - -; Landing pad code - -; CHECK: .Ltmp16: -; CHECK: movl $1, %ecx -; CHECK: callq use_selector - -; CHECK: .seh_handlerdata -; CHECK-NEXT: .long 2 -; CHECK-NEXT: .long .Ltmp11@IMGREL -; CHECK-NEXT: .long .Ltmp12@IMGREL+1 -; CHECK-NEXT: .long filt0@IMGREL -; CHECK-NEXT: .long .Ltmp16@IMGREL -; CHECK-NEXT: .long .Ltmp13@IMGREL -; CHECK-NEXT: .long .Ltmp14@IMGREL+1 -; CHECK-NEXT: .long filt0@IMGREL -; CHECK-NEXT: .long .Ltmp16@IMGREL -; CHECK: .text -; CHECK: .seh_endproc - -define void @two_invoke_nounwind_gap() { -entry: - invoke void @try_body() - to label %again unwind label %lpad - -again: - call void @cannot_unwind() - invoke void @try_body() - to label %done unwind label %lpad - -done: - ret void - -lpad: - %vals = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) - catch i8* bitcast (i32 (i8*, i8*)* @filt0 to i8*) - %sel = extractvalue { i8*, i32 } %vals, 1 - call void @use_selector(i32 %sel) - ret void -} - -; Normal path code - -; CHECK-LABEL: {{^}}two_invoke_nounwind_gap: -; CHECK: .seh_proc two_invoke_nounwind_gap -; CHECK: .seh_handler __C_specific_handler, @unwind, @except -; CHECK: .Ltmp21: -; CHECK: callq try_body -; CHECK-NEXT: .Ltmp22: -; CHECK: callq cannot_unwind -; CHECK: .Ltmp23: -; CHECK: callq try_body -; CHECK-NEXT: .Ltmp24: -; CHECK: retq - -; Landing pad code - -; CHECK: .Ltmp26: -; CHECK: movl $1, %ecx -; CHECK: callq use_selector - -; CHECK: .seh_handlerdata -; CHECK-NEXT: .long 1 -; CHECK-NEXT: .long .Ltmp21@IMGREL -; CHECK-NEXT: .long .Ltmp24@IMGREL+1 -; CHECK-NEXT: .long filt0@IMGREL -; CHECK-NEXT: .long .Ltmp26@IMGREL -; CHECK: .text -; CHECK: .seh_endproc - -declare void @try_body() -declare void @do_nothing_on_unwind() -declare void @cannot_unwind() nounwind -declare void @use_selector(i32) - -declare i32 @filt0(i8* %eh_info, i8* %rsp) -declare i32 @filt1(i8* %eh_info, i8* %rsp) - -declare void @handler0() -declare void @handler1() - -declare i32 @__C_specific_handler(...) -declare i32 @llvm.eh.typeid.for(i8*) readnone nounwind diff --git a/test/CodeGen/X86/seh-safe-div.ll b/test/CodeGen/X86/seh-safe-div.ll deleted file mode 100644 index e911df04ded45..0000000000000 --- a/test/CodeGen/X86/seh-safe-div.ll +++ /dev/null @@ -1,196 +0,0 @@ -; RUN: llc -mtriple x86_64-pc-windows-msvc < %s | FileCheck %s - -; This test case is also intended to be run manually as a complete functional -; test. It should link, print something, and exit zero rather than crashing. -; It is the hypothetical lowering of a C source program that looks like: -; -; int safe_div(int *n, int *d) { -; int r; -; __try { -; __try { -; r = *n / *d; -; } __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) { -; puts("EXCEPTION_ACCESS_VIOLATION"); -; r = -1; -; } -; } __except(GetExceptionCode() == EXCEPTION_INT_DIVIDE_BY_ZERO) { -; puts("EXCEPTION_INT_DIVIDE_BY_ZERO"); -; r = -2; -; } -; return r; -; } - -@str1 = internal constant [27 x i8] c"EXCEPTION_ACCESS_VIOLATION\00" -@str2 = internal constant [29 x i8] c"EXCEPTION_INT_DIVIDE_BY_ZERO\00" - -define i32 @safe_div(i32* %n, i32* %d) { -entry: - %r = alloca i32, align 4 - invoke void @try_body(i32* %r, i32* %n, i32* %d) - to label %__try.cont unwind label %lpad - -lpad: - %vals = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) - catch i8* bitcast (i32 (i8*, i8*)* @safe_div_filt0 to i8*) - catch i8* bitcast (i32 (i8*, i8*)* @safe_div_filt1 to i8*) - %ehptr = extractvalue { i8*, i32 } %vals, 0 - %sel = extractvalue { i8*, i32 } %vals, 1 - %filt0_val = call i32 @llvm.eh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @safe_div_filt0 to i8*)) - %is_filt0 = icmp eq i32 %sel, %filt0_val - br i1 %is_filt0, label %handler0, label %eh.dispatch1 - -eh.dispatch1: - %filt1_val = call i32 @llvm.eh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @safe_div_filt1 to i8*)) - %is_filt1 = icmp eq i32 %sel, %filt1_val - br i1 %is_filt1, label %handler1, label %eh.resume - -handler0: - call void @puts(i8* getelementptr ([27 x i8]* @str1, i32 0, i32 0)) - store i32 -1, i32* %r, align 4 - br label %__try.cont - -handler1: - call void @puts(i8* getelementptr ([29 x i8]* @str2, i32 0, i32 0)) - store i32 -2, i32* %r, align 4 - br label %__try.cont - -eh.resume: - resume { i8*, i32 } %vals - -__try.cont: - %safe_ret = load i32* %r, align 4 - ret i32 %safe_ret -} - -; Normal path code - -; CHECK: {{^}}safe_div: -; CHECK: .seh_proc safe_div -; CHECK: .seh_handler __C_specific_handler, @unwind, @except -; CHECK: .Ltmp0: -; CHECK: leaq [[rloc:.*\(%rsp\)]], %rcx -; CHECK: callq try_body -; CHECK-NEXT: .Ltmp1 -; CHECK: .LBB0_7: -; CHECK: movl [[rloc]], %eax -; CHECK: retq - -; Landing pad code - -; CHECK: .Ltmp3: -; CHECK: movl $1, %[[sel:[a-z]+]] -; CHECK: .Ltmp4 -; CHECK: movl $2, %[[sel]] -; CHECK: .L{{.*}}: -; CHECK: cmpl $1, %[[sel]] - -; CHECK: # %handler0 -; CHECK: callq puts -; CHECK: movl $-1, [[rloc]] -; CHECK: jmp .LBB0_7 - -; CHECK: cmpl $2, %[[sel]] - -; CHECK: # %handler1 -; CHECK: callq puts -; CHECK: movl $-2, [[rloc]] -; CHECK: jmp .LBB0_7 - -; FIXME: EH preparation should not call _Unwind_Resume. -; CHECK: callq _Unwind_Resume -; CHECK: ud2 - -; CHECK: .seh_handlerdata -; CHECK: .long 2 -; CHECK: .long .Ltmp0@IMGREL -; CHECK: .long .Ltmp1@IMGREL+1 -; CHECK: .long safe_div_filt0@IMGREL -; CHECK: .long .Ltmp3@IMGREL -; CHECK: .long .Ltmp0@IMGREL -; CHECK: .long .Ltmp1@IMGREL+1 -; CHECK: .long safe_div_filt1@IMGREL -; CHECK: .long .Ltmp4@IMGREL -; CHECK: .text -; CHECK: .seh_endproc - - -define void @try_body(i32* %r, i32* %n, i32* %d) { -entry: - %0 = load i32* %n, align 4 - %1 = load i32* %d, align 4 - %div = sdiv i32 %0, %1 - store i32 %div, i32* %r, align 4 - ret void -} - -; The prototype of these filter functions is: -; int filter(EXCEPTION_POINTERS *eh_ptrs, void *rbp); - -; The definition of EXCEPTION_POINTERS is: -; typedef struct _EXCEPTION_POINTERS { -; EXCEPTION_RECORD *ExceptionRecord; -; CONTEXT *ContextRecord; -; } EXCEPTION_POINTERS; - -; The definition of EXCEPTION_RECORD is: -; typedef struct _EXCEPTION_RECORD { -; DWORD ExceptionCode; -; ... -; } EXCEPTION_RECORD; - -; The exception code can be retreived with two loads, one for the record -; pointer and one for the code. The values of local variables can be -; accessed via rbp, but that would require additional not yet implemented LLVM -; support. - -define i32 @safe_div_filt0(i8* %eh_ptrs, i8* %rbp) { - %eh_ptrs_c = bitcast i8* %eh_ptrs to i32** - %eh_rec = load i32** %eh_ptrs_c - %eh_code = load i32* %eh_rec - ; EXCEPTION_ACCESS_VIOLATION = 0xC0000005 - %cmp = icmp eq i32 %eh_code, 3221225477 - %filt.res = zext i1 %cmp to i32 - ret i32 %filt.res -} - -define i32 @safe_div_filt1(i8* %eh_ptrs, i8* %rbp) { - %eh_ptrs_c = bitcast i8* %eh_ptrs to i32** - %eh_rec = load i32** %eh_ptrs_c - %eh_code = load i32* %eh_rec - ; EXCEPTION_INT_DIVIDE_BY_ZERO = 0xC0000094 - %cmp = icmp eq i32 %eh_code, 3221225620 - %filt.res = zext i1 %cmp to i32 - ret i32 %filt.res -} - -@str_result = internal constant [21 x i8] c"safe_div result: %d\0A\00" - -define i32 @main() { - %d.addr = alloca i32, align 4 - %n.addr = alloca i32, align 4 - - store i32 10, i32* %n.addr, align 4 - store i32 2, i32* %d.addr, align 4 - %r1 = call i32 @safe_div(i32* %n.addr, i32* %d.addr) - call void (i8*, ...)* @printf(i8* getelementptr ([21 x i8]* @str_result, i32 0, i32 0), i32 %r1) - - store i32 10, i32* %n.addr, align 4 - store i32 0, i32* %d.addr, align 4 - %r2 = call i32 @safe_div(i32* %n.addr, i32* %d.addr) - call void (i8*, ...)* @printf(i8* getelementptr ([21 x i8]* @str_result, i32 0, i32 0), i32 %r2) - - %r3 = call i32 @safe_div(i32* %n.addr, i32* null) - call void (i8*, ...)* @printf(i8* getelementptr ([21 x i8]* @str_result, i32 0, i32 0), i32 %r3) - ret i32 0 -} - -define void @_Unwind_Resume() { - call void @abort() - unreachable -} - -declare i32 @__C_specific_handler(...) -declare i32 @llvm.eh.typeid.for(i8*) readnone nounwind -declare void @puts(i8*) -declare void @printf(i8*, ...) -declare void @abort() diff --git a/test/CodeGen/X86/2010-01-07-UAMemFeature.ll b/test/CodeGen/X86/sse-unaligned-mem-feature.ll index bb24adb41817d..15f91ee04eafe 100644 --- a/test/CodeGen/X86/2010-01-07-UAMemFeature.ll +++ b/test/CodeGen/X86/sse-unaligned-mem-feature.ll @@ -1,5 +1,4 @@ -; RUN: llc -mcpu=yonah -mattr=vector-unaligned-mem -march=x86 < %s | FileCheck %s -; CHECK: addps ( +; RUN: llc -mcpu=yonah -mattr=sse-unaligned-mem -march=x86 < %s | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" target triple = "x86_64-unknown-linux-gnu" @@ -8,4 +7,7 @@ define <4 x float> @foo(<4 x float>* %P, <4 x float> %In) nounwind { %A = load <4 x float>* %P, align 4 %B = fadd <4 x float> %A, %In ret <4 x float> %B + +; CHECK-LABEL: @foo +; CHECK: addps ( } diff --git a/test/CodeGen/X86/win_cst_pool.ll b/test/CodeGen/X86/win_cst_pool.ll index e8b853a03dae6..d534b126b1927 100644 --- a/test/CodeGen/X86/win_cst_pool.ll +++ b/test/CodeGen/X86/win_cst_pool.ll @@ -6,7 +6,7 @@ define double @double() { ret double 0x0000000000800000 } ; CHECK: .globl __real@0000000000800000 -; CHECK-NEXT: .section .rdata,"rd",discard,__real@0000000000800000 +; CHECK-NEXT: .section .rdata,"dr",discard,__real@0000000000800000 ; CHECK-NEXT: .align 8 ; CHECK-NEXT: __real@0000000000800000: ; CHECK-NEXT: .quad 8388608 @@ -18,7 +18,7 @@ define <4 x i32> @vec1() { ret <4 x i32> <i32 3, i32 2, i32 1, i32 0> } ; CHECK: .globl __xmm@00000000000000010000000200000003 -; CHECK-NEXT: .section .rdata,"rd",discard,__xmm@00000000000000010000000200000003 +; CHECK-NEXT: .section .rdata,"dr",discard,__xmm@00000000000000010000000200000003 ; CHECK-NEXT: .align 16 ; CHECK-NEXT: __xmm@00000000000000010000000200000003: ; CHECK-NEXT: .long 3 @@ -33,7 +33,7 @@ define <8 x i16> @vec2() { ret <8 x i16> <i16 7, i16 6, i16 5, i16 4, i16 3, i16 2, i16 1, i16 0> } ; CHECK: .globl __xmm@00000001000200030004000500060007 -; CHECK-NEXT: .section .rdata,"rd",discard,__xmm@00000001000200030004000500060007 +; CHECK-NEXT: .section .rdata,"dr",discard,__xmm@00000001000200030004000500060007 ; CHECK-NEXT: .align 16 ; CHECK-NEXT: __xmm@00000001000200030004000500060007: ; CHECK-NEXT: .short 7 @@ -53,7 +53,7 @@ define <4 x float> @undef1() { ret <4 x float> <float 1.0, float 1.0, float undef, float undef> ; CHECK: .globl __xmm@00000000000000003f8000003f800000 -; CHECK-NEXT: .section .rdata,"rd",discard,__xmm@00000000000000003f8000003f800000 +; CHECK-NEXT: .section .rdata,"dr",discard,__xmm@00000000000000003f8000003f800000 ; CHECK-NEXT: .align 16 ; CHECK-NEXT: __xmm@00000000000000003f8000003f800000: ; CHECK-NEXT: .long 1065353216 # float 1 |