summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorSimon Dardis <simon.dardis@imgtec.com>2016-07-18 13:17:31 +0000
committerSimon Dardis <simon.dardis@imgtec.com>2016-07-18 13:17:31 +0000
commitd32a2d30cbe10cb966d0d98819a657eb209d1b47 (patch)
tree62023d4a385b771a72ac2bcb4464be96910bb71e /llvm/test
parentde69d406862c7978f35bdbcb0bd10a510e77560c (diff)
downloadbcm5719-llvm-d32a2d30cbe10cb966d0d98819a657eb209d1b47.tar.gz
bcm5719-llvm-d32a2d30cbe10cb966d0d98819a657eb209d1b47.zip
[inlineasm] Propagate operand constraints to the backend
When SelectionDAGISel transforms a node representing an inline asm block, memory constraint information is not preserved. This can cause constraints to be broken when a memory offset is of the form: offset + frame index when the frame is resolved. By propagating the constraints all the way to the backend, targets can enforce memory operands of inline assembly to conform to their constraints. For MIPSR6, some instructions had their offsets reduced to 9 bits from 16 bits such as ll/sc. This becomes problematic when using inline assembly to perform atomic operations, as an offset can generated that is too big to encode in the instruction. Reviewers: dsanders, vkalintris Differential Review: https://reviews.llvm.org/D21615 llvm-svn: 275786
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/Mips/inlineasm-constraint_ZC_2.ll36
1 files changed, 36 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/Mips/inlineasm-constraint_ZC_2.ll b/llvm/test/CodeGen/Mips/inlineasm-constraint_ZC_2.ll
new file mode 100644
index 00000000000..a99cb976eaa
--- /dev/null
+++ b/llvm/test/CodeGen/Mips/inlineasm-constraint_ZC_2.ll
@@ -0,0 +1,36 @@
+; RUN: llc -march=mips -mcpu=mips32r6 < %s | FileCheck %s --check-prefixes=ALL,R6
+; RUN: llc -march=mips -mcpu=mips64r6 -target-abi=n64 < %s | FileCheck %s --check-prefixes=ALL,R6
+; RUN: llc -march=mips -mcpu=mips32 < %s | FileCheck %s --check-prefixes=ALL,PRER6
+; RUN: llc -march=mips -mcpu=mips64 -target-abi=n64 < %s | FileCheck %s --check-prefixes=ALL,PRER6
+
+
+%struct.anon = type { [63 x i32], i32, i32 }
+
+define i32 @Atomic() {
+; CHECK-LABEL: Atomic:
+entry:
+ %s = alloca %struct.anon, align 4
+ %0 = bitcast %struct.anon* %s to i8*
+ %count = getelementptr inbounds %struct.anon, %struct.anon* %s, i64 0, i32 1
+ store i32 0, i32* %count, align 4
+; R6: addiu $[[R0:[0-9a-z]+]], $sp, {{[0-9]+}}
+
+; ALL: #APP
+
+; R6: ll ${{[0-9a-z]+}}, 0($[[R0]])
+; R6: sc ${{[0-9a-z]+}}, 0($[[R0]])
+
+; PRER6: ll ${{[0-9a-z]+}}, {{[0-9]+}}(${{[0-9a-z]+}})
+; PRER6: sc ${{[0-9a-z]+}}, {{[0-9]+}}(${{[0-9a-z]+}})
+
+; ALL: #NO_APP
+
+ %1 = call { i32, i32 } asm sideeffect ".set push\0A.set noreorder\0A1:\0All $0, $2\0Aaddu $1, $0, $3\0Asc $1, $2\0Abeqz $1, 1b\0Aaddu $1, $0, $3\0A.set pop\0A", "=&r,=&r,=*^ZC,Ir,*^ZC,~{memory},~{$1}"(i32* %count, i32 10, i32* %count)
+ %asmresult1.i = extractvalue { i32, i32 } %1, 1
+ %cmp = icmp ne i32 %asmresult1.i, 10
+ %conv = zext i1 %cmp to i32
+ %call2 = call i32 @f(i32 signext %conv)
+ ret i32 %call2
+}
+
+declare i32 @f(i32 signext)
OpenPOWER on IntegriCloud