Skip to content

Commit d3ae09b

Browse files
Artyom SkrobovArtyom Skrobov
Artyom Skrobov
authored and
Artyom Skrobov
committedSep 24, 2015
Recommit r248154: [ARM] Handle DSP feature as an ArchExtKind
Currently, the availability of DSP instructions (ACLE 6.4.7) is handled in a hand-rolled tricky condition block in lib/Basic/Targets.cpp, with a FIXME: attached. http://reviews.llvm.org/D12937 moved the handling of the DSP feature over to ARMTargetParser.def in LLVM, to be in line with other architecture extensions. This is the corresponding patch to clang, to clear the FIXME: and update the tests. Differential Revision: http://reviews.llvm.org/D12938 llvm-svn: 248521
1 parent 26ed65e commit d3ae09b

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed
 

‎clang/lib/Basic/Targets.cpp

+8-10
Original file line numberDiff line numberDiff line change
@@ -4121,6 +4121,7 @@ class ARMTargetInfo : public TargetInfo {
41214121

41224122
unsigned CRC : 1;
41234123
unsigned Crypto : 1;
4124+
unsigned DSP : 1;
41244125
unsigned Unaligned : 1;
41254126

41264127
enum {
@@ -4472,6 +4473,7 @@ class ARMTargetInfo : public TargetInfo {
44724473
FPU = 0;
44734474
CRC = 0;
44744475
Crypto = 0;
4476+
DSP = 0;
44754477
Unaligned = 1;
44764478
SoftFloat = SoftFloatABI = false;
44774479
HWDiv = 0;
@@ -4507,6 +4509,8 @@ class ARMTargetInfo : public TargetInfo {
45074509
CRC = 1;
45084510
} else if (Feature == "+crypto") {
45094511
Crypto = 1;
4512+
} else if (Feature == "+t2dsp") {
4513+
DSP = 1;
45104514
} else if (Feature == "+fp-only-sp") {
45114515
HW_FP_remove |= HW_FP_DP | HW_FP_HP;
45124516
} else if (Feature == "+strict-align") {
@@ -4742,25 +4746,19 @@ class ARMTargetInfo : public TargetInfo {
47424746
}
47434747

47444748
// ACLE 6.4.7 DSP instructions
4745-
bool hasDSP = false;
4746-
bool is5EOrAbove = (ArchVersion >= 6 ||
4747-
(ArchVersion == 5 && CPUAttr.count('E')));
4748-
// FIXME: We are not getting all 32-bit ARM architectures
4749-
bool is32Bit = (!isThumb() || supportsThumb2());
4750-
if (is5EOrAbove && is32Bit && (CPUProfile != "M" || CPUAttr == "7EM")) {
4749+
if (DSP) {
47514750
Builder.defineMacro("__ARM_FEATURE_DSP", "1");
4752-
hasDSP = true;
47534751
}
47544752

47554753
// ACLE 6.4.8 Saturation instructions
4756-
bool hasSAT = false;
4754+
bool SAT = false;
47574755
if ((ArchVersion == 6 && CPUProfile != "M") || ArchVersion > 6 ) {
47584756
Builder.defineMacro("__ARM_FEATURE_SAT", "1");
4759-
hasSAT = true;
4757+
SAT = true;
47604758
}
47614759

47624760
// ACLE 6.4.6 Q (saturation) flag
4763-
if (hasDSP || hasSAT)
4761+
if (DSP || SAT)
47644762
Builder.defineMacro("__ARM_FEATURE_QBIT", "1");
47654763
}
47664764

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// REQUIRES: arm-registered-target
22

33
// RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a8 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3
4-
// CHECK-VFP3: "target-features"="+neon,+vfp3"
4+
// CHECK-VFP3: "target-features"="+neon,+t2dsp,+vfp3"
55

66

77
// RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-a9 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3-FP16
8-
// CHECK-VFP3-FP16: "target-features"="+fp16,+neon,+vfp3"
8+
// CHECK-VFP3-FP16: "target-features"="+fp16,+neon,+t2dsp,+vfp3"
99

1010

1111
// RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a5 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4
12-
// CHECK-VFP4: "target-features"="+neon,+vfp4"
12+
// CHECK-VFP4: "target-features"="+neon,+t2dsp,+vfp4"
1313

1414

1515
// RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a7 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
@@ -18,39 +18,41 @@
1818
// RUN: %clang_cc1 -triple armv7-linux-gnueabihf -target-cpu cortex-a17 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
1919
// RUN: %clang_cc1 -triple thumbv7s-linux-gnueabi -target-cpu swift -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
2020
// RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu krait -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV
21-
// CHECK-VFP4-DIV: "target-features"="+hwdiv,+hwdiv-arm,+neon,+vfp4"
21+
// CHECK-VFP4-DIV: "target-features"="+hwdiv,+hwdiv-arm,+neon,+t2dsp,+vfp4"
2222

2323

2424
// RUN: %clang_cc1 -triple thumbv7s-apple-ios7.0 -target-cpu cyclone -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
2525
// RUN: %clang_cc1 -triple armv8-linux-gnueabi -target-cpu cortex-a53 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
2626
// RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a57 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
2727
// RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a72 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8
28-
// CHECK-BASIC-V8: "target-features"="+crc,+crypto,+fp-armv8,+hwdiv,+hwdiv-arm,+neon"
28+
// CHECK-BASIC-V8: "target-features"="+crc,+crypto,+fp-armv8,+hwdiv,+hwdiv-arm,+neon,+t2dsp"
2929

3030

3131
// RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-r5 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3-D16-DIV
32-
// CHECK-VFP3-D16-DIV: "target-features"="+d16,+hwdiv,+hwdiv-arm,+vfp3"
32+
// CHECK-VFP3-D16-DIV: "target-features"="+d16,+hwdiv,+hwdiv-arm,+t2dsp,+vfp3"
3333

3434

3535
// RUN: %clang_cc1 -triple armv7-linux-gnueabi -target-cpu cortex-r4f -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3-D16-THUMB-DIV
36-
// CHECK-VFP3-D16-THUMB-DIV: "target-features"="+d16,+hwdiv,+vfp3"
36+
// CHECK-VFP3-D16-THUMB-DIV: "target-features"="+d16,+hwdiv,+t2dsp,+vfp3"
3737

3838

3939
// RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-r7 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP3-D16-FP16-DIV
40-
// CHECK-VFP3-D16-FP16-DIV: "target-features"="+d16,+fp16,+hwdiv,+hwdiv-arm,+vfp3"
40+
// CHECK-VFP3-D16-FP16-DIV: "target-features"="+d16,+fp16,+hwdiv,+hwdiv-arm,+t2dsp,+vfp3"
4141

4242

4343
// RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-m4 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-D16-SP-THUMB-DIV
44-
// CHECK-VFP4-D16-SP-THUMB-DIV: "target-features"="+d16,+fp-only-sp,+hwdiv,+vfp4"
44+
// CHECK-VFP4-D16-SP-THUMB-DIV: "target-features"="+d16,+fp-only-sp,+hwdiv,+t2dsp,+vfp4"
4545

4646

4747
// RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-m7 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP5-D16-THUMB-DIV
48-
// CHECK-VFP5-D16-THUMB-DIV: "target-features"="+d16,+fp-armv8,+hwdiv"
48+
// CHECK-VFP5-D16-THUMB-DIV: "target-features"="+d16,+fp-armv8,+hwdiv,+t2dsp"
4949

5050

5151
// RUN: %clang_cc1 -triple armv7-linux-gnueabi -target-cpu cortex-r4 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-THUMB-DIV
52-
// RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-m3 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-THUMB-DIV
53-
// CHECK-THUMB-DIV: "target-features"="+hwdiv"
52+
// CHECK-THUMB-DIV: "target-features"="+hwdiv,+t2dsp"
53+
54+
// RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-m3 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-THUMB-DIV-M3
55+
// CHECK-THUMB-DIV-M3: "target-features"="+hwdiv"
5456

5557

5658
void foo() {}

0 commit comments

Comments
 (0)
Please sign in to comment.