-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ARM,AArch64] Add a full set of -mtp= options.
AArch64 has five system registers intended to be useful as thread pointers: one for each exception level which is RW at that level and inaccessible to lower ones, and the special TPIDRRO_EL0 which is readable but not writable at EL0. AArch32 has three, corresponding to the AArch64 ones that aren't specific to EL2 or EL3. Currently clang supports only a subset of these registers, and not even a consistent subset between AArch64 and AArch32: - For AArch64, clang permits you to choose between the four TPIDR_ELn thread registers, but not the fifth one, TPIDRRO_EL0. - In AArch32, on the other hand, the //only// thread register you can choose (apart from 'none, use a function call') is TPIDRURO, which corresponds to (the bottom 32 bits of) AArch64's TPIDRRO_EL0. So there is no thread register that you can currently use in both targets! For custom and bare-metal purposes, users might very reasonably want to use any of these thread registers. There's no reason they shouldn't all be supported as options, even if the default choices follow existing practice on typical operating systems. This commit extends the range of values acceptable to the `-mtp=` clang option, so that you can specify any of these registers by (the lower-case version of) their official names in the ArmARM: - For AArch64: tpidr_el0, tpidrro_el0, tpidr_el1, tpidr_el2, tpidr_el3 - For AArch32: tpidrurw, tpidruro, tpidrprw All existing values of the option are still supported and behave the same as before. Defaults are also unchanged. No command line that worked already should change behaviour as a result of this. The new values for the `-mtp=` option have been agreed with Arm's gcc developers (although I don't know whether they plan to implement them in the near future). Reviewed By: nickdesaulniers Differential Revision: https://reviews.llvm.org/D152433
- Loading branch information
1 parent
98153b0
commit 10e4228
Showing
20 changed files
with
177 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Test of the AArch64 values of -mtp=, checking that each one maps to | ||
// the right target features. | ||
|
||
// RUN: %clang --target=aarch64-linux -### -S %s -arch armv8a 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv8_THREAD_POINTER_EL0 %s | ||
// RUN: %clang --target=aarch64-linux -### -S %s -arch armv8a -mtp=el0 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv8_THREAD_POINTER_EL0 %s | ||
// RUN: %clang --target=aarch64-linux -### -S %s -arch armv8a -mtp=tpidr_el0 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv8_THREAD_POINTER_EL0 %s | ||
// ARMv8_THREAD_POINTER_EL0-NOT: "-target-feature" "+tpidrro-el0" | ||
// ARMv8_THREAD_POINTER_EL0-NOT: "-target-feature" "+tpidr-el1" | ||
// ARMv8_THREAD_POINTER_EL0-NOT: "-target-feature" "+tpidr-el2" | ||
// ARMv8_THREAD_POINTER_EL0-NOT: "-target-feature" "+tpidr-el3" | ||
|
||
// RUN: %clang --target=aarch64-linux -### -S %s -arch armv8a -mtp=tpidrro_el0 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv8_THREAD_POINTER_ROEL0 %s | ||
// ARMv8_THREAD_POINTER_ROEL0: "-target-feature" "+tpidrro-el0" | ||
// ARMv8_THREAD_POINTER_ROEL0-NOT: "-target-feature" "+tpidr-el1" | ||
// ARMv8_THREAD_POINTER_ROEL0-NOT: "-target-feature" "+tpidr-el2" | ||
// ARMv8_THREAD_POINTER_ROEL0-NOT: "-target-feature" "+tpidr-el3" | ||
|
||
// RUN: %clang --target=aarch64-linux -### -S %s -arch armv8a -mtp=el1 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv8_THREAD_POINTER_EL1 %s | ||
// RUN: %clang --target=aarch64-linux -### -S %s -arch armv8a -mtp=tpidr_el1 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv8_THREAD_POINTER_EL1 %s | ||
// ARMv8_THREAD_POINTER_EL1-NOT: "-target-feature" "+tpidrro-el0" | ||
// ARMv8_THREAD_POINTER_EL1: "-target-feature" "+tpidr-el1" | ||
// ARMv8_THREAD_POINTER_EL1-NOT: "-target-feature" "+tpidr-el2" | ||
// ARMv8_THREAD_POINTER_EL1-NOT: "-target-feature" "+tpidr-el3" | ||
|
||
// RUN: %clang --target=aarch64-linux -### -S %s -arch armv8a -mtp=el2 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv8_THREAD_POINTER_EL2 %s | ||
// RUN: %clang --target=aarch64-linux -### -S %s -arch armv8a -mtp=tpidr_el2 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv8_THREAD_POINTER_EL2 %s | ||
// ARMv8_THREAD_POINTER_EL2-NOT: "-target-feature" "+tpidrro-el0" | ||
// ARMv8_THREAD_POINTER_EL2-NOT: "-target-feature" "+tpidr-el1" | ||
// ARMv8_THREAD_POINTER_EL2: "-target-feature" "+tpidr-el2" | ||
// ARMv8_THREAD_POINTER_EL2-NOT: "-target-feature" "+tpidr-el3" | ||
|
||
// RUN: %clang --target=aarch64-linux -### -S %s -arch armv8a -mtp=el3 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv8_THREAD_POINTER_EL3 %s | ||
// RUN: %clang --target=aarch64-linux -### -S %s -arch armv8a -mtp=tpidr_el3 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv8_THREAD_POINTER_EL3 %s | ||
// ARMv8_THREAD_POINTER_EL3-NOT: "-target-feature" "+tpidrro-el0" | ||
// ARMv8_THREAD_POINTER_EL3-NOT: "-target-feature" "+tpidr-el1" | ||
// ARMv8_THREAD_POINTER_EL3-NOT: "-target-feature" "+tpidr-el2" | ||
// ARMv8_THREAD_POINTER_EL3: "-target-feature" "+tpidr-el3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Test of the AArch32 values of -mtp=, checking that each one maps to | ||
// the right target features. | ||
|
||
// RUN: %clang --target=armv7-linux -mtp=cp15 -### -S %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv7_THREAD_POINTER-HARD %s | ||
// ARMv7_THREAD_POINTER-HARD: "-target-feature" "+read-tp-tpidruro" | ||
|
||
// RUN: %clang --target=armv7-linux -mtp=tpidruro -### -S %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv7_THREAD_POINTER-HARD %s | ||
// RUN: %clang --target=armv7-linux -mtp=tpidrurw -### -S %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv7_THREAD_POINTER-TPIDRURW %s | ||
// ARMv7_THREAD_POINTER-TPIDRURW: "-target-feature" "+read-tp-tpidrurw" | ||
// RUN: %clang --target=armv7-linux -mtp=tpidrprw -### -S %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv7_THREAD_POINTER-TPIDRPRW %s | ||
// ARMv7_THREAD_POINTER-TPIDRPRW: "-target-feature" "+read-tp-tpidrprw" | ||
|
||
// RUN: %clang --target=armv6t2-linux -mtp=cp15 -### -S %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARM_THREAD_POINTER-HARD %s | ||
// RUN: %clang --target=thumbv6t2-linux -mtp=cp15 -### -S %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARM_THREAD_POINTER-HARD %s | ||
// RUN: %clang --target=armv6k-linux -mtp=cp15 -### -S %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARM_THREAD_POINTER-HARD %s | ||
// RUN: %clang --target=armv6-linux -mtp=cp15 -### -S %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARM_THREAD_POINTER-HARD %s | ||
// RUN: %clang --target=armv5t-linux -mtp=cp15 -### -S %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARM_THREAD_POINTER-HARD %s | ||
// ARM_THREAD_POINTER-HARD: "-target-feature" "+read-tp-tpidruro" | ||
|
||
// RUN: %clang --target=armv5t-linux -mtp=cp15 -x assembler -### %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv5_THREAD_POINTER_ASSEMBLER %s | ||
// ARMv5_THREAD_POINTER_ASSEMBLER-NOT: hardware TLS register is not supported for the armv5 sub-architecture | ||
|
||
// RUN: %clang --target=armv6-linux -mthumb -mtp=cp15 -### -S %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=THUMBv6_THREAD_POINTER_UNSUPP %s | ||
// RUN: %clang --target=thumbv6-linux -mthumb -mtp=cp15 -### -S %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=THUMBv6_THREAD_POINTER_UNSUPP %s | ||
// THUMBv6_THREAD_POINTER_UNSUPP: hardware TLS register is not supported for the thumbv6 sub-architecture | ||
|
||
// RUN: %clang --target=armv7-linux -mtp=soft -### -S %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv7_THREAD_POINTER_SOFT %s | ||
// ARMv7_THREAD_POINTER_SOFT-NOT: "-target-feature" "+read-tp-tpidruro" | ||
|
||
// RUN: %clang --target=armv7-linux -### -S %s 2>&1 | \ | ||
// RUN: FileCheck -check-prefix=ARMv7_THREAD_POINTER_NON %s | ||
// ARMv7_THREAD_POINTER_NON-NOT: "-target-feature" "+read-tp-tpidruro" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.