1; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s 2; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s 3 4; This test just checks that the compiler doesn't crash. 5 6; FUNC-LABEL: {{^}}v32i8_to_v8i32: 7define amdgpu_ps float @v32i8_to_v8i32(<32 x i8> addrspace(2)* inreg) #0 { 8entry: 9 %1 = load <32 x i8>, <32 x i8> addrspace(2)* %0 10 %2 = bitcast <32 x i8> %1 to <8 x i32> 11 %3 = extractelement <8 x i32> %2, i32 1 12 %4 = icmp ne i32 %3, 0 13 %5 = select i1 %4, float 0.0, float 1.0 14 ret float %5 15} 16 17; FUNC-LABEL: {{^}}i8ptr_v16i8ptr: 18; SI: s_endpgm 19define void @i8ptr_v16i8ptr(<16 x i8> addrspace(1)* %out, i8 addrspace(1)* %in) { 20entry: 21 %0 = bitcast i8 addrspace(1)* %in to <16 x i8> addrspace(1)* 22 %1 = load <16 x i8>, <16 x i8> addrspace(1)* %0 23 store <16 x i8> %1, <16 x i8> addrspace(1)* %out 24 ret void 25} 26 27define void @f32_to_v2i16(<2 x i16> addrspace(1)* %out, float addrspace(1)* %in) nounwind { 28 %load = load float, float addrspace(1)* %in, align 4 29 %bc = bitcast float %load to <2 x i16> 30 store <2 x i16> %bc, <2 x i16> addrspace(1)* %out, align 4 31 ret void 32} 33 34define void @v2i16_to_f32(float addrspace(1)* %out, <2 x i16> addrspace(1)* %in) nounwind { 35 %load = load <2 x i16>, <2 x i16> addrspace(1)* %in, align 4 36 %bc = bitcast <2 x i16> %load to float 37 store float %bc, float addrspace(1)* %out, align 4 38 ret void 39} 40 41define void @v4i8_to_i32(i32 addrspace(1)* %out, <4 x i8> addrspace(1)* %in) nounwind { 42 %load = load <4 x i8>, <4 x i8> addrspace(1)* %in, align 4 43 %bc = bitcast <4 x i8> %load to i32 44 store i32 %bc, i32 addrspace(1)* %out, align 4 45 ret void 46} 47 48define void @i32_to_v4i8(<4 x i8> addrspace(1)* %out, i32 addrspace(1)* %in) nounwind { 49 %load = load i32, i32 addrspace(1)* %in, align 4 50 %bc = bitcast i32 %load to <4 x i8> 51 store <4 x i8> %bc, <4 x i8> addrspace(1)* %out, align 4 52 ret void 53} 54 55; FUNC-LABEL: {{^}}bitcast_v2i32_to_f64: 56; SI: s_endpgm 57define void @bitcast_v2i32_to_f64(double addrspace(1)* %out, <2 x i32> addrspace(1)* %in) { 58 %val = load <2 x i32>, <2 x i32> addrspace(1)* %in, align 8 59 %add = add <2 x i32> %val, <i32 4, i32 9> 60 %bc = bitcast <2 x i32> %add to double 61 store double %bc, double addrspace(1)* %out, align 8 62 ret void 63} 64 65; FUNC-LABEL: {{^}}bitcast_f64_to_v2i32: 66; SI: s_endpgm 67define void @bitcast_f64_to_v2i32(<2 x i32> addrspace(1)* %out, double addrspace(1)* %in) { 68 %val = load double, double addrspace(1)* %in, align 8 69 %add = fadd double %val, 4.0 70 %bc = bitcast double %add to <2 x i32> 71 store <2 x i32> %bc, <2 x i32> addrspace(1)* %out, align 8 72 ret void 73} 74 75; FUNC-LABEL: {{^}}bitcast_v2i64_to_v2f64: 76define void @bitcast_v2i64_to_v2f64(i32 %cond, <2 x double> addrspace(1)* %out, <2 x i64> %value) { 77entry: 78 %cmp0 = icmp eq i32 %cond, 0 79 br i1 %cmp0, label %if, label %end 80 81if: 82 %cast = bitcast <2 x i64> %value to <2 x double> 83 br label %end 84 85end: 86 %phi = phi <2 x double> [zeroinitializer, %entry], [%cast, %if] 87 store <2 x double> %phi, <2 x double> addrspace(1)* %out 88 ret void 89} 90 91; FUNC-LABEL: {{^}}bitcast_v2f64_to_v2i64: 92define void @bitcast_v2f64_to_v2i64(i32 %cond, <2 x i64> addrspace(1)* %out, <2 x double> %value) { 93entry: 94 %cmp0 = icmp eq i32 %cond, 0 95 br i1 %cmp0, label %if, label %end 96 97if: 98 %cast = bitcast <2 x double> %value to <2 x i64> 99 br label %end 100 101end: 102 %phi = phi <2 x i64> [zeroinitializer, %entry], [%cast, %if] 103 store <2 x i64> %phi, <2 x i64> addrspace(1)* %out 104 ret void 105} 106