1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -fast-isel -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=X64 3 4; NOTE: This should use IR equivalent to what is generated by clang/test/CodeGen/sse2-builtins.c 5 6define i64 @test_mm_cvtsd_si64(<2 x double> %a0) nounwind { 7; X64-LABEL: test_mm_cvtsd_si64: 8; X64: # BB#0: 9; X64-NEXT: cvtsd2si %xmm0, %rax 10; X64-NEXT: retq 11 %res = call i64 @llvm.x86.sse2.cvtsd2si64(<2 x double> %a0) 12 ret i64 %res 13} 14declare i64 @llvm.x86.sse2.cvtsd2si64(<2 x double>) nounwind readnone 15 16define i64 @test_mm_cvtsi128_si64(<2 x i64> %a0) nounwind { 17; X64-LABEL: test_mm_cvtsi128_si64: 18; X64: # BB#0: 19; X64-NEXT: movd %xmm0, %rax 20; X64-NEXT: retq 21 %res = extractelement <2 x i64> %a0, i32 0 22 ret i64 %res 23} 24 25define <2 x double> @test_mm_cvtsi64_sd(<2 x double> %a0, i64 %a1) nounwind { 26; X64-LABEL: test_mm_cvtsi64_sd: 27; X64: # BB#0: 28; X64-NEXT: cvtsi2sdq %rdi, %xmm1 29; X64-NEXT: movsd {{.*#+}} xmm0 = xmm1[0],xmm0[1] 30; X64-NEXT: retq 31 %cvt = sitofp i64 %a1 to double 32 %res = insertelement <2 x double> %a0, double %cvt, i32 0 33 ret <2 x double> %res 34} 35 36define <2 x i64> @test_mm_cvtsi64_si128(i64 %a0) nounwind { 37; X64-LABEL: test_mm_cvtsi64_si128: 38; X64: # BB#0: 39; X64-NEXT: movd %rdi, %xmm0 40; X64-NEXT: retq 41 %res0 = insertelement <2 x i64> undef, i64 %a0, i32 0 42 %res1 = insertelement <2 x i64> %res0, i64 0, i32 1 43 ret <2 x i64> %res1 44} 45 46define i64 @test_mm_cvttsd_si64(<2 x double> %a0) nounwind { 47; X64-LABEL: test_mm_cvttsd_si64: 48; X64: # BB#0: 49; X64-NEXT: cvttsd2si %xmm0, %rax 50; X64-NEXT: retq 51 %ext = extractelement <2 x double> %a0, i32 0 52 %res = fptosi double %ext to i64 53 ret i64 %res 54} 55 56define <2 x i64> @test_mm_loadu_si64(i64* %a0) nounwind { 57; X64-LABEL: test_mm_loadu_si64: 58; X64: # BB#0: 59; X64-NEXT: movq {{.*#+}} xmm0 = mem[0],zero 60; X64-NEXT: retq 61 %ld = load i64, i64* %a0, align 1 62 %res0 = insertelement <2 x i64> undef, i64 %ld, i32 0 63 %res1 = insertelement <2 x i64> %res0, i64 0, i32 1 64 ret <2 x i64> %res1 65} 66 67define void @test_mm_stream_si64(i64 *%a0, i64 %a1) { 68; X64-LABEL: test_mm_stream_si64: 69; X64: # BB#0: 70; X64-NEXT: movntiq %rsi, (%rdi) 71; X64-NEXT: retq 72 store i64 %a1, i64* %a0, align 1, !nontemporal !0 73 ret void 74} 75 76!0 = !{i64 1} 77