xref: /aosp_15_r20/external/llvm/test/CodeGen/SPARC/select-mask.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=sparc < %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker;; getBooleanContents on Sparc used to claim that no bits mattered
4*9880d681SAndroid Build Coastguard Worker;; other than the first for SELECT. Thus, the 'trunc' got eliminated
5*9880d681SAndroid Build Coastguard Worker;; as redundant. But, cmp does NOT ignore the other bits!
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: select_mask:
8*9880d681SAndroid Build Coastguard Worker; CHECK: ldub [%o0], [[R:%[goli][0-7]]]
9*9880d681SAndroid Build Coastguard Worker; CHECK: and [[R]], 1, [[V:%[goli][0-7]]]
10*9880d681SAndroid Build Coastguard Worker; CHECK: cmp [[V]], 0
11*9880d681SAndroid Build Coastguard Workerdefine i32 @select_mask(i8* %this) {
12*9880d681SAndroid Build Coastguard Workerentry:
13*9880d681SAndroid Build Coastguard Worker  %bf.load2 = load i8, i8* %this, align 4
14*9880d681SAndroid Build Coastguard Worker  %bf.cast5 = trunc i8 %bf.load2 to i1
15*9880d681SAndroid Build Coastguard Worker  %cond = select i1 %bf.cast5, i32 2, i32 0
16*9880d681SAndroid Build Coastguard Worker  ret i32 %cond
17*9880d681SAndroid Build Coastguard Worker}
18