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 %fadd32 = fadd float %load, 1.0 30 %bc = bitcast float %fadd32 to <2 x i16> 31 %add.bitcast = add <2 x i16> %bc, <i16 2, i16 2> 32 store <2 x i16> %add.bitcast, <2 x i16> addrspace(1)* %out 33 ret void 34} 35 36define void @v2i16_to_f32(float addrspace(1)* %out, <2 x i16> addrspace(1)* %in) nounwind { 37 %load = load <2 x i16>, <2 x i16> addrspace(1)* %in, align 4 38 %add.v2i16 = add <2 x i16> %load, <i16 2, i16 2> 39 %bc = bitcast <2 x i16> %add.v2i16 to float 40 %fadd.bitcast = fadd float %bc, 1.0 41 store float %fadd.bitcast, float addrspace(1)* %out 42 ret void 43} 44 45define void @f32_to_v2f16(<2 x half> addrspace(1)* %out, float addrspace(1)* %in) nounwind { 46 %load = load float, float addrspace(1)* %in, align 4 47 %fadd32 = fadd float %load, 1.0 48 %bc = bitcast float %fadd32 to <2 x half> 49 %add.bitcast = fadd <2 x half> %bc, <half 2.0, half 2.0> 50 store <2 x half> %add.bitcast, <2 x half> addrspace(1)* %out 51 ret void 52} 53 54define void @v2f16_to_f32(float addrspace(1)* %out, <2 x half> addrspace(1)* %in) nounwind { 55 %load = load <2 x half>, <2 x half> addrspace(1)* %in, align 4 56 %add.v2f16 = fadd <2 x half> %load, <half 2.0, half 2.0> 57 %bc = bitcast <2 x half> %add.v2f16 to float 58 %fadd.bitcast = fadd float %bc, 1.0 59 store float %fadd.bitcast, float addrspace(1)* %out 60 ret void 61} 62 63define void @v4i8_to_i32(i32 addrspace(1)* %out, <4 x i8> addrspace(1)* %in) nounwind { 64 %load = load <4 x i8>, <4 x i8> addrspace(1)* %in, align 4 65 %bc = bitcast <4 x i8> %load to i32 66 store i32 %bc, i32 addrspace(1)* %out, align 4 67 ret void 68} 69 70define void @i32_to_v4i8(<4 x i8> addrspace(1)* %out, i32 addrspace(1)* %in) nounwind { 71 %load = load i32, i32 addrspace(1)* %in, align 4 72 %bc = bitcast i32 %load to <4 x i8> 73 store <4 x i8> %bc, <4 x i8> addrspace(1)* %out, align 4 74 ret void 75} 76 77; FUNC-LABEL: {{^}}bitcast_v2i32_to_f64: 78; SI: s_endpgm 79define void @bitcast_v2i32_to_f64(double addrspace(1)* %out, <2 x i32> addrspace(1)* %in) { 80 %val = load <2 x i32>, <2 x i32> addrspace(1)* %in, align 8 81 %add = add <2 x i32> %val, <i32 4, i32 9> 82 %bc = bitcast <2 x i32> %add to double 83 %fadd.bc = fadd double %bc, 1.0 84 store double %fadd.bc, double addrspace(1)* %out, align 8 85 ret void 86} 87 88; FUNC-LABEL: {{^}}bitcast_f64_to_v2i32: 89; SI: s_endpgm 90define void @bitcast_f64_to_v2i32(<2 x i32> addrspace(1)* %out, double addrspace(1)* %in) { 91 %val = load double, double addrspace(1)* %in, align 8 92 %add = fadd double %val, 4.0 93 %bc = bitcast double %add to <2 x i32> 94 store <2 x i32> %bc, <2 x i32> addrspace(1)* %out, align 8 95 ret void 96} 97 98; FUNC-LABEL: {{^}}bitcast_v2i64_to_v2f64: 99define void @bitcast_v2i64_to_v2f64(i32 %cond, <2 x double> addrspace(1)* %out, <2 x i64> %value) { 100entry: 101 %cmp0 = icmp eq i32 %cond, 0 102 br i1 %cmp0, label %if, label %end 103 104if: 105 %cast = bitcast <2 x i64> %value to <2 x double> 106 br label %end 107 108end: 109 %phi = phi <2 x double> [zeroinitializer, %entry], [%cast, %if] 110 store <2 x double> %phi, <2 x double> addrspace(1)* %out 111 ret void 112} 113 114; FUNC-LABEL: {{^}}bitcast_v2f64_to_v2i64: 115define void @bitcast_v2f64_to_v2i64(i32 %cond, <2 x i64> addrspace(1)* %out, <2 x double> %value) { 116entry: 117 %cmp0 = icmp eq i32 %cond, 0 118 br i1 %cmp0, label %if, label %end 119 120if: 121 %cast = bitcast <2 x double> %value to <2 x i64> 122 br label %end 123 124end: 125 %phi = phi <2 x i64> [zeroinitializer, %entry], [%cast, %if] 126 store <2 x i64> %phi, <2 x i64> addrspace(1)* %out 127 ret void 128} 129