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