Home | History | Annotate | Download | only in AMDGPU
      1 ; XFAIL: *
      2 ; RUN: llc -verify-machineinstrs -march=amdgcn -mcpu=SI -mattr=-promote-alloca < %s | FileCheck -check-prefix=SI %s
      3 ; RUN: llc -verify-machineinstrs -march=amdgcn -mcpu=tonga -mattr=-promote-alloca < %s | FileCheck -check-prefix=SI %s
      4 
      5 ; 64-bit select was originally lowered with a build_pair, and this
      6 ; could be simplified to 1 cndmask instead of 2, but that broken when
      7 ; it started being implemented with a v2i32 build_vector and
      8 ; bitcasting.
      9 define void @trunc_select_i64(i32 addrspace(1)* %out, i64 %a, i64 %b, i32 %c) {
     10   %cmp = icmp eq i32 %c, 0
     11   %select = select i1 %cmp, i64 %a, i64 %b
     12   %trunc = trunc i64 %select to i32
     13   store i32 %trunc, i32 addrspace(1)* %out, align 4
     14   ret void
     15 }
     16 
     17 ; FIXME: Fix truncating store for local memory
     18 ; SI-LABEL: {{^}}trunc_load_alloca_i64:
     19 ; SI: v_movrels_b32
     20 ; SI-NOT: v_movrels_b32
     21 ; SI: s_endpgm
     22 define void @trunc_load_alloca_i64(i64 addrspace(1)* %out, i32 %a, i32 %b) {
     23   %idx = add i32 %a, %b
     24   %alloca = alloca i64, i32 4
     25   %gep0 = getelementptr i64, i64* %alloca, i64 0
     26   %gep1 = getelementptr i64, i64* %alloca, i64 1
     27   %gep2 = getelementptr i64, i64* %alloca, i64 2
     28   %gep3 = getelementptr i64, i64* %alloca, i64 3
     29   store i64 24, i64* %gep0, align 8
     30   store i64 9334, i64* %gep1, align 8
     31   store i64 3935, i64* %gep2, align 8
     32   store i64 9342, i64* %gep3, align 8
     33   %gep = getelementptr i64, i64* %alloca, i32 %idx
     34   %load = load i64, i64* %gep, align 8
     35   %mask = and i64 %load, 4294967296
     36   %add = add i64 %mask, -1
     37   store i64 %add, i64 addrspace(1)* %out, align 4
     38   ret void
     39 }
     40