1 ; RUN: opt < %s -instcombine -S | FileCheck %s
3 ; Check all scalar / vector combinations for a pair of bitcasts.
5 define ppc_fp128 @bitcast_bitcast_s_s_s(i128 %a) {
6 %bc1 = bitcast i128 %a to fp128
7 %bc2 = bitcast fp128 %bc1 to ppc_fp128
10 ; CHECK-LABEL: @bitcast_bitcast_s_s_s(
11 ; CHECK-NEXT: %bc2 = bitcast i128 %a to ppc_fp128
12 ; CHECK-NEXT: ret ppc_fp128 %bc2
15 define <2 x i32> @bitcast_bitcast_s_s_v(i64 %a) {
16 %bc1 = bitcast i64 %a to double
17 %bc2 = bitcast double %bc1 to <2 x i32>
20 ; CHECK-LABEL: @bitcast_bitcast_s_s_v(
21 ; CHECK-NEXT: %bc2 = bitcast i64 %a to <2 x i32>
22 ; CHECK-NEXT: ret <2 x i32> %bc2
25 define double @bitcast_bitcast_s_v_s(i64 %a) {
26 %bc1 = bitcast i64 %a to <2 x i32>
27 %bc2 = bitcast <2 x i32> %bc1 to double
30 ; CHECK-LABEL: @bitcast_bitcast_s_v_s(
31 ; CHECK-NEXT: %bc2 = bitcast i64 %a to double
32 ; CHECK-NEXT: ret double %bc2
35 define <2 x i32> @bitcast_bitcast_s_v_v(i64 %a) {
36 %bc1 = bitcast i64 %a to <4 x i16>
37 %bc2 = bitcast <4 x i16> %bc1 to <2 x i32>
40 ; CHECK-LABEL: @bitcast_bitcast_s_v_v(
41 ; CHECK-NEXT: %bc2 = bitcast i64 %a to <2 x i32>
42 ; CHECK-NEXT: ret <2 x i32> %bc2
45 define i64 @bitcast_bitcast_v_s_s(<2 x i32> %a) {
46 %bc1 = bitcast <2 x i32> %a to double
47 %bc2 = bitcast double %bc1 to i64
50 ; CHECK-LABEL: @bitcast_bitcast_v_s_s(
51 ; CHECK-NEXT: %bc2 = bitcast <2 x i32> %a to i64
52 ; CHECK-NEXT: ret i64 %bc2
55 define <4 x i16> @bitcast_bitcast_v_s_v(<2 x i32> %a) {
56 %bc1 = bitcast <2 x i32> %a to double
57 %bc2 = bitcast double %bc1 to <4 x i16>
60 ; CHECK-LABEL: @bitcast_bitcast_v_s_v(
61 ; CHECK-NEXT: %bc2 = bitcast <2 x i32> %a to <4 x i16>
62 ; CHECK-NEXT: ret <4 x i16> %bc2
65 define double @bitcast_bitcast_v_v_s(<2 x float> %a) {
66 %bc1 = bitcast <2 x float> %a to <4 x i16>
67 %bc2 = bitcast <4 x i16> %bc1 to double
70 ; CHECK-LABEL: @bitcast_bitcast_v_v_s(
71 ; CHECK-NEXT: %bc2 = bitcast <2 x float> %a to double
72 ; CHECK-NEXT: ret double %bc2
75 define <2 x i32> @bitcast_bitcast_v_v_v(<2 x float> %a) {
76 %bc1 = bitcast <2 x float> %a to <4 x i16>
77 %bc2 = bitcast <4 x i16> %bc1 to <2 x i32>
80 ; CHECK-LABEL: @bitcast_bitcast_v_v_v(
81 ; CHECK-NEXT: %bc2 = bitcast <2 x float> %a to <2 x i32>
82 ; CHECK-NEXT: ret <2 x i32> %bc2