summaryrefslogtreecommitdiff
path: root/test/CodeGen/builtin-constant-p.c
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2018-12-18 22:54:03 +0000
committerBill Wendling <isanbard@gmail.com>2018-12-18 22:54:03 +0000
commitd1840a054d43341f98b8a37f490248818c11fee4 (patch)
treea6d4f0112ac3a4bb016c0b15577147fa4b815b19 /test/CodeGen/builtin-constant-p.c
parentd4d7233447c39b5af77a7bf8f73b60fb53d5e9fd (diff)
downloadclang-d1840a054d43341f98b8a37f490248818c11fee4.tar.gz
Emit ASM input in a constant context
Summary: Some ASM input constraints (e.g., "i" and "n") require immediate values. At O0, very few code transformations are performed. So if we cannot resolve to an immediate when emitting the ASM input we shouldn't delay its processing. Reviewers: rsmith, efriedma Reviewed By: efriedma Subscribers: rehana, efriedma, craig.topper, jyknight, cfe-commits Differential Revision: https://reviews.llvm.org/D55616 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349561 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/builtin-constant-p.c')
-rw-r--r--test/CodeGen/builtin-constant-p.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/CodeGen/builtin-constant-p.c b/test/CodeGen/builtin-constant-p.c
index 7f4e7d07cc..f1cd06ad4a 100644
--- a/test/CodeGen/builtin-constant-p.c
+++ b/test/CodeGen/builtin-constant-p.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -O2 | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -O0 | FileCheck --check-prefix=O0 %s
int a = 42;
@@ -166,3 +167,13 @@ struct { const char *t; int a; } test15[] = {
extern char test16_v;
struct { int a; } test16 = { __builtin_constant_p(test16_v) };
+
+extern unsigned long long test17_v;
+
+void test17() {
+ // O0: define void @test17
+ // O0: call void asm sideeffect "", {{.*}}(i32 -1)
+ // CHECK: define void @test17
+ // CHECK: call void asm sideeffect "", {{.*}}(i32 -1)
+ __asm__ __volatile__("" :: "n"( (__builtin_constant_p(test17_v) || 0) ? 1 : -1));
+}