]> granicus.if.org Git - clang/commitdiff
Basic: use hex string for __ARM_FP macro
authorSaleem Abdulrasool <compnerd@compnerd.org>
Thu, 18 Sep 2014 02:13:33 +0000 (02:13 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Thu, 18 Sep 2014 02:13:33 +0000 (02:13 +0000)
The ARM ACLE describes the values as hex constants rather than numeric
constants; follow suit.  Address post-commit review comments from Jon Roelofs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218009 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/Preprocessor/arm-acle-6.5.c

index d7832e30372832511f47a1a05b073307cb3650a4..511817f324c8f7dd06d3576f6a4317f99d626959 100644 (file)
@@ -21,6 +21,7 @@
 #include "clang/Basic/TargetOptions.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/ADT/Triple.h"
@@ -4055,7 +4056,7 @@ public:
 
     // ACLE 6.5.1 Hardware Floating Point
     if (HW_FP)
-      Builder.defineMacro("__ARM_FP", std::to_string(HW_FP));
+      Builder.defineMacro("__ARM_FP", "0x" + llvm::utohexstr(HW_FP));
 
     // ACLE predefines.
     Builder.defineMacro("__ARM_ACLE", "200");
index 8ee56f834533b652ff57793f3d5ffe6bf317e93f..9db83b774b0c6746967c42b69d5614ff91a54a64 100644 (file)
@@ -9,7 +9,7 @@
 // RUN: %clang -target arm-eabi -mfpu=vfp3 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP
 // RUN: %clang -target armv7-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP
 
-// CHECK-SP-DP: __ARM_FP 12
+// CHECK-SP-DP: __ARM_FP 0xC
 
 // RUN: %clang -target arm-eabi -mfpu=vfpv4 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP-HP
 // RUN: %clang -target arm-eabi -mfpu=vfpv4-d16 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP-HP
@@ -18,5 +18,5 @@
 // RUN: %clang -target arm-eabi -mfpu=crypto-neon-fp-armv8 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP-HP
 // RUN: %clang -target armv8-eabi -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-SP-DP-HP
 
-// CHECK-SP-DP-HP: __ARM_FP 14
+// CHECK-SP-DP-HP: __ARM_FP 0xE