summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/pr41027.c
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2019-08-06 22:41:22 +0000
committerBill Wendling <isanbard@gmail.com>2019-08-06 22:41:22 +0000
commitce29291fc3bed3f1b6482a6f351d486600726886 (patch)
treec28616f08bfeef79fb52a5cf4f17089aedf9bb52 /clang/test/CodeGen/pr41027.c
parent0b168ffdc3fff3f88edaaa7de7444c119cbbdfc2 (diff)
downloadbcm5719-llvm-ce29291fc3bed3f1b6482a6f351d486600726886.tar.gz
bcm5719-llvm-ce29291fc3bed3f1b6482a6f351d486600726886.zip
Delay diagnosing asm constraints that require immediates until after inlining
Summary: An inline asm call may result in an immediate input value after inlining. Therefore, don't emit a diagnostic here if the input isn't an immediate. Reviewers: joerg, eli.friedman, rsmith Subscribers: asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, s.egerton, krytarowski, mgorny, riccibruno, eraman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60943 llvm-svn: 368104
Diffstat (limited to 'clang/test/CodeGen/pr41027.c')
-rw-r--r--clang/test/CodeGen/pr41027.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/test/CodeGen/pr41027.c b/clang/test/CodeGen/pr41027.c
new file mode 100644
index 00000000000..b60fe7d65e7
--- /dev/null
+++ b/clang/test/CodeGen/pr41027.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -O2 -o - %s | FileCheck %s
+
+// CHECK-LABEL: f:
+// CHECK: movl $1, %eax
+// CHECK-NEXT: #APP
+// CHECK-NEXT: outl %eax, $1
+// CHECK-NEXT: #NO_APP
+
+static inline void pr41027(unsigned a, unsigned b) {
+ if (__builtin_constant_p(a)) {
+ __asm__ volatile("outl %0,%w1" : : "a"(b), "n"(a));
+ } else {
+ __asm__ volatile("outl %0,%w1" : : "a"(b), "d"(a));
+ }
+}
+
+void f(unsigned port) {
+ pr41027(1, 1);
+}
OpenPOWER on IntegriCloud