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 void @convert(<2 x i32>* %dst.addr, <2 x i64> %src) nounwind {
57 %val = trunc <2 x i64> %src to <2 x i32>
58 %add = add <2 x i32> %val, <i32 1, i32 1>
59 store <2 x i32> %add, <2 x i32>* %dst.addr
63 define <2 x i65> @foo(<2 x i64> %t) {
64 %a = trunc <2 x i64> %t to <2 x i32>
65 %b = zext <2 x i32> %a to <2 x i65>
68 define <2 x i64> @bar(<2 x i65> %t) {
69 %a = trunc <2 x i65> %t to <2 x i32>
70 %b = zext <2 x i32> %a to <2 x i64>
73 define <2 x i65> @foos(<2 x i64> %t) {
74 %a = trunc <2 x i64> %t to <2 x i32>
75 %b = sext <2 x i32> %a to <2 x i65>
78 define <2 x i64> @bars(<2 x i65> %t) {
79 %a = trunc <2 x i65> %t to <2 x i32>
80 %b = sext <2 x i32> %a to <2 x i64>
83 define <2 x i64> @quxs(<2 x i64> %t) {
84 %a = trunc <2 x i64> %t to <2 x i32>
85 %b = sext <2 x i32> %a to <2 x i64>
88 define <2 x i64> @quxt(<2 x i64> %t) {
89 %a = shl <2 x i64> %t, <i64 32, i64 32>
90 %b = ashr <2 x i64> %a, <i64 32, i64 32>
93 define <2 x double> @fa(<2 x double> %t) {
94 %a = fptrunc <2 x double> %t to <2 x float>
95 %b = fpext <2 x float> %a to <2 x double>
98 define <2 x double> @fb(<2 x double> %t) {
99 %a = fptoui <2 x double> %t to <2 x i64>
100 %b = uitofp <2 x i64> %a to <2 x double>
103 define <2 x double> @fc(<2 x double> %t) {
104 %a = fptosi <2 x double> %t to <2 x i64>
105 %b = sitofp <2 x i64> %a to <2 x double>