[PATCH] D51093: [ARM] Set __ARM_FEATURE_SIMD32 for +dsp cores
samparker created this revision. samparker added reviewers: erichkeane, t.p.northover, SjoerdMeijer. Herald added a reviewer: javed.absar. Herald added subscribers: chrib, kristof.beyls. __ARM_FEATURE_DSP is already set for targets with the +dsp feature. In the backend, this target feature is also used to represent the availability of the of the instructions that the ACLE guard through the __ARM_FEATURE_SIMD32 macro. So set this macro for cores later than V6 and that the target parser, or user, reports that the 'dsp' instructions are supported. https://reviews.llvm.org/D51093 Files: lib/Basic/Targets/ARM.cpp test/Preprocessor/arm-acle-6.4.c Index: test/Preprocessor/arm-acle-6.4.c === --- test/Preprocessor/arm-acle-6.4.c +++ test/Preprocessor/arm-acle-6.4.c @@ -174,10 +174,13 @@ // CHECK-V7M: __ARM_FEATURE_SAT 1 // CHECK-V7M: __ARM_FEATURE_UNALIGNED 1 -// RUN: %clang -target arm-none-linux-eabi -march=armv7e-m -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-V7EM +// RUN: %clang -target arm-none-linux-eabi -march=armv7e-m -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m33 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP -// CHECK-V7EM: __ARM_FEATURE_DSP 1 -// CHECK-V7EM: __ARM_FEATURE_SIMD32 1 +// CHECK-M-DSP: __ARM_FEATURE_DSP 1 +// CHECK-M-DSP: __ARM_FEATURE_SIMD32 1 // RUN: %clang -target arm-none-linux-eabi -march=armv8-a -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-V8A Index: lib/Basic/Targets/ARM.cpp === --- lib/Basic/Targets/ARM.cpp +++ lib/Basic/Targets/ARM.cpp @@ -661,7 +661,7 @@ } // ACLE 6.4.9 32-bit SIMD instructions - if (ArchVersion >= 6 && (CPUProfile != "M" || CPUAttr == "7EM")) + if ((ArchVersion >= 6 && DSP)) Builder.defineMacro("__ARM_FEATURE_SIMD32", "1"); // ACLE 6.4.10 Hardware Integer Divide Index: test/Preprocessor/arm-acle-6.4.c === --- test/Preprocessor/arm-acle-6.4.c +++ test/Preprocessor/arm-acle-6.4.c @@ -174,10 +174,13 @@ // CHECK-V7M: __ARM_FEATURE_SAT 1 // CHECK-V7M: __ARM_FEATURE_UNALIGNED 1 -// RUN: %clang -target arm-none-linux-eabi -march=armv7e-m -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-V7EM +// RUN: %clang -target arm-none-linux-eabi -march=armv7e-m -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m33 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP -// CHECK-V7EM: __ARM_FEATURE_DSP 1 -// CHECK-V7EM: __ARM_FEATURE_SIMD32 1 +// CHECK-M-DSP: __ARM_FEATURE_DSP 1 +// CHECK-M-DSP: __ARM_FEATURE_SIMD32 1 // RUN: %clang -target arm-none-linux-eabi -march=armv8-a -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-V8A Index: lib/Basic/Targets/ARM.cpp === --- lib/Basic/Targets/ARM.cpp +++ lib/Basic/Targets/ARM.cpp @@ -661,7 +661,7 @@ } // ACLE 6.4.9 32-bit SIMD instructions - if (ArchVersion >= 6 && (CPUProfile != "M" || CPUAttr == "7EM")) + if ((ArchVersion >= 6 && DSP)) Builder.defineMacro("__ARM_FEATURE_SIMD32", "1"); // ACLE 6.4.10 Hardware Integer Divide ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51093: [ARM] Set __ARM_FEATURE_SIMD32 for +dsp cores
samparker updated this revision to Diff 161925. samparker added a comment. Added test for armv8m.main+dsp. https://reviews.llvm.org/D51093 Files: lib/Basic/Targets/ARM.cpp test/Preprocessor/arm-acle-6.4.c Index: test/Preprocessor/arm-acle-6.4.c === --- test/Preprocessor/arm-acle-6.4.c +++ test/Preprocessor/arm-acle-6.4.c @@ -174,10 +174,14 @@ // CHECK-V7M: __ARM_FEATURE_SAT 1 // CHECK-V7M: __ARM_FEATURE_UNALIGNED 1 -// RUN: %clang -target arm-none-linux-eabi -march=armv7e-m -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-V7EM - -// CHECK-V7EM: __ARM_FEATURE_DSP 1 -// CHECK-V7EM: __ARM_FEATURE_SIMD32 1 +// RUN: %clang -target arm-none-linux-eabi -march=armv7e-m -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m33 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -march=armv8m.main+dsp -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP + +// CHECK-M-DSP: __ARM_FEATURE_DSP 1 +// CHECK-M-DSP: __ARM_FEATURE_SIMD32 1 // RUN: %clang -target arm-none-linux-eabi -march=armv8-a -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-V8A Index: lib/Basic/Targets/ARM.cpp === --- lib/Basic/Targets/ARM.cpp +++ lib/Basic/Targets/ARM.cpp @@ -661,7 +661,7 @@ } // ACLE 6.4.9 32-bit SIMD instructions - if (ArchVersion >= 6 && (CPUProfile != "M" || CPUAttr == "7EM")) + if ((ArchVersion >= 6 && DSP)) Builder.defineMacro("__ARM_FEATURE_SIMD32", "1"); // ACLE 6.4.10 Hardware Integer Divide Index: test/Preprocessor/arm-acle-6.4.c === --- test/Preprocessor/arm-acle-6.4.c +++ test/Preprocessor/arm-acle-6.4.c @@ -174,10 +174,14 @@ // CHECK-V7M: __ARM_FEATURE_SAT 1 // CHECK-V7M: __ARM_FEATURE_UNALIGNED 1 -// RUN: %clang -target arm-none-linux-eabi -march=armv7e-m -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-V7EM - -// CHECK-V7EM: __ARM_FEATURE_DSP 1 -// CHECK-V7EM: __ARM_FEATURE_SIMD32 1 +// RUN: %clang -target arm-none-linux-eabi -march=armv7e-m -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m33 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -march=armv8m.main+dsp -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP + +// CHECK-M-DSP: __ARM_FEATURE_DSP 1 +// CHECK-M-DSP: __ARM_FEATURE_SIMD32 1 // RUN: %clang -target arm-none-linux-eabi -march=armv8-a -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-V8A Index: lib/Basic/Targets/ARM.cpp === --- lib/Basic/Targets/ARM.cpp +++ lib/Basic/Targets/ARM.cpp @@ -661,7 +661,7 @@ } // ACLE 6.4.9 32-bit SIMD instructions - if (ArchVersion >= 6 && (CPUProfile != "M" || CPUAttr == "7EM")) + if ((ArchVersion >= 6 && DSP)) Builder.defineMacro("__ARM_FEATURE_SIMD32", "1"); // ACLE 6.4.10 Hardware Integer Divide ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51093: [ARM] Set __ARM_FEATURE_SIMD32 for +dsp cores
SjoerdMeijer accepted this revision. SjoerdMeijer added a comment. This revision is now accepted and ready to land. Looks reasonable to me. https://reviews.llvm.org/D51093 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51093: [ARM] Set __ARM_FEATURE_SIMD32 for +dsp cores
This revision was automatically updated to reflect the committed changes. Closed by commit rL340911: [ARM] Set __ARM_FEATURE_SIMD32 for +dsp cores (authored by sam_parker, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D51093?vs=161925&id=163035#toc Repository: rL LLVM https://reviews.llvm.org/D51093 Files: cfe/trunk/lib/Basic/Targets/ARM.cpp cfe/trunk/test/Preprocessor/arm-acle-6.4.c Index: cfe/trunk/lib/Basic/Targets/ARM.cpp === --- cfe/trunk/lib/Basic/Targets/ARM.cpp +++ cfe/trunk/lib/Basic/Targets/ARM.cpp @@ -661,7 +661,7 @@ } // ACLE 6.4.9 32-bit SIMD instructions - if (ArchVersion >= 6 && (CPUProfile != "M" || CPUAttr == "7EM")) + if (ArchVersion >= 6 || (CPUProfile == "M" && DSP)) Builder.defineMacro("__ARM_FEATURE_SIMD32", "1"); // ACLE 6.4.10 Hardware Integer Divide Index: cfe/trunk/test/Preprocessor/arm-acle-6.4.c === --- cfe/trunk/test/Preprocessor/arm-acle-6.4.c +++ cfe/trunk/test/Preprocessor/arm-acle-6.4.c @@ -174,10 +174,14 @@ // CHECK-V7M: __ARM_FEATURE_SAT 1 // CHECK-V7M: __ARM_FEATURE_UNALIGNED 1 -// RUN: %clang -target arm-none-linux-eabi -march=armv7e-m -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-V7EM +// RUN: %clang -target arm-none-linux-eabi -march=armv7e-m -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m33 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -march=armv8m.main+dsp -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP -// CHECK-V7EM: __ARM_FEATURE_DSP 1 -// CHECK-V7EM: __ARM_FEATURE_SIMD32 1 +// CHECK-M-DSP: __ARM_FEATURE_DSP 1 +// CHECK-M-DSP: __ARM_FEATURE_SIMD32 1 // RUN: %clang -target arm-none-linux-eabi -march=armv8-a -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-V8A Index: cfe/trunk/lib/Basic/Targets/ARM.cpp === --- cfe/trunk/lib/Basic/Targets/ARM.cpp +++ cfe/trunk/lib/Basic/Targets/ARM.cpp @@ -661,7 +661,7 @@ } // ACLE 6.4.9 32-bit SIMD instructions - if (ArchVersion >= 6 && (CPUProfile != "M" || CPUAttr == "7EM")) + if (ArchVersion >= 6 || (CPUProfile == "M" && DSP)) Builder.defineMacro("__ARM_FEATURE_SIMD32", "1"); // ACLE 6.4.10 Hardware Integer Divide Index: cfe/trunk/test/Preprocessor/arm-acle-6.4.c === --- cfe/trunk/test/Preprocessor/arm-acle-6.4.c +++ cfe/trunk/test/Preprocessor/arm-acle-6.4.c @@ -174,10 +174,14 @@ // CHECK-V7M: __ARM_FEATURE_SAT 1 // CHECK-V7M: __ARM_FEATURE_UNALIGNED 1 -// RUN: %clang -target arm-none-linux-eabi -march=armv7e-m -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-V7EM +// RUN: %clang -target arm-none-linux-eabi -march=armv7e-m -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m4 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m7 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -mcpu=cortex-m33 -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP +// RUN: %clang --target=arm-arm-none-eabi -march=armv8m.main+dsp -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-M-DSP -// CHECK-V7EM: __ARM_FEATURE_DSP 1 -// CHECK-V7EM: __ARM_FEATURE_SIMD32 1 +// CHECK-M-DSP: __ARM_FEATURE_DSP 1 +// CHECK-M-DSP: __ARM_FEATURE_SIMD32 1 // RUN: %clang -target arm-none-linux-eabi -march=armv8-a -x c -E -dM %s -o - | FileCheck %s -check-prefix CHECK-V8A ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits