summaryrefslogtreecommitdiffstats
path: root/test/CodeGen
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2013-12-01 15:54:07 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2013-12-01 15:54:07 +0000
commit102f231863034e18863333bf850f8037b46e6947 (patch)
tree3a663926a2222874d2aef35b5dd0c531a5ab6cc9 /test/CodeGen
parentff4b604f961aa9b9ec2f05a5c31885b19fa636e4 (diff)
downloadexternal_llvm-102f231863034e18863333bf850f8037b46e6947.zip
external_llvm-102f231863034e18863333bf850f8037b46e6947.tar.gz
external_llvm-102f231863034e18863333bf850f8037b46e6947.tar.bz2
Merged r195973:
------------------------------------------------------------------------ r195973 | dsanders | 2013-11-30 13:47:57 +0000 (Sat, 30 Nov 2013) | 5 lines [mips][msa] MSA loads and stores have a 10-bit offset. Account for this when lowering FrameIndex. This prevents the compiler from emitting invalid ld.[bhwd]'s and st.[bhwd]'s when the stack frame is between 512 and 32,768 bytes in size. ------------------------------------------------------------------------ Review of this commit by Matheus Almeida revealed that it is still possible to emit invalid code (when the offset is not a multiple of the element size). However, we agreed that this commit still represents an improvement since it fixes many cases that previously emitted invalid code, and does not cause any cases that previously emitted valid code to emit invalid code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_34@196049 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/Mips/msa/frameindex.ll85
1 files changed, 85 insertions, 0 deletions
diff --git a/test/CodeGen/Mips/msa/frameindex.ll b/test/CodeGen/Mips/msa/frameindex.ll
new file mode 100644
index 0000000..3088e1b
--- /dev/null
+++ b/test/CodeGen/Mips/msa/frameindex.ll
@@ -0,0 +1,85 @@
+; RUN: llc -march=mips -mattr=+msa,+fp64 < %s | FileCheck -check-prefix=MIPS32-AE -check-prefix=MIPS32-BE %s
+; RUN: llc -march=mipsel -mattr=+msa,+fp64 < %s | FileCheck -check-prefix=MIPS32-AE -check-prefix=MIPS32-LE %s
+
+define void @loadstore_v16i8_near() nounwind {
+ ; MIPS32-AE: loadstore_v16i8_near:
+
+ %1 = alloca <16 x i8>
+ %2 = load volatile <16 x i8>* %1
+ ; MIPS32-AE: ld.b [[R1:\$w[0-9]+]], 0($sp)
+ store volatile <16 x i8> %2, <16 x i8>* %1
+ ; MIPS32-AE: st.b [[R1]], 0($sp)
+
+ ret void
+ ; MIPS32-AE: .size loadstore_v16i8_near
+}
+
+define void @loadstore_v16i8_just_under_simm10() nounwind {
+ ; MIPS32-AE: loadstore_v16i8_just_under_simm10:
+
+ %1 = alloca <16 x i8>
+ %2 = alloca [496 x i8] ; Push the frame right up to 512 bytes
+
+ %3 = load volatile <16 x i8>* %1
+ ; MIPS32-AE: ld.b [[R1:\$w[0-9]+]], 496($sp)
+ store volatile <16 x i8> %3, <16 x i8>* %1
+ ; MIPS32-AE: st.b [[R1]], 496($sp)
+
+ ret void
+ ; MIPS32-AE: .size loadstore_v16i8_just_under_simm10
+}
+
+define void @loadstore_v16i8_just_over_simm10() nounwind {
+ ; MIPS32-AE: loadstore_v16i8_just_over_simm10:
+
+ %1 = alloca <16 x i8>
+ %2 = alloca [497 x i8] ; Push the frame just over 512 bytes
+
+ %3 = load volatile <16 x i8>* %1
+ ; MIPS32-AE: addiu [[BASE:\$[0-9]+]], $sp, 512
+ ; MIPS32-AE: ld.b [[R1:\$w[0-9]+]], 0([[BASE]])
+ store volatile <16 x i8> %3, <16 x i8>* %1
+ ; MIPS32-AE: addiu [[BASE:\$[0-9]+]], $sp, 512
+ ; MIPS32-AE: st.b [[R1]], 0([[BASE]])
+
+ ret void
+ ; MIPS32-AE: .size loadstore_v16i8_just_over_simm10
+}
+
+define void @loadstore_v16i8_just_under_simm16() nounwind {
+ ; MIPS32-AE: loadstore_v16i8_just_under_simm16:
+
+ %1 = alloca <16 x i8>
+ %2 = alloca [32752 x i8] ; Push the frame right up to 32768 bytes
+
+ %3 = load volatile <16 x i8>* %1
+ ; MIPS32-AE: ori [[R2:\$[0-9]+]], $zero, 32768
+ ; MIPS32-AE: addu [[BASE:\$[0-9]+]], $sp, [[R2]]
+ ; MIPS32-AE: ld.b [[R1:\$w[0-9]+]], 0([[BASE]])
+ store volatile <16 x i8> %3, <16 x i8>* %1
+ ; MIPS32-AE: ori [[R2:\$[0-9]+]], $zero, 32768
+ ; MIPS32-AE: addu [[BASE:\$[0-9]+]], $sp, [[R2]]
+ ; MIPS32-AE: st.b [[R1]], 0([[BASE]])
+
+ ret void
+ ; MIPS32-AE: .size loadstore_v16i8_just_under_simm16
+}
+
+define void @loadstore_v16i8_just_over_simm16() nounwind {
+ ; MIPS32-AE: loadstore_v16i8_just_over_simm16:
+
+ %1 = alloca <16 x i8>
+ %2 = alloca [32753 x i8] ; Push the frame just over 32768 bytes
+
+ %3 = load volatile <16 x i8>* %1
+ ; MIPS32-AE: ori [[R2:\$[0-9]+]], $zero, 32768
+ ; MIPS32-AE: addu [[BASE:\$[0-9]+]], $sp, [[R2]]
+ ; MIPS32-AE: ld.b [[R1:\$w[0-9]+]], 0([[BASE]])
+ store volatile <16 x i8> %3, <16 x i8>* %1
+ ; MIPS32-AE: ori [[R2:\$[0-9]+]], $zero, 32768
+ ; MIPS32-AE: addu [[BASE:\$[0-9]+]], $sp, [[R2]]
+ ; MIPS32-AE: st.b [[R1]], 0([[BASE]])
+
+ ret void
+ ; MIPS32-AE: .size loadstore_v16i8_just_over_simm16
+}