1 ; RUN: llc < %s -mtriple=x86_64 -enable-unsafe-fp-math \ 2 ; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=SSE --check-prefix=CST 3 ; RUN: llc < %s -mtriple=x86_64 -enable-unsafe-fp-math -mattr=+sse4.1 \ 4 ; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=SSE --check-prefix=CST 5 ; RUN: llc < %s -mtriple=x86_64 -enable-unsafe-fp-math -mattr=+avx \ 6 ; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=AVX --check-prefix=CST 7 ; RUN: llc < %s -mtriple=x86_64 -enable-unsafe-fp-math -mattr=+avx2 \ 8 ; RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=AVX2 9 10 ; CST: [[MASKCSTADDR:.LCPI[0-9_]+]]: 11 ; CST-NEXT: .long 65535 # 0xffff 12 ; CST-NEXT: .long 65535 # 0xffff 13 ; CST-NEXT: .long 65535 # 0xffff 14 ; CST-NEXT: .long 65535 # 0xffff 15 16 ; CST: [[FPMASKCSTADDR:.LCPI[0-9_]+]]: 17 ; CST-NEXT: .long 1199570944 # float 65536 18 ; CST-NEXT: .long 1199570944 # float 65536 19 ; CST-NEXT: .long 1199570944 # float 65536 20 ; CST-NEXT: .long 1199570944 # float 65536 21 22 ; AVX2: [[FPMASKCSTADDR:.LCPI[0-9_]+]]: 23 ; AVX2-NEXT: .long 1199570944 # float 65536 24 25 ; AVX2: [[MASKCSTADDR:.LCPI[0-9_]+]]: 26 ; AVX2-NEXT: .long 65535 # 0xffff 27 28 define <4 x float> @test_uitofp_v4i32_to_v4f32(<4 x i32> %arg) { 29 ; SSE-LABEL: test_uitofp_v4i32_to_v4f32: 30 ; SSE: # BB#0: 31 ; SSE-NEXT: movaps {{.*#+}} xmm1 = [65535,65535,65535,65535] 32 ; SSE-NEXT: andps %xmm0, %xmm1 33 ; SSE-NEXT: cvtdq2ps %xmm1, %xmm1 34 ; SSE-NEXT: psrld $16, %xmm0 35 ; SSE-NEXT: cvtdq2ps %xmm0, %xmm0 36 ; SSE-NEXT: mulps [[FPMASKCSTADDR]](%rip), %xmm0 37 ; SSE-NEXT: addps %xmm1, %xmm0 38 ; SSE-NEXT: retq 39 ; 40 ; AVX-LABEL: test_uitofp_v4i32_to_v4f32: 41 ; AVX: # BB#0: 42 ; AVX-NEXT: vandps [[MASKCSTADDR]](%rip), %xmm0, %xmm1 43 ; AVX-NEXT: vcvtdq2ps %xmm1, %xmm1 44 ; AVX-NEXT: vpsrld $16, %xmm0, %xmm0 45 ; AVX-NEXT: vcvtdq2ps %xmm0, %xmm0 46 ; AVX-NEXT: vmulps [[FPMASKCSTADDR]](%rip), %xmm0, %xmm0 47 ; AVX-NEXT: vaddps %xmm1, %xmm0, %xmm0 48 ; AVX-NEXT: retq 49 ; 50 ; AVX2-LABEL: test_uitofp_v4i32_to_v4f32: 51 ; AVX2: # BB#0: 52 ; AVX2-NEXT: vpsrld $16, %xmm0, %xmm1 53 ; AVX2-NEXT: vcvtdq2ps %xmm1, %xmm1 54 ; AVX2-NEXT: vbroadcastss [[FPMASKCSTADDR]](%rip), %xmm2 55 ; AVX2-NEXT: vmulps %xmm2, %xmm1, %xmm1 56 ; AVX2-NEXT: vpbroadcastd [[MASKCSTADDR]](%rip), %xmm2 57 ; AVX2-NEXT: vpand %xmm2, %xmm0, %xmm0 58 ; AVX2-NEXT: vcvtdq2ps %xmm0, %xmm0 59 ; AVX2-NEXT: vaddps %xmm0, %xmm1, %xmm0 60 ; AVX2-NEXT: retq 61 %tmp = uitofp <4 x i32> %arg to <4 x float> 62 ret <4 x float> %tmp 63 } 64 65 ; AVX: [[MASKCSTADDR_v8:.LCPI[0-9_]+]]: 66 ; AVX-NEXT: .long 65535 # 0xffff 67 ; AVX-NEXT: .long 65535 # 0xffff 68 ; AVX-NEXT: .long 65535 # 0xffff 69 ; AVX-NEXT: .long 65535 # 0xffff 70 71 ; AVX: [[FPMASKCSTADDR_v8:.LCPI[0-9_]+]]: 72 ; AVX-NEXT: .long 1199570944 # float 65536 73 ; AVX-NEXT: .long 1199570944 # float 65536 74 ; AVX-NEXT: .long 1199570944 # float 65536 75 ; AVX-NEXT: .long 1199570944 # float 65536 76 77 ; AVX2: [[FPMASKCSTADDR_v8:.LCPI[0-9_]+]]: 78 ; AVX2-NEXT: .long 1199570944 # float 65536 79 80 ; AVX2: [[MASKCSTADDR_v8:.LCPI[0-9_]+]]: 81 ; AVX2-NEXT: .long 65535 # 0xffff 82 83 define <8 x float> @test_uitofp_v8i32_to_v8f32(<8 x i32> %arg) { 84 ; SSE-LABEL: test_uitofp_v8i32_to_v8f32: 85 ; SSE: # BB#0: 86 ; SSE-NEXT: movdqa %xmm0, %xmm2 87 ; SSE-NEXT: psrld $16, %xmm2 88 ; SSE-NEXT: cvtdq2ps %xmm2, %xmm2 89 ; SSE-NEXT: movaps {{.*#+}} xmm3 = [6.553600e+04,6.553600e+04,6.553600e+04,6.553600e+04] 90 ; SSE-NEXT: mulps %xmm3, %xmm2 91 ; SSE-NEXT: movdqa {{.*#+}} xmm4 = [65535,65535,65535,65535] 92 ; SSE-NEXT: pand %xmm4, %xmm0 93 ; SSE-NEXT: cvtdq2ps %xmm0, %xmm0 94 ; SSE-NEXT: addps %xmm2, %xmm0 95 ; SSE-NEXT: movdqa %xmm1, %xmm2 96 ; SSE-NEXT: psrld $16, %xmm2 97 ; SSE-NEXT: cvtdq2ps %xmm2, %xmm2 98 ; SSE-NEXT: mulps %xmm3, %xmm2 99 ; SSE-NEXT: pand %xmm4, %xmm1 100 ; SSE-NEXT: cvtdq2ps %xmm1, %xmm1 101 ; SSE-NEXT: addps %xmm2, %xmm1 102 ; SSE-NEXT: retq 103 ; 104 ; AVX-LABEL: test_uitofp_v8i32_to_v8f32: 105 ; AVX: # BB#0: 106 ; AVX-NEXT: vandps [[MASKCSTADDR_v8]](%rip), %ymm0, %ymm1 107 ; AVX-NEXT: vcvtdq2ps %ymm1, %ymm1 108 ; AVX-NEXT: vpsrld $16, %xmm0, %xmm2 109 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm0 110 ; AVX-NEXT: vpsrld $16, %xmm0, %xmm0 111 ; AVX-NEXT: vinsertf128 $1, %xmm0, %ymm2, %ymm0 112 ; AVX-NEXT: vcvtdq2ps %ymm0, %ymm0 113 ; AVX-NEXT: vmulps [[FPMASKCSTADDR_v8]](%rip), %ymm0, %ymm0 114 ; AVX-NEXT: vaddps %ymm1, %ymm0, %ymm0 115 ; AVX-NEXT: retq 116 ; 117 ; AVX2-LABEL: test_uitofp_v8i32_to_v8f32: 118 ; AVX2: # BB#0: 119 ; AVX2-NEXT: vpsrld $16, %ymm0, %ymm1 120 ; AVX2-NEXT: vcvtdq2ps %ymm1, %ymm1 121 ; AVX2-NEXT: vbroadcastss [[FPMASKCSTADDR_v8]](%rip), %ymm2 122 ; AVX2-NEXT: vmulps %ymm2, %ymm1, %ymm1 123 ; AVX2-NEXT: vpbroadcastd [[MASKCSTADDR_v8]](%rip), %ymm2 124 ; AVX2-NEXT: vpand %ymm2, %ymm0, %ymm0 125 ; AVX2-NEXT: vcvtdq2ps %ymm0, %ymm0 126 ; AVX2-NEXT: vaddps %ymm0, %ymm1, %ymm0 127 ; AVX2-NEXT: retq 128 %tmp = uitofp <8 x i32> %arg to <8 x float> 129 ret <8 x float> %tmp 130 } 131