blob: 9901c3ca3e4154819c8d5a547d619b1b9fa95b32 [file] [log] [blame]
; This file tests bitcasts of vector type. For most operations, these
; should be lowered to a no-op on -O2.
; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 \
; RUN: | FileCheck %s
; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 \
; RUN: | FileCheck --check-prefix=OPTM1 %s
define <16 x i8> @test_bitcast_v16i8_to_v16i8(<16 x i8> %arg) {
entry:
%res = bitcast <16 x i8> %arg to <16 x i8>
ret <16 x i8> %res
; CHECK-LABEL: test_bitcast_v16i8_to_v16i8
; CHECK-NEXT: ret
}
define <8 x i16> @test_bitcast_v16i8_to_v8i16(<16 x i8> %arg) {
entry:
%res = bitcast <16 x i8> %arg to <8 x i16>
ret <8 x i16> %res
; CHECK-LABEL: test_bitcast_v16i8_to_v8i16
; CHECK-NEXT: ret
}
define <4 x i32> @test_bitcast_v16i8_to_v4i32(<16 x i8> %arg) {
entry:
%res = bitcast <16 x i8> %arg to <4 x i32>
ret <4 x i32> %res
; CHECK-LABEL: test_bitcast_v16i8_to_v4i32
; CHECK-NEXT: ret
}
define <4 x float> @test_bitcast_v16i8_to_v4f32(<16 x i8> %arg) {
entry:
%res = bitcast <16 x i8> %arg to <4 x float>
ret <4 x float> %res
; CHECK-LABEL: test_bitcast_v16i8_to_v4f32
; CHECK-NEXT: ret
}
define <16 x i8> @test_bitcast_v8i16_to_v16i8(<8 x i16> %arg) {
entry:
%res = bitcast <8 x i16> %arg to <16 x i8>
ret <16 x i8> %res
; CHECK-LABEL: test_bitcast_v8i16_to_v16i8
; CHECK-NEXT: ret
}
define <8 x i16> @test_bitcast_v8i16_to_v8i16(<8 x i16> %arg) {
entry:
%res = bitcast <8 x i16> %arg to <8 x i16>
ret <8 x i16> %res
; CHECK-LABEL: test_bitcast_v8i16_to_v8i16
; CHECK-NEXT: ret
}
define <4 x i32> @test_bitcast_v8i16_to_v4i32(<8 x i16> %arg) {
entry:
%res = bitcast <8 x i16> %arg to <4 x i32>
ret <4 x i32> %res
; CHECK-LABEL: test_bitcast_v8i16_to_v4i32
; CHECK-NEXT: ret
}
define <4 x float> @test_bitcast_v8i16_to_v4f32(<8 x i16> %arg) {
entry:
%res = bitcast <8 x i16> %arg to <4 x float>
ret <4 x float> %res
; CHECK-LABEL: test_bitcast_v8i16_to_v4f32
; CHECK-NEXT: ret
}
define <16 x i8> @test_bitcast_v4i32_to_v16i8(<4 x i32> %arg) {
entry:
%res = bitcast <4 x i32> %arg to <16 x i8>
ret <16 x i8> %res
; CHECK-LABEL: test_bitcast_v4i32_to_v16i8
; CHECK-NEXT: ret
}
define <8 x i16> @test_bitcast_v4i32_to_v8i16(<4 x i32> %arg) {
entry:
%res = bitcast <4 x i32> %arg to <8 x i16>
ret <8 x i16> %res
; CHECK-LABEL: test_bitcast_v4i32_to_v8i16
; CHECK-NEXT: ret
}
define <4 x i32> @test_bitcast_v4i32_to_v4i32(<4 x i32> %arg) {
entry:
%res = bitcast <4 x i32> %arg to <4 x i32>
ret <4 x i32> %res
; CHECK-LABEL: test_bitcast_v4i32_to_v4i32
; CHECK-NEXT: ret
}
define <4 x float> @test_bitcast_v4i32_to_v4f32(<4 x i32> %arg) {
entry:
%res = bitcast <4 x i32> %arg to <4 x float>
ret <4 x float> %res
; CHECK-LABEL: test_bitcast_v4i32_to_v4f32
; CHECK-NEXT: ret
}
define <16 x i8> @test_bitcast_v4f32_to_v16i8(<4 x float> %arg) {
entry:
%res = bitcast <4 x float> %arg to <16 x i8>
ret <16 x i8> %res
; CHECK-LABEL: test_bitcast_v4f32_to_v16i8
; CHECK-NEXT: ret
}
define <8 x i16> @test_bitcast_v4f32_to_v8i16(<4 x float> %arg) {
entry:
%res = bitcast <4 x float> %arg to <8 x i16>
ret <8 x i16> %res
; CHECK-LABEL: test_bitcast_v4f32_to_v8i16
; CHECK-NEXT: ret
}
define <4 x i32> @test_bitcast_v4f32_to_v4i32(<4 x float> %arg) {
entry:
%res = bitcast <4 x float> %arg to <4 x i32>
ret <4 x i32> %res
; CHECK-LABEL: test_bitcast_v4f32_to_v4i32
; CHECK-NEXT: ret
}
define <4 x float> @test_bitcast_v4f32_to_v4f32(<4 x float> %arg) {
entry:
%res = bitcast <4 x float> %arg to <4 x float>
ret <4 x float> %res
; CHECK-LABEL: test_bitcast_v4f32_to_v4f32
; CHECK-NEXT: ret
}
define i8 @test_bitcast_v8i1_to_i8(<8 x i1> %arg) {
entry:
%res = bitcast <8 x i1> %arg to i8
ret i8 %res
; CHECK-LABEL: test_bitcast_v8i1_to_i8
; CHECK: call {{.*}} R_{{.*}} __Sz_bitcast_8xi1_i8
; OPTM1-LABEL: test_bitcast_v8i1_to_i8
; OPMT1: call -4
}
define i16 @test_bitcast_v16i1_to_i16(<16 x i1> %arg) {
entry:
%res = bitcast <16 x i1> %arg to i16
ret i16 %res
; CHECK-LABEL: test_bitcast_v16i1_to_i16
; CHECK: call {{.*}} R_{{.*}} __Sz_bitcast_16xi1_i16
; OPTM1-LABEL: test_bitcast_v16i1_to_i16
; OPMT1: call -4
}
define <8 x i1> @test_bitcast_i8_to_v8i1(i32 %arg) {
entry:
%arg.trunc = trunc i32 %arg to i8
%res = bitcast i8 %arg.trunc to <8 x i1>
ret <8 x i1> %res
; CHECK-LABEL: test_bitcast_i8_to_v8i1
; CHECK: call {{.*}} R_{{.*}} __Sz_bitcast_i8_8xi1
; OPTM1-LABEL: test_bitcast_i8_to_v8i1
; OPTM1: call {{.*}} R_{{.*}} __Sz_bitcast_i8_8xi1
}
define <16 x i1> @test_bitcast_i16_to_v16i1(i32 %arg) {
entry:
%arg.trunc = trunc i32 %arg to i16
%res = bitcast i16 %arg.trunc to <16 x i1>
ret <16 x i1> %res
; CHECK-LABEL: test_bitcast_i16_to_v16i1
; CHECK: call {{.*}} R_{{.*}} __Sz_bitcast_i16_16xi1
; OPTM1-LABEL: test_bitcast_i16_to_v16i1
; OPTM1: call {{.*}} R_{{.*}} __Sz_bitcast_i16_16xi1
}