• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-linux-pc -mcpu=corei7 | FileCheck %s --check-prefix=X32
3; RUN: llc < %s -mtriple=x86_64-linux-pc -mcpu=corei7 | FileCheck %s --check-prefix=X64
4
5; uitofp <2 x i32> codegen from buildvector or legalization is different but gives the same results
6; across the full 0 - 0xFFFFFFFF u32 range.
7
8define <2 x float> @uitofp_2i32_cvt_buildvector(i32 %x, i32 %y, <2 x float> %v) {
9; X32-LABEL: uitofp_2i32_cvt_buildvector:
10; X32:       # %bb.0:
11; X32-NEXT:    movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
12; X32-NEXT:    movsd {{.*#+}} xmm2 = mem[0],zero
13; X32-NEXT:    orpd %xmm2, %xmm1
14; X32-NEXT:    subsd %xmm2, %xmm1
15; X32-NEXT:    cvtsd2ss %xmm1, %xmm1
16; X32-NEXT:    movss {{.*#+}} xmm3 = mem[0],zero,zero,zero
17; X32-NEXT:    orpd %xmm2, %xmm3
18; X32-NEXT:    subsd %xmm2, %xmm3
19; X32-NEXT:    xorps %xmm2, %xmm2
20; X32-NEXT:    cvtsd2ss %xmm3, %xmm2
21; X32-NEXT:    insertps {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[2,3]
22; X32-NEXT:    mulps %xmm1, %xmm0
23; X32-NEXT:    retl
24;
25; X64-LABEL: uitofp_2i32_cvt_buildvector:
26; X64:       # %bb.0:
27; X64-NEXT:    movl %edi, %eax
28; X64-NEXT:    cvtsi2ss %rax, %xmm1
29; X64-NEXT:    movl %esi, %eax
30; X64-NEXT:    cvtsi2ss %rax, %xmm2
31; X64-NEXT:    insertps {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[2,3]
32; X64-NEXT:    mulps %xmm1, %xmm0
33; X64-NEXT:    retq
34  %t1 = uitofp i32 %x to float
35  %t2 = insertelement <2 x float> undef, float %t1, i32 0
36  %t3 = uitofp i32 %y to float
37  %t4 = insertelement <2 x float> %t2, float %t3, i32 1
38  %t5 = fmul <2 x float> %v, %t4
39  ret <2 x float> %t5
40}
41
42define <2 x float> @uitofp_2i32_buildvector_cvt(i32 %x, i32 %y, <2 x float> %v) {
43; X32-LABEL: uitofp_2i32_buildvector_cvt:
44; X32:       # %bb.0:
45; X32-NEXT:    movdqa {{.*#+}} xmm1 = [4.503599627370496E+15,4.503599627370496E+15]
46; X32-NEXT:    pmovzxdq {{.*#+}} xmm2 = mem[0],zero,mem[1],zero
47; X32-NEXT:    por %xmm1, %xmm2
48; X32-NEXT:    subpd %xmm1, %xmm2
49; X32-NEXT:    cvtpd2ps %xmm2, %xmm1
50; X32-NEXT:    mulps %xmm1, %xmm0
51; X32-NEXT:    retl
52;
53; X64-LABEL: uitofp_2i32_buildvector_cvt:
54; X64:       # %bb.0:
55; X64-NEXT:    movd %edi, %xmm1
56; X64-NEXT:    pinsrd $1, %esi, %xmm1
57; X64-NEXT:    pmovzxdq {{.*#+}} xmm1 = xmm1[0],zero,xmm1[1],zero
58; X64-NEXT:    movdqa {{.*#+}} xmm2 = [4.503599627370496E+15,4.503599627370496E+15]
59; X64-NEXT:    por %xmm2, %xmm1
60; X64-NEXT:    subpd %xmm2, %xmm1
61; X64-NEXT:    cvtpd2ps %xmm1, %xmm1
62; X64-NEXT:    mulps %xmm1, %xmm0
63; X64-NEXT:    retq
64  %t1 = insertelement <2 x i32> undef, i32 %x, i32 0
65  %t2 = insertelement <2 x i32> %t1, i32 %y, i32 1
66  %t3 = uitofp <2 x i32> %t2 to <2 x float>
67  %t4 = fmul <2 x float> %v, %t3
68  ret <2 x float> %t4
69}
70
71define <2 x float> @uitofp_2i32_legalized(<2 x i32> %in, <2 x float> %v) {
72; X32-LABEL: uitofp_2i32_legalized:
73; X32:       # %bb.0:
74; X32-NEXT:    pmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
75; X32-NEXT:    movdqa {{.*#+}} xmm2 = [4.503599627370496E+15,4.503599627370496E+15]
76; X32-NEXT:    por %xmm2, %xmm0
77; X32-NEXT:    subpd %xmm2, %xmm0
78; X32-NEXT:    cvtpd2ps %xmm0, %xmm0
79; X32-NEXT:    mulps %xmm1, %xmm0
80; X32-NEXT:    retl
81;
82; X64-LABEL: uitofp_2i32_legalized:
83; X64:       # %bb.0:
84; X64-NEXT:    pmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
85; X64-NEXT:    movdqa {{.*#+}} xmm2 = [4.503599627370496E+15,4.503599627370496E+15]
86; X64-NEXT:    por %xmm2, %xmm0
87; X64-NEXT:    subpd %xmm2, %xmm0
88; X64-NEXT:    cvtpd2ps %xmm0, %xmm0
89; X64-NEXT:    mulps %xmm1, %xmm0
90; X64-NEXT:    retq
91  %t1 = uitofp <2 x i32> %in to <2 x float>
92  %t2 = fmul <2 x float> %v, %t1
93  ret <2 x float> %t2
94}
95