1 Pull in r215811 from upstream llvm trunk (by Nico Weber):
3 arm asm: Let .fpu enable instructions, PR20447.
5 I'm not very happy with duplicating the fpu->feature mapping in ARMAsmParser.cpp
6 and in clang's driver. See the bug for a patch that doesn't do that, and the
7 review thread [1] for why this duplication exists.
9 1: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140811/231052.html
11 This makes the .fpu directive work properly, so we can successfully
12 assemble several .S files using the directive, under lib/libc/arm.
14 Introduced here: http://svnweb.freebsd.org/changeset/base/275280
16 Index: lib/Target/ARM/AsmParser/ARMAsmParser.cpp
17 ===================================================================
18 --- lib/Target/ARM/AsmParser/ARMAsmParser.cpp
19 +++ lib/Target/ARM/AsmParser/ARMAsmParser.cpp
20 @@ -8621,6 +8621,30 @@ bool ARMAsmParser::parseDirectiveCPU(SMLoc L) {
24 +// FIXME: This is duplicated in getARMFPUFeatures() in
25 +// tools/clang/lib/Driver/Tools.cpp
26 +static const struct {
28 + const uint64_t Enabled;
29 + const uint64_t Disabled;
31 + {ARM::VFP, ARM::FeatureVFP2, ARM::FeatureNEON},
32 + {ARM::VFPV2, ARM::FeatureVFP2, ARM::FeatureNEON},
33 + {ARM::VFPV3, ARM::FeatureVFP3, ARM::FeatureNEON},
34 + {ARM::VFPV3_D16, ARM::FeatureVFP3 | ARM::FeatureD16, ARM::FeatureNEON},
35 + {ARM::VFPV4, ARM::FeatureVFP4, ARM::FeatureNEON},
36 + {ARM::VFPV4_D16, ARM::FeatureVFP4 | ARM::FeatureD16, ARM::FeatureNEON},
37 + {ARM::FP_ARMV8, ARM::FeatureFPARMv8,
38 + ARM::FeatureNEON | ARM::FeatureCrypto},
39 + {ARM::NEON, ARM::FeatureNEON, 0},
40 + {ARM::NEON_VFPV4, ARM::FeatureVFP4 | ARM::FeatureNEON, 0},
41 + {ARM::NEON_FP_ARMV8, ARM::FeatureFPARMv8 | ARM::FeatureNEON,
42 + ARM::FeatureCrypto},
43 + {ARM::CRYPTO_NEON_FP_ARMV8,
44 + ARM::FeatureFPARMv8 | ARM::FeatureNEON | ARM::FeatureCrypto, 0},
45 + {ARM::SOFTVFP, 0, 0},
50 bool ARMAsmParser::parseDirectiveFPU(SMLoc L) {
51 @@ -8636,6 +8660,18 @@ bool ARMAsmParser::parseDirectiveFPU(SMLoc L) {
55 + for (const auto &Fpu : Fpus) {
59 + // Need to toggle features that should be on but are off and that
60 + // should off but are on.
61 + unsigned Toggle = (Fpu.Enabled & ~STI.getFeatureBits()) |
62 + (Fpu.Disabled & STI.getFeatureBits());
63 + setAvailableFeatures(ComputeAvailableFeatures(STI.ToggleFeature(Toggle)));
67 getTargetStreamer().emitFPU(ID);
70 Index: test/MC/ARM/directive-fpu-instrs.s
71 ===================================================================
72 --- test/MC/ARM/directive-fpu-instrs.s
73 +++ test/MC/ARM/directive-fpu-instrs.s
75 +// RUN: llvm-mc -triple armv7-unknown-linux-gnueabi -mattr=+vfp3,+d16,-neon %s
81 +@ .thumb should not disable the prior .fpu neon
90 +fstmfdd sp!, {d8, d9, d10, d11, d12, d13, d14, d15}