Home | History | Annotate | Download | only in R600
      1 ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
      2 
      3 ; This test just checks that the compiler doesn't crash.
      4 
      5 declare void @llvm.SI.export(i32, i32, i32, i32, i32, float, float, float, float)
      6 
      7 ; FUNC-LABEL: @v32i8_to_v8i32
      8 ; SI: S_ENDPGM
      9 define void @v32i8_to_v8i32(<32 x i8> addrspace(2)* inreg) #0 {
     10 entry:
     11   %1 = load <32 x i8> addrspace(2)* %0
     12   %2 = bitcast <32 x i8> %1 to <8 x i32>
     13   %3 = extractelement <8 x i32> %2, i32 1
     14   %4 = icmp ne i32 %3, 0
     15   %5 = select i1 %4, float 0.0, float 1.0
     16   call void @llvm.SI.export(i32 15, i32 1, i32 1, i32 0, i32 1, float %5, float %5, float %5, float %5)
     17   ret void
     18 }
     19 
     20 ; FUNC-LABEL: @i8ptr_v16i8ptr
     21 ; SI: S_ENDPGM
     22 define void @i8ptr_v16i8ptr(<16 x i8> addrspace(1)* %out, i8 addrspace(1)* %in) {
     23 entry:
     24   %0 = bitcast i8 addrspace(1)* %in to <16 x i8> addrspace(1)*
     25   %1 = load <16 x i8> addrspace(1)* %0
     26   store <16 x i8> %1, <16 x i8> addrspace(1)* %out
     27   ret void
     28 }
     29 
     30 define void @f32_to_v2i16(<2 x i16> addrspace(1)* %out, float addrspace(1)* %in) nounwind {
     31   %load = load float addrspace(1)* %in, align 4
     32   %bc = bitcast float %load to <2 x i16>
     33   store <2 x i16> %bc, <2 x i16> addrspace(1)* %out, align 4
     34   ret void
     35 }
     36 
     37 define void @v2i16_to_f32(float addrspace(1)* %out, <2 x i16> addrspace(1)* %in) nounwind {
     38   %load = load <2 x i16> addrspace(1)* %in, align 4
     39   %bc = bitcast <2 x i16> %load to float
     40   store float %bc, float addrspace(1)* %out, align 4
     41   ret void
     42 }
     43 
     44 define void @v4i8_to_i32(i32 addrspace(1)* %out, <4 x i8> addrspace(1)* %in) nounwind {
     45   %load = load <4 x i8> addrspace(1)* %in, align 4
     46   %bc = bitcast <4 x i8> %load to i32
     47   store i32 %bc, i32 addrspace(1)* %out, align 4
     48   ret void
     49 }
     50 
     51 define void @i32_to_v4i8(<4 x i8> addrspace(1)* %out, i32 addrspace(1)* %in) nounwind {
     52   %load = load i32 addrspace(1)* %in, align 4
     53   %bc = bitcast i32 %load to <4 x i8>
     54   store <4 x i8> %bc, <4 x i8> addrspace(1)* %out, align 4
     55   ret void
     56 }
     57 
     58 ; FUNC-LABEL: @bitcast_v2i32_to_f64
     59 ; SI: S_ENDPGM
     60 define void @bitcast_v2i32_to_f64(double addrspace(1)* %out, <2 x i32> addrspace(1)* %in) {
     61   %val = load <2 x i32> addrspace(1)* %in, align 8
     62   %add = add <2 x i32> %val, <i32 4, i32 9>
     63   %bc = bitcast <2 x i32> %add to double
     64   store double %bc, double addrspace(1)* %out, align 8
     65   ret void
     66 }
     67 
     68 ; FUNC-LABEL: @bitcast_f64_to_v2i32
     69 ; SI: S_ENDPGM
     70 define void @bitcast_f64_to_v2i32(<2 x i32> addrspace(1)* %out, double addrspace(1)* %in) {
     71   %val = load double addrspace(1)* %in, align 8
     72   %add = fadd double %val, 4.0
     73   %bc = bitcast double %add to <2 x i32>
     74   store <2 x i32> %bc, <2 x i32> addrspace(1)* %out, align 8
     75   ret void
     76 }
     77 
     78 attributes #0 = { "ShaderType"="0" }
     79