[llvm-branch-commits] [cfe-branch] r102242 - in /cfe/branches/Apple/williamson: include/clang/Basic/TargetInfo.h lib/AST/Stmt.cpp lib/Basic/TargetInfo.cpp lib/Basic/Targets.cpp test/CodeGen/arm_asm_clobber.c
Daniel Dunbar
daniel at zuster.org
Sat Apr 24 07:17:16 PDT 2010
Author: ddunbar
Date: Sat Apr 24 09:17:16 2010
New Revision: 102242
URL: http://llvm.org/viewvc/llvm-project?rev=102242&view=rev
Log:
david conrad points out that {|} in inline assembly on arm are not asm variants. This fixes neon inline asm which my patch for PR6780 broke.
Modified:
cfe/branches/Apple/williamson/include/clang/Basic/TargetInfo.h
cfe/branches/Apple/williamson/lib/AST/Stmt.cpp
cfe/branches/Apple/williamson/lib/Basic/TargetInfo.cpp
cfe/branches/Apple/williamson/lib/Basic/Targets.cpp
cfe/branches/Apple/williamson/test/CodeGen/arm_asm_clobber.c
Modified: cfe/branches/Apple/williamson/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/include/clang/Basic/TargetInfo.h?rev=102242&r1=102241&r2=102242&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/include/clang/Basic/TargetInfo.h (original)
+++ cfe/branches/Apple/williamson/include/clang/Basic/TargetInfo.h Sat Apr 24 09:17:16 2010
@@ -45,6 +45,7 @@
// Target values set by the ctor of the actual target implementation. Default
// values are specified by the TargetInfo constructor.
bool TLSSupported;
+ bool NoAsmVariants; // True if {|} are normal characters.
unsigned char PointerWidth, PointerAlign;
unsigned char IntWidth, IntAlign;
unsigned char FloatWidth, FloatAlign;
@@ -414,6 +415,15 @@
return TLSSupported;
}
+ /// hasNoAsmVariants - Return true if {|} are normal characters in the
+ /// asm string. If this returns false (the default), then {abc|xyz} is syntax
+ /// that says that when compmiling for asm variant #0, "abc" should be
+ /// generated, but when compiling for asm variant #1, "xyz" should be
+ /// generated.
+ bool hasNoAsmVariants() const {
+ return NoAsmVariants;
+ }
+
/// getEHDataRegisterNumber - Return the register number that
/// __builtin_eh_return_regno would return with the specified argument.
virtual int getEHDataRegisterNumber(unsigned RegNo) const {
Modified: cfe/branches/Apple/williamson/lib/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/lib/AST/Stmt.cpp?rev=102242&r1=102241&r2=102242&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/lib/AST/Stmt.cpp (original)
+++ cfe/branches/Apple/williamson/lib/AST/Stmt.cpp Sat Apr 24 09:17:16 2010
@@ -19,6 +19,7 @@
#include "clang/AST/Type.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTDiagnostic.h"
+#include "clang/Basic/TargetInfo.h"
#include <cstdio>
using namespace clang;
@@ -240,6 +241,8 @@
// asm string.
std::string CurStringPiece;
+ bool HasVariants = !C.Target.hasNoAsmVariants();
+
while (1) {
// Done with the string?
if (CurPtr == StrEnd) {
@@ -251,9 +254,9 @@
char CurChar = *CurPtr++;
switch (CurChar) {
case '$': CurStringPiece += "$$"; continue;
- case '{': CurStringPiece += "$("; continue;
- case '|': CurStringPiece += "$|"; continue;
- case '}': CurStringPiece += "$)"; continue;
+ case '{': CurStringPiece += (HasVariants ? "$(" : "{"); continue;
+ case '|': CurStringPiece += (HasVariants ? "$|" : "|"); continue;
+ case '}': CurStringPiece += (HasVariants ? "$)" : "}"); continue;
case '%':
break;
default:
Modified: cfe/branches/Apple/williamson/lib/Basic/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/lib/Basic/TargetInfo.cpp?rev=102242&r1=102241&r2=102242&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/lib/Basic/TargetInfo.cpp (original)
+++ cfe/branches/Apple/williamson/lib/Basic/TargetInfo.cpp Sat Apr 24 09:17:16 2010
@@ -23,6 +23,7 @@
// Set defaults. Defaults are set for a 32-bit RISC platform, like PPC or
// SPARC. These should be overridden by concrete targets as needed.
TLSSupported = true;
+ NoAsmVariants = false;
PointerWidth = PointerAlign = 32;
IntWidth = IntAlign = 32;
LongWidth = LongAlign = 32;
Modified: cfe/branches/Apple/williamson/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/lib/Basic/Targets.cpp?rev=102242&r1=102241&r2=102242&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/lib/Basic/Targets.cpp (original)
+++ cfe/branches/Apple/williamson/lib/Basic/Targets.cpp Sat Apr 24 09:17:16 2010
@@ -1372,6 +1372,10 @@
SizeType = UnsignedInt;
PtrDiffType = SignedInt;
+ // {} in inline assembly are neon specifiers, not assembly variant
+ // specifiers.
+ NoAsmVariants = true;
+
// FIXME: Should we just treat this as a feature?
IsThumb = getTriple().getArchName().startswith("thumb");
if (IsThumb) {
Modified: cfe/branches/Apple/williamson/test/CodeGen/arm_asm_clobber.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson/test/CodeGen/arm_asm_clobber.c?rev=102242&r1=102241&r2=102242&view=diff
==============================================================================
--- cfe/branches/Apple/williamson/test/CodeGen/arm_asm_clobber.c (original)
+++ cfe/branches/Apple/williamson/test/CodeGen/arm_asm_clobber.c Sat Apr 24 09:17:16 2010
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple armv6-unknown-unknown -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple armv6-unknown-unknown -emit-llvm -o - %s | FileCheck %s
void test0(void) {
asm volatile("mov r0, r0" :: );
@@ -19,3 +19,14 @@
asm volatile("mov r0, r0" :::
"v1", "v2", "v3", "v5");
}
+
+
+// {} should not be treated as asm variants.
+void test4(float *a, float *b) {
+ // CHECK: @test4
+ // CHECK: call void asm sideeffect "vld1.32 {d8[],d9[]},
+ __asm__ volatile (
+ "vld1.32 {d8[],d9[]}, [%1,:32] \n\t"
+ "vst1.32 {q4}, [%0,:128] \n\t"
+ :: "r"(a), "r"(b));
+}
More information about the llvm-branch-commits
mailing list