xref: /aosp_15_r20/external/llvm/test/CodeGen/ARM/fastisel-gep-promote-before-add.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; fastisel should not fold add with non-pointer bitwidth
2*9880d681SAndroid Build Coastguard Worker; sext(a) + sext(b) != sext(a + b)
3*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=armv7-apple-ios %s -O0 -o - | FileCheck %s
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workerdefine zeroext i8 @gep_promotion(i8* %ptr) nounwind uwtable ssp {
6*9880d681SAndroid Build Coastguard Workerentry:
7*9880d681SAndroid Build Coastguard Worker  %ptr.addr = alloca i8*, align 8
8*9880d681SAndroid Build Coastguard Worker  %add = add i8 64, 64 ; 0x40 + 0x40
9*9880d681SAndroid Build Coastguard Worker  %0 = load i8*, i8** %ptr.addr, align 8
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker  ; CHECK-LABEL: _gep_promotion:
12*9880d681SAndroid Build Coastguard Worker  ; CHECK: ldrb {{r[0-9]+}}, {{\[r[0-9]+\]}}
13*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds i8, i8* %0, i8 %add
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Worker  %1 = load i8, i8* %arrayidx, align 1
16*9880d681SAndroid Build Coastguard Worker  ret i8 %1
17*9880d681SAndroid Build Coastguard Worker}
18*9880d681SAndroid Build Coastguard Worker
19