You've already forked linux-packaging-mono
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
compiler-rt
eng
libcxx
libcxxabi
libunwind
lld
lldb
llvm
bindings
cmake
docs
examples
include
lib
projects
resources
runtimes
scripts
test
Analysis
Assembler
Bindings
Bitcode
BugPoint
CodeGen
AArch64
AMDGPU
ARC
ARM
AVR
BPF
Generic
Hexagon
Inputs
Lanai
MIR
MSP430
Mips
NVPTX
Nios2
PowerPC
RISCV
SPARC
SystemZ
Thumb
2007-01-31-RegInfoAssert.ll
2007-02-02-JoinIntervalsCrash.ll
2007-05-05-InvalidPushPop.ll
2009-06-18-ThumbCommuteMul.ll
2009-07-20-TwoAddrBug.ll
2009-07-27-PEIAssert.ll
2009-08-12-ConstIslandAssert.ll
2009-08-12-RegInfoAssert.ll
2009-08-20-ISelBug.ll
2009-12-17-pre-regalloc-taildup.ll
2010-06-18-SibCallCrash.ll
2010-07-01-FuncAlign.ll
2010-07-15-debugOrdering.ll
2011-05-11-DAGLegalizer.ll
2011-06-16-NoGPRs.ll
2011-EpilogueBug.ll
2012-04-26-M0ISelBug.ll
2014-06-10-thumb1-ldst-opt-bug.ll
DbgValueOtherTargets.test
PR17309.ll
PR36658.mir
addr-modes.ll
and_neg.ll
asmprinter-bug.ll
barrier.ll
bic_imm.ll
branchless-cmp.ll
callee_save.ll
cmp-add-fold.ll
cmp-fold.ll
constants.ll
copy_thumb.ll
cortex-m0-unaligned-access.ll
dyn-stackalloc.ll
fastcc.ll
fpconv.ll
fpow.ll
frame_thumb.ll
iabs.ll
inlineasm-imm-thumb.ll
inlineasm-thumb.ll
ispositive.ll
large-stack.ll
ldm-merge-call.ll
ldm-merge-struct.ll
ldm-stm-base-materialization-thumb2.ll
ldm-stm-base-materialization.ll
ldm-stm-postinc.ll
ldr_ext.ll
ldr_frame.ll
lit.local.cfg
litpoolremat.ll
long-setcc.ll
long.ll
long_shift.ll
machine-cse-physreg.mir
mature-mc-support.ll
mul.ll
optionaldef-scheduling.ll
pop.ll
pr35836.ll
pr35836_2.ll
push.ll
remove-unneeded-push-pop.ll
rev.ll
segmented-stacks-dynamic.ll
segmented-stacks.ll
select.ll
sjljehprepare-lower-vector.ll
stack-access.ll
stack-coloring-without-frame-ptr.ll
stack-frame.ll
stack_guard_remat.ll
stm-deprecated.ll
stm-merge.ll
stm-scavenging.ll
tbb-reuse.mir
thumb-imm.ll
thumb-ldm.ll
thumb-shrink-wrapping.ll
trap.ll
triple.ll
tst_teq.ll
unord.ll
vargs.ll
Thumb2
WebAssembly
WinEH
X86
XCore
DebugInfo
Examples
ExecutionEngine
Feature
FileCheck
Instrumentation
Integer
JitListener
LTO
Linker
MC
Object
ObjectYAML
Other
SafepointIRVerifier
SymbolRewriter
TableGen
ThinLTO
Transforms
Unit
Verifier
YAMLParser
tools
.clang-format
CMakeLists.txt
TestRunner.sh
lit.cfg.py
lit.site.cfg.py.in
tools
unittests
utils
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in
version.txt.in
nuget
openmp
polly
Directory.Build.props
Directory.Build.targets
NuGet.config
azure-pipelines.yml
build.cmd
build.sh
dir.common.props
global.json
llvm.proj
mxe-Win64.cmake.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
136 lines
3.8 KiB
LLVM
136 lines
3.8 KiB
LLVM
![]() |
; RUN: llc -mtriple=thumb-eabi < %s -o - | FileCheck %s
|
||
|
|
||
|
; Check that stack addresses are generated using a single ADD
|
||
|
define void @test1(i8** %p) {
|
||
|
%x = alloca i8, align 1
|
||
|
%y = alloca i8, align 1
|
||
|
%z = alloca i8, align 1
|
||
|
; CHECK: add r1, sp, #8
|
||
|
; CHECK: str r1, [r0]
|
||
|
store volatile i8* %x, i8** %p, align 4
|
||
|
; CHECK: add r1, sp, #4
|
||
|
; CHECK: str r1, [r0]
|
||
|
store volatile i8* %y, i8** %p, align 4
|
||
|
; CHECK: mov r1, sp
|
||
|
; CHECK: str r1, [r0]
|
||
|
store volatile i8* %z, i8** %p, align 4
|
||
|
ret void
|
||
|
}
|
||
|
|
||
|
; Stack offsets larger than 1020 still need two ADDs
|
||
|
define void @test2([1024 x i8]** %p) {
|
||
|
%arr1 = alloca [1024 x i8], align 1
|
||
|
%arr2 = alloca [1024 x i8], align 1
|
||
|
; CHECK: add r1, sp, #1020
|
||
|
; CHECK: adds r1, #4
|
||
|
; CHECK: str r1, [r0]
|
||
|
store volatile [1024 x i8]* %arr1, [1024 x i8]** %p, align 4
|
||
|
; CHECK: mov r1, sp
|
||
|
; CHECK: str r1, [r0]
|
||
|
store volatile [1024 x i8]* %arr2, [1024 x i8]** %p, align 4
|
||
|
ret void
|
||
|
}
|
||
|
|
||
|
; If possible stack-based lrdb/ldrh are widened to use SP-based addressing
|
||
|
define i32 @test3() #0 {
|
||
|
%x = alloca i8, align 1
|
||
|
%y = alloca i8, align 1
|
||
|
; CHECK: ldr r0, [sp]
|
||
|
%1 = load i8, i8* %x, align 1
|
||
|
; CHECK: ldr r1, [sp, #4]
|
||
|
%2 = load i8, i8* %y, align 1
|
||
|
%3 = add nsw i8 %1, %2
|
||
|
%4 = zext i8 %3 to i32
|
||
|
ret i32 %4
|
||
|
}
|
||
|
|
||
|
define i32 @test4() #0 {
|
||
|
%x = alloca i16, align 2
|
||
|
%y = alloca i16, align 2
|
||
|
; CHECK: ldr r0, [sp]
|
||
|
%1 = load i16, i16* %x, align 2
|
||
|
; CHECK: ldr r1, [sp, #4]
|
||
|
%2 = load i16, i16* %y, align 2
|
||
|
%3 = add nsw i16 %1, %2
|
||
|
%4 = zext i16 %3 to i32
|
||
|
ret i32 %4
|
||
|
}
|
||
|
|
||
|
; Don't widen if the value needs to be zero-extended
|
||
|
define zeroext i8 @test5() {
|
||
|
%x = alloca i8, align 1
|
||
|
; CHECK: mov r0, sp
|
||
|
; CHECK: ldrb r0, [r0]
|
||
|
%1 = load i8, i8* %x, align 1
|
||
|
ret i8 %1
|
||
|
}
|
||
|
|
||
|
define zeroext i16 @test6() {
|
||
|
%x = alloca i16, align 2
|
||
|
; CHECK: mov r0, sp
|
||
|
; CHECK: ldrh r0, [r0]
|
||
|
%1 = load i16, i16* %x, align 2
|
||
|
ret i16 %1
|
||
|
}
|
||
|
|
||
|
; Accessing the bottom of a large array shouldn't require materializing a base
|
||
|
;
|
||
|
; CHECK: movs [[REG:r[0-9]+]], #1
|
||
|
; CHECK: str [[REG]], [sp, #16]
|
||
|
; CHECK: str [[REG]], [sp, #4]
|
||
|
|
||
|
define void @test7() {
|
||
|
%arr = alloca [200 x i32], align 4
|
||
|
|
||
|
%arrayidx = getelementptr inbounds [200 x i32], [200 x i32]* %arr, i32 0, i32 1
|
||
|
store i32 1, i32* %arrayidx, align 4
|
||
|
|
||
|
%arrayidx1 = getelementptr inbounds [200 x i32], [200 x i32]* %arr, i32 0, i32 4
|
||
|
store i32 1, i32* %arrayidx1, align 4
|
||
|
|
||
|
ret void
|
||
|
}
|
||
|
|
||
|
; Check that loads/stores with out-of-range offsets are handled correctly
|
||
|
define void @test8() {
|
||
|
%arr3 = alloca [224 x i32], align 4
|
||
|
%arr2 = alloca [224 x i32], align 4
|
||
|
%arr1 = alloca [224 x i32], align 4
|
||
|
|
||
|
; CHECK: movs [[REG:r[0-9]+]], #1
|
||
|
; CHECK-DAG: str [[REG]], [sp]
|
||
|
%arr1idx1 = getelementptr inbounds [224 x i32], [224 x i32]* %arr1, i32 0, i32 0
|
||
|
store i32 1, i32* %arr1idx1, align 4
|
||
|
|
||
|
; Offset in range for sp-based store, but not for non-sp-based store
|
||
|
; CHECK-DAG: str [[REG]], [sp, #128]
|
||
|
%arr1idx2 = getelementptr inbounds [224 x i32], [224 x i32]* %arr1, i32 0, i32 32
|
||
|
store i32 1, i32* %arr1idx2, align 4
|
||
|
|
||
|
; CHECK-DAG: str [[REG]], [sp, #896]
|
||
|
%arr2idx1 = getelementptr inbounds [224 x i32], [224 x i32]* %arr2, i32 0, i32 0
|
||
|
store i32 1, i32* %arr2idx1, align 4
|
||
|
|
||
|
; %arr2 is in range, but this element of it is not
|
||
|
; CHECK-DAG: ldr [[RA:r[0-9]+]], .LCPI7_2
|
||
|
; CHECK-DAG: add [[RA]], sp
|
||
|
; CHECK-DAG: str [[REG]], [{{r[0-9]+}}]
|
||
|
%arr2idx2 = getelementptr inbounds [224 x i32], [224 x i32]* %arr2, i32 0, i32 32
|
||
|
store i32 1, i32* %arr2idx2, align 4
|
||
|
|
||
|
; %arr3 is not in range
|
||
|
; CHECK-DAG: ldr [[RB:r[0-9]+]], .LCPI7_3
|
||
|
; CHECK-DAG: add [[RB]], sp
|
||
|
; CHECK-DAG: str [[REG]], [{{r[0-9]+}}]
|
||
|
%arr3idx1 = getelementptr inbounds [224 x i32], [224 x i32]* %arr3, i32 0, i32 0
|
||
|
store i32 1, i32* %arr3idx1, align 4
|
||
|
|
||
|
; CHECK-DAG: ldr [[RC:r[0-9]+]], .LCPI7_4
|
||
|
; CHECK-DAG: add [[RC]], sp
|
||
|
; CHECK-DAG: str [[REG]], [{{r[0-9]+}}]
|
||
|
%arr3idx2 = getelementptr inbounds [224 x i32], [224 x i32]* %arr3, i32 0, i32 32
|
||
|
store i32 1, i32* %arr3idx2, align 4
|
||
|
|
||
|
ret void
|
||
|
}
|