1 ; RUN: opt < %s -instcombine -S | FileCheck %s
3 ; This turns into a&1 != 0
4 define <2 x i1> @test1(<2 x i64> %a) {
5 %t = trunc <2 x i64> %a to <2 x i1>
9 ; CHECK: and <2 x i64> %a, <i64 1, i64 1>
10 ; CHECK: icmp ne <2 x i64> %tmp, zeroinitializer
13 ; The ashr turns into an lshr.
14 define <2 x i64> @test2(<2 x i64> %a) {
15 %b = and <2 x i64> %a, <i64 65535, i64 65535>
16 %t = ashr <2 x i64> %b, <i64 1, i64 1>
20 ; CHECK: and <2 x i64> %a, <i64 65535, i64 65535>
21 ; CHECK: lshr <2 x i64> %b, <i64 1, i64 1>
26 define <2 x i64> @test3(<4 x float> %a, <4 x float> %b) nounwind readnone {
28 %cmp = fcmp ord <4 x float> %a, zeroinitializer
29 %sext = sext <4 x i1> %cmp to <4 x i32>
30 %cmp4 = fcmp ord <4 x float> %b, zeroinitializer
31 %sext5 = sext <4 x i1> %cmp4 to <4 x i32>
32 %and = and <4 x i32> %sext, %sext5
33 %conv = bitcast <4 x i32> %and to <2 x i64>
37 ; CHECK: fcmp ord <4 x float> %a, %b
40 define <2 x i64> @test4(<4 x float> %a, <4 x float> %b) nounwind readnone {
42 %cmp = fcmp uno <4 x float> %a, zeroinitializer
43 %sext = sext <4 x i1> %cmp to <4 x i32>
44 %cmp4 = fcmp uno <4 x float> %b, zeroinitializer
45 %sext5 = sext <4 x i1> %cmp4 to <4 x i32>
46 %or = or <4 x i32> %sext, %sext5
47 %conv = bitcast <4 x i32> %or to <2 x i64>
50 ; CHECK: fcmp uno <4 x float> %a, %b
55 define <2 x i64> @test5(<4 x float> %a, <4 x float> %b) nounwind readnone {
57 %cmp = fcmp ult <4 x float> %a, zeroinitializer
58 %sext = sext <4 x i1> %cmp to <4 x i32>
59 %cmp4 = fcmp ult <4 x float> %b, zeroinitializer
60 %sext5 = sext <4 x i1> %cmp4 to <4 x i32>
61 %and = and <4 x i32> %sext, %sext5
62 %conv = bitcast <4 x i32> %and to <2 x i64>
66 ; CHECK: sext <4 x i1> %cmp to <4 x i32>
67 ; CHECK: sext <4 x i1> %cmp4 to <4 x i32>
71 define void @convert(<2 x i32>* %dst.addr, <2 x i64> %src) nounwind {
73 %val = trunc <2 x i64> %src to <2 x i32>
74 %add = add <2 x i32> %val, <i32 1, i32 1>
75 store <2 x i32> %add, <2 x i32>* %dst.addr
79 define <2 x i65> @foo(<2 x i64> %t) {
80 %a = trunc <2 x i64> %t to <2 x i32>
81 %b = zext <2 x i32> %a to <2 x i65>
84 define <2 x i64> @bar(<2 x i65> %t) {
85 %a = trunc <2 x i65> %t to <2 x i32>
86 %b = zext <2 x i32> %a to <2 x i64>
89 define <2 x i65> @foos(<2 x i64> %t) {
90 %a = trunc <2 x i64> %t to <2 x i32>
91 %b = sext <2 x i32> %a to <2 x i65>
94 define <2 x i64> @bars(<2 x i65> %t) {
95 %a = trunc <2 x i65> %t to <2 x i32>
96 %b = sext <2 x i32> %a to <2 x i64>
99 define <2 x i64> @quxs(<2 x i64> %t) {
100 %a = trunc <2 x i64> %t to <2 x i32>
101 %b = sext <2 x i32> %a to <2 x i64>
104 define <2 x i64> @quxt(<2 x i64> %t) {
105 %a = shl <2 x i64> %t, <i64 32, i64 32>
106 %b = ashr <2 x i64> %a, <i64 32, i64 32>
109 define <2 x double> @fa(<2 x double> %t) {
110 %a = fptrunc <2 x double> %t to <2 x float>
111 %b = fpext <2 x float> %a to <2 x double>
114 define <2 x double> @fb(<2 x double> %t) {
115 %a = fptoui <2 x double> %t to <2 x i64>
116 %b = uitofp <2 x i64> %a to <2 x double>
119 define <2 x double> @fc(<2 x double> %t) {
120 %a = fptosi <2 x double> %t to <2 x i64>
121 %b = sitofp <2 x i64> %a to <2 x double>