llvm.org GIT mirror llvm / 257c031
# This is a combination of 2 commits. # The first commit's message is: Revert "[ARM] Add DSP build attribute and extension targeting" This reverts commit b11cc50c0b4a7c8cdb628abc50b7dc226ff583dc. # This is the 2nd commit message: Revert "[ARM] Add new system registers to ARMv8-M Baseline/Mainline" This reverts commit 837d08454e3e5beb8581951ac26b22fa07df3cd5. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257916 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Kleckner 4 years ago
19 changed file(s) with 11 addition(s) and 603 deletion(s). Raw diff Collapse all Expand all
6666 ABI_FP_16bit_format = 38,
6767 MPextension_use = 42, // recoded from 70 (ABI r2.08)
6868 DIV_use = 44,
69 DSP_extension = 46,
7069 also_compatible_with = 65,
7170 conformance = 67,
7271 Virtualization_use = 68,
115115 ARM_ARCH_EXT_NAME("none", AEK_NONE, nullptr, nullptr)
116116 ARM_ARCH_EXT_NAME("crc", AEK_CRC, "+crc", "-crc")
117117 ARM_ARCH_EXT_NAME("crypto", AEK_CRYPTO, "+crypto","-crypto")
118 ARM_ARCH_EXT_NAME("dsp", AEK_DSP, "+dsp", "-dsp")
119118 ARM_ARCH_EXT_NAME("fp", AEK_FP, nullptr, nullptr)
120119 ARM_ARCH_EXT_NAME("idiv", (AEK_HWDIVARM | AEK_HWDIV), nullptr, nullptr)
121120 ARM_ARCH_EXT_NAME("mp", AEK_MP, nullptr, nullptr)
5353 { ARMBuildAttrs::ABI_FP_16bit_format, "Tag_ABI_FP_16bit_format" },
5454 { ARMBuildAttrs::MPextension_use, "Tag_MPextension_use" },
5555 { ARMBuildAttrs::DIV_use, "Tag_DIV_use" },
56 { ARMBuildAttrs::DSP_extension, "Tag_DSP_extension" },
5756 { ARMBuildAttrs::nodefaults, "Tag_nodefaults" },
5857 { ARMBuildAttrs::also_compatible_with, "Tag_also_compatible_with" },
5958 { ARMBuildAttrs::T2EE_use, "Tag_T2EE_use" },
806806 if (STI.hasDivideInARMMode() && !STI.hasV8Ops())
807807 ATS.emitAttribute(ARMBuildAttrs::DIV_use, ARMBuildAttrs::AllowDIVExt);
808808
809 if (STI.hasDSP() && isV8M(&STI))
810 ATS.emitAttribute(ARMBuildAttrs::DSP_extension, ARMBuildAttrs::Allowed);
811
812809 if (MMI) {
813810 if (const Module *SourceModule = MMI->getModule()) {
814811 // ABI_PCS_wchar_t to indicate wchar_t width
34433443 .Case("basepri_max", 0x12)
34443444 .Case("faultmask", 0x13)
34453445 .Case("control", 0x14)
3446 .Case("msplim", 0x0a)
3447 .Case("psplim", 0x0b)
3448 .Case("sp", 0x18)
34493446 .Default(-1);
34503447 }
34513448
34753472 if (!Subtarget->hasV7Ops() && SYSmvalue >= 0x11 && SYSmvalue <= 0x13)
34763473 return -1;
34773474
3478 if (Subtarget->has8MSecExt() && Flags.lower() == "ns") {
3479 Flags = "";
3480 SYSmvalue |= 0x80;
3481 }
3482
3483 if (!Subtarget->has8MSecExt() &&
3484 (SYSmvalue == 0xa || SYSmvalue == 0xb || SYSmvalue > 0x14))
3485 return -1;
3486
3487 if (!Subtarget->hasV8MMainlineOps() &&
3488 (SYSmvalue == 0x8a || SYSmvalue == 0x8b || SYSmvalue == 0x91 ||
3489 SYSmvalue == 0x93))
3490 return -1;
3491
34923475 // If it was a read then we won't be expecting flags and so at this point
34933476 // we can return the mask.
34943477 if (IsRead) {
3495 if (Flags.empty())
3496 return SYSmvalue;
3497 else
3498 return -1;
3478 assert (Flags.empty() && "Unexpected flags for reading M class register.");
3479 return SYSmvalue;
34993480 }
35003481
35013482 // We know we are now handling a write so need to get the mask for the flags.
36543635 // is an acceptable value, so check that a mask can be constructed from the
36553636 // string.
36563637 if (Subtarget->isMClass()) {
3657 StringRef Flags = "", Reg = SpecialReg;
3658 if (Reg.endswith("_ns")) {
3659 Flags = "ns";
3660 Reg = Reg.drop_back(3);
3661 }
3662
3663 int SYSmValue = getMClassRegisterMask(Reg, Flags, true, Subtarget);
3638 int SYSmValue = getMClassRegisterMask(SpecialReg, "", true, Subtarget);
36643639 if (SYSmValue == -1)
36653640 return nullptr;
36663641
37543729 return CurDAG->getMachineNode(Opcode, DL, MVT::Other, Ops);
37553730 }
37563731
3757 std::pair Fields;
3758 Fields = StringRef(SpecialReg).rsplit('_');
3759 std::string Reg = Fields.first.str();
3760 StringRef Flags = Fields.second;
3732 SmallVector Fields;
3733 StringRef(SpecialReg).split(Fields, '_', 1, false);
3734 std::string Reg = Fields[0].str();
3735 StringRef Flags = Fields.size() == 2 ? Fields[1] : "";
37613736
37623737 // If the target was M Class then need to validate the special register value
37633738 // and retrieve the mask for use in the instruction node.
270270 }
271271 bool hasV8MBaseline() const {
272272 return getSTI().getFeatureBits()[ARM::HasV8MBaselineOps];
273 }
274 bool hasV8MMainline() const {
275 return getSTI().getFeatureBits()[ARM::HasV8MMainlineOps];
276 }
277 bool has8MSecExt() const {
278 return getSTI().getFeatureBits()[ARM::Feature8MSecExt];
279273 }
280274 bool hasARM() const {
281275 return !getSTI().getFeatureBits()[ARM::FeatureNoARM];
39773971 .Case("basepri_max", 0x812)
39783972 .Case("faultmask", 0x813)
39793973 .Case("control", 0x814)
3980 .Case("msplim", 0x80a)
3981 .Case("psplim", 0x80b)
3982 .Case("msp_ns", 0x888)
3983 .Case("psp_ns", 0x889)
3984 .Case("msplim_ns", 0x88a)
3985 .Case("psplim_ns", 0x88b)
3986 .Case("primask_ns", 0x890)
3987 .Case("basepri_ns", 0x891)
3988 .Case("basepri_max_ns", 0x892)
3989 .Case("faultmask_ns", 0x893)
3990 .Case("control_ns", 0x894)
3991 .Case("sp_ns", 0x898)
39923974 .Default(~0U);
39933975
39943976 if (FlagsVal == ~0U)
40013983
40023984 if (!hasV7Ops() && FlagsVal >= 0x811 && FlagsVal <= 0x813)
40033985 // basepri, basepri_max and faultmask only valid for V7m.
4004 return MatchOperand_NoMatch;
4005
4006 if (!has8MSecExt() && (FlagsVal == 0x80a || FlagsVal == 0x80b ||
4007 (FlagsVal > 0x814 && FlagsVal < 0xc00)))
4008 return MatchOperand_NoMatch;
4009
4010 if (!hasV8MMainline() && (FlagsVal == 0x88a || FlagsVal == 0x88b ||
4011 (FlagsVal > 0x890 && FlagsVal <= 0x893)))
40123986 return MatchOperand_NoMatch;
40133987
40143988 Parser.Lex(); // Eat identifier token.
40954095 // Values basepri, basepri_max and faultmask are only valid for v7m.
40964096 return MCDisassembler::Fail;
40974097 break;
4098 case 0x8a: // msplim_ns
4099 case 0x8b: // psplim_ns
4100 case 0x91: // basepri_ns
4101 case 0x92: // basepri_max_ns
4102 case 0x93: // faultmask_ns
4103 if (!(FeatureBits[ARM::HasV8MMainlineOps]))
4104 return MCDisassembler::Fail;
4105 // fall through
4106 case 10: // msplim
4107 case 11: // psplim
4108 case 0x88: // msp_ns
4109 case 0x89: // psp_ns
4110 case 0x90: // primask_ns
4111 case 0x94: // control_ns
4112 case 0x98: // sp_ns
4113 if (!(FeatureBits[ARM::Feature8MSecExt]))
4114 return MCDisassembler::Fail;
4115 break;
41164098 default:
41174099 return MCDisassembler::Fail;
41184100 }
900900 case 20:
901901 O << "control";
902902 return;
903 case 10:
904 O << "msplim";
905 return;
906 case 11:
907 O << "psplim";
908 return;
909 case 0x88:
910 O << "msp_ns";
911 return;
912 case 0x89:
913 O << "psp_ns";
914 return;
915 case 0x8a:
916 O << "msplim_ns";
917 return;
918 case 0x8b:
919 O << "psplim_ns";
920 return;
921 case 0x90:
922 O << "primask_ns";
923 return;
924 case 0x91:
925 O << "basepri_ns";
926 return;
927 case 0x92:
928 O << "basepri_max_ns";
929 return;
930 case 0x93:
931 O << "faultmask_ns";
932 return;
933 case 0x94:
934 O << "control_ns";
935 return;
936 case 0x98:
937 O << "sp_ns";
938 return;
939903 }
940904 }
941905
5353 // Tag_DIV_use (=44)
5454 .eabi_attribute 44, 2
5555
56 // Tag_DSP_extension (=46)
57 .eabi_attribute 46, 1
58
5956 // Tag_Virtualization_use (=68)
6057 .eabi_attribute 68, 3
6158
7370 // CHECK-NEXT: ]
7471 // CHECK-NEXT: Address: 0x0
7572 // CHECK-NEXT: Offset: 0x34
76 // CHECK-NEXT: Size: 73
73 // CHECK-NEXT: Size: 71
7774 // CHECK-NEXT: Link: 0
7875 // CHECK-NEXT: Info: 0
7976 // CHECK-NEXT: AddressAlignment: 1
8077 // CHECK-NEXT: EntrySize: 0
8178 // CHECK-NEXT: SectionData (
82 // CHECK-NEXT: 0000: 41480000 00616561 62690001 3E000000
79 // CHECK-NEXT: 0000: 41460000 00616561 62690001 3C000000
8380 // CHECK-NEXT: 0010: 05636F72 7465782D 61380006 0A074108
8481 // CHECK-NEXT: 0020: 0109020A 030C0214 01150117 01180119
85 // CHECK-NEXT: 0030: 011B001C 0124012A 012C022E 0144036E
86 // CHECK-NEXT: 0040: A0018101 3100FA01 01
82 // CHECK-NEXT: 0030: 011B001C 0124012A 012C0244 036EA001
83 // CHECK-NEXT: 0040: 81013100 FA0101
8784 // CHECK-NEXT: )
2828 ; RUN: llc < %s -mtriple=armv8-linux-gnueabi | FileCheck %s --check-prefix=V8-FPARMv8-NEON-CRYPTO
2929 ; RUN: llc < %s -mtriple=thumbv8m.base-linux-gnueabi | FileCheck %s --check-prefix=V8MBASELINE
3030 ; RUN: llc < %s -mtriple=thumbv8m.main-linux-gnueabi | FileCheck %s --check-prefix=V8MMAINLINE
31 ; RUN: llc < %s -mtriple=thumbv8m.main-linux-gnueabi -mattr=+dsp | FileCheck %s --check-prefix=V8MMAINLINE_DSP
3231 ; RUN: llc < %s -mtriple=armv7-linux-gnueabi -mcpu=cortex-a5 | FileCheck %s --check-prefix=CORTEX-A5-DEFAULT
3332 ; RUN: llc < %s -mtriple=armv7-linux-gnueabi -mcpu=cortex-a5 -enable-unsafe-fp-math -disable-fp-elim -enable-no-infs-fp-math -enable-no-nans-fp-math -fp-contract=fast | FileCheck %s --check-prefix=CORTEX-A5-DEFAULT-FAST
3433 ; RUN: llc < %s -mtriple=armv7-linux-gnueabi -mcpu=cortex-a5 -enable-sign-dependent-rounding-fp-math | FileCheck %s --check-prefix=DYN-ROUNDING
391390 ; V8MMAINLINE: .eabi_attribute 7, 77
392391 ; V8MMAINLINE: .eabi_attribute 8, 0
393392 ; V8MMAINLINE: .eabi_attribute 9, 3
394 ; V8MMAINLINE_DSP-NOT: .eabi_attribute 46
395
396 ; V8MMAINLINE_DSP: .syntax unified
397 ; V8MBASELINE_DSP: .eabi_attribute 6, 17
398 ; V8MBASELINE_DSP: .eabi_attribute 7, 77
399 ; V8MMAINLINE_DSP: .eabi_attribute 8, 0
400 ; V8MMAINLINE_DSP: .eabi_attribute 9, 3
401 ; V8MMAINLINE_DSP: .eabi_attribute 46, 1
402393
403394 ; Tag_CPU_unaligned_access
404395 ; NO-STRICT-ALIGN: .eabi_attribute 34, 1
488479 ; CORTEX-A7-CHECK: .eabi_attribute 44, 2
489480 ; CORTEX-A7-NOFPU: .eabi_attribute 44, 2
490481 ; CORTEX-A7-FPUV4: .eabi_attribute 44, 2
491
492 ; Tag_DSP_extension
493 ; CORTEX-A7-CHECK-NOT: .eabi_attribute 46
494482
495483 ; Tag_Virtualization_use
496484 ; CORTEX-A7-CHECK: .eabi_attribute 68, 3
+0
-142
test/CodeGen/ARM/special-reg-v8m-base.ll less more
None ; RUN: not llc < %s -mtriple=thumb-none-eabi -mcpu=cortex-m4 2>&1 | FileCheck %s --check-prefix=V7M
1 ; RUN: llc < %s -mtriple=thumbv8m.base-none-eabi 2>&1 | FileCheck %s
2
3 ; V7M: LLVM ERROR: Invalid register name "sp_ns".
4
5 define i32 @read_mclass_registers() nounwind {
6 entry:
7 ; CHECK-LABEL: read_mclass_registers:
8 ; CHECK: mrs r0, apsr
9 ; CHECK: mrs r1, iapsr
10 ; CHECK: mrs r1, eapsr
11 ; CHECK: mrs r1, xpsr
12 ; CHECK: mrs r1, ipsr
13 ; CHECK: mrs r1, epsr
14 ; CHECK: mrs r1, iepsr
15 ; CHECK: mrs r1, msp
16 ; CHECK: mrs r1, psp
17 ; CHECK: mrs r1, primask
18 ; CHECK: mrs r1, control
19 ; CHECK: mrs r1, msplim
20 ; CHECK: mrs r1, psplim
21 ; CHECK: mrs r1, msp_ns
22 ; CHECK: mrs r1, psp_ns
23 ; CHECK: mrs r1, primask_ns
24 ; CHECK: mrs r1, control_ns
25 ; CHECK: mrs r1, sp_ns
26
27 %0 = call i32 @llvm.read_register.i32(metadata !0)
28 %1 = call i32 @llvm.read_register.i32(metadata !4)
29 %add1 = add i32 %1, %0
30 %2 = call i32 @llvm.read_register.i32(metadata !8)
31 %add2 = add i32 %add1, %2
32 %3 = call i32 @llvm.read_register.i32(metadata !12)
33 %add3 = add i32 %add2, %3
34 %4 = call i32 @llvm.read_register.i32(metadata !16)
35 %add4 = add i32 %add3, %4
36 %5 = call i32 @llvm.read_register.i32(metadata !17)
37 %add5 = add i32 %add4, %5
38 %6 = call i32 @llvm.read_register.i32(metadata !18)
39 %add6 = add i32 %add5, %6
40 %7 = call i32 @llvm.read_register.i32(metadata !19)
41 %add7 = add i32 %add6, %7
42 %8 = call i32 @llvm.read_register.i32(metadata !20)
43 %add8 = add i32 %add7, %8
44 %9 = call i32 @llvm.read_register.i32(metadata !21)
45 %add9 = add i32 %add8, %9
46 %10 = call i32 @llvm.read_register.i32(metadata !25)
47 %add10 = add i32 %add9, %10
48 %11 = call i32 @llvm.read_register.i32(metadata !26)
49 %add11 = add i32 %add10, %11
50 %12 = call i32 @llvm.read_register.i32(metadata !27)
51 %add12 = add i32 %add11, %12
52 %13 = call i32 @llvm.read_register.i32(metadata !28)
53 %add13 = add i32 %add12, %13
54 %14 = call i32 @llvm.read_register.i32(metadata !29)
55 %add14 = add i32 %add13, %14
56 %15 = call i32 @llvm.read_register.i32(metadata !32)
57 %add15 = add i32 %add14, %15
58 %16 = call i32 @llvm.read_register.i32(metadata !35)
59 %add16 = add i32 %add15, %16
60 %17 = call i32 @llvm.read_register.i32(metadata !36)
61 %add17 = add i32 %add16, %17
62 ret i32 %add10
63 }
64
65 define void @write_mclass_registers(i32 %x) nounwind {
66 entry:
67 ; CHECK-LABEL: write_mclass_registers:
68 ; CHECK: msr apsr, r0
69 ; CHECK: msr apsr, r0
70 ; CHECK: msr iapsr, r0
71 ; CHECK: msr iapsr, r0
72 ; CHECK: msr eapsr, r0
73 ; CHECK: msr eapsr, r0
74 ; CHECK: msr xpsr, r0
75 ; CHECK: msr xpsr, r0
76 ; CHECK: msr ipsr, r0
77 ; CHECK: msr epsr, r0
78 ; CHECK: msr iepsr, r0
79 ; CHECK: msr msp, r0
80 ; CHECK: msr psp, r0
81 ; CHECK: msr primask, r0
82 ; CHECK: msr control, r0
83 ; CHECK: msr msplim, r0
84 ; CHECK: msr psplim, r0
85 ; CHECK: msr msp_ns, r0
86 ; CHECK: msr psp_ns, r0
87 ; CHECK: msr primask_ns, r0
88 ; CHECK: msr control_ns, r0
89 ; CHECK: msr sp_ns, r0
90
91 call void @llvm.write_register.i32(metadata !0, i32 %x)
92 call void @llvm.write_register.i32(metadata !1, i32 %x)
93 call void @llvm.write_register.i32(metadata !4, i32 %x)
94 call void @llvm.write_register.i32(metadata !5, i32 %x)
95 call void @llvm.write_register.i32(metadata !8, i32 %x)
96 call void @llvm.write_register.i32(metadata !9, i32 %x)
97 call void @llvm.write_register.i32(metadata !12, i32 %x)
98 call void @llvm.write_register.i32(metadata !13, i32 %x)
99 call void @llvm.write_register.i32(metadata !16, i32 %x)
100 call void @llvm.write_register.i32(metadata !17, i32 %x)
101 call void @llvm.write_register.i32(metadata !18, i32 %x)
102 call void @llvm.write_register.i32(metadata !19, i32 %x)
103 call void @llvm.write_register.i32(metadata !20, i32 %x)
104 call void @llvm.write_register.i32(metadata !21, i32 %x)
105 call void @llvm.write_register.i32(metadata !25, i32 %x)
106 call void @llvm.write_register.i32(metadata !26, i32 %x)
107 call void @llvm.write_register.i32(metadata !27, i32 %x)
108 call void @llvm.write_register.i32(metadata !28, i32 %x)
109 call void @llvm.write_register.i32(metadata !29, i32 %x)
110 call void @llvm.write_register.i32(metadata !32, i32 %x)
111 call void @llvm.write_register.i32(metadata !35, i32 %x)
112 call void @llvm.write_register.i32(metadata !36, i32 %x)
113 ret void
114 }
115
116 declare i32 @llvm.read_register.i32(metadata) nounwind
117 declare void @llvm.write_register.i32(metadata, i32) nounwind
118
119 !0 = !{!"apsr"}
120 !1 = !{!"apsr_nzcvq"}
121 !4 = !{!"iapsr"}
122 !5 = !{!"iapsr_nzcvq"}
123 !8 = !{!"eapsr"}
124 !9 = !{!"eapsr_nzcvq"}
125 !12 = !{!"xpsr"}
126 !13 = !{!"xpsr_nzcvq"}
127 !16 = !{!"ipsr"}
128 !17 = !{!"epsr"}
129 !18 = !{!"iepsr"}
130 !19 = !{!"msp"}
131 !20 = !{!"psp"}
132 !21 = !{!"primask"}
133 !25 = !{!"control"}
134 !26 = !{!"msplim"}
135 !27 = !{!"psplim"}
136 !28 = !{!"msp_ns"}
137 !29 = !{!"psp_ns"}
138 !32 = !{!"primask_ns"}
139 !35 = !{!"control_ns"}
140 !36 = !{!"sp_ns"}
141
+0
-214
test/CodeGen/ARM/special-reg-v8m-main.ll less more
None ; RUN: not llc < %s -mtriple=thumbv8m.base-none-eabi 2>&1 | FileCheck %s --check-prefix=BASELINE
1 ; RUN: llc < %s -mtriple=thumbv8m.main-none-eabi -mattr=+dsp 2>&1 | FileCheck %s --check-prefix=MAINLINE
2
3 ; BASELINE: LLVM ERROR: Invalid register name "basepri_max_ns".
4
5 define i32 @read_mclass_registers() nounwind {
6 entry:
7 ; MAINLINE-LABEL: read_mclass_registers:
8 ; MAINLINE: mrs r0, apsr
9 ; MAINLINE: mrs r1, iapsr
10 ; MAINLINE: mrs r1, eapsr
11 ; MAINLINE: mrs r1, xpsr
12 ; MAINLINE: mrs r1, ipsr
13 ; MAINLINE: mrs r1, epsr
14 ; MAINLINE: mrs r1, iepsr
15 ; MAINLINE: mrs r1, msp
16 ; MAINLINE: mrs r1, psp
17 ; MAINLINE: mrs r1, primask
18 ; MAINLINE: mrs r1, basepri
19 ; MAINLINE: mrs r1, basepri_max
20 ; MAINLINE: mrs r1, faultmask
21 ; MAINLINE: mrs r1, control
22 ; MAINLINE: mrs r1, msplim
23 ; MAINLINE: mrs r1, psplim
24 ; MAINLINE: mrs r1, msp_ns
25 ; MAINLINE: mrs r1, psp_ns
26 ; MAINLINE: mrs r1, msplim_ns
27 ; MAINLINE: mrs r1, psplim_ns
28 ; MAINLINE: mrs r1, primask_ns
29 ; MAINLINE: mrs r1, basepri_ns
30 ; MAINLINE: mrs r1, faultmask_ns
31 ; MAINLINE: mrs r1, control_ns
32 ; MAINLINE: mrs r1, sp_ns
33 ; MAINLINE: mrs r1, basepri_max_ns
34
35 %0 = call i32 @llvm.read_register.i32(metadata !0)
36 %1 = call i32 @llvm.read_register.i32(metadata !4)
37 %add1 = add i32 %1, %0
38 %2 = call i32 @llvm.read_register.i32(metadata !8)
39 %add2 = add i32 %add1, %2
40 %3 = call i32 @llvm.read_register.i32(metadata !12)
41 %add3 = add i32 %add2, %3
42 %4 = call i32 @llvm.read_register.i32(metadata !16)
43 %add4 = add i32 %add3, %4
44 %5 = call i32 @llvm.read_register.i32(metadata !17)
45 %add5 = add i32 %add4, %5
46 %6 = call i32 @llvm.read_register.i32(metadata !18)
47 %add6 = add i32 %add5, %6
48 %7 = call i32 @llvm.read_register.i32(metadata !19)
49 %add7 = add i32 %add6, %7
50 %8 = call i32 @llvm.read_register.i32(metadata !20)
51 %add8 = add i32 %add7, %8
52 %9 = call i32 @llvm.read_register.i32(metadata !21)
53 %add9 = add i32 %add8, %9
54 %10 = call i32 @llvm.read_register.i32(metadata !22)
55 %add10 = add i32 %add9, %10
56 %11 = call i32 @llvm.read_register.i32(metadata !23)
57 %add11 = add i32 %add10, %11
58 %12 = call i32 @llvm.read_register.i32(metadata !24)
59 %add12 = add i32 %add11, %12
60 %13 = call i32 @llvm.read_register.i32(metadata !25)
61 %add13 = add i32 %add12, %13
62 %14 = call i32 @llvm.read_register.i32(metadata !26)
63 %add14 = add i32 %add13, %14
64 %15 = call i32 @llvm.read_register.i32(metadata !27)
65 %add15 = add i32 %add14, %15
66 %16 = call i32 @llvm.read_register.i32(metadata !28)
67 %add16 = add i32 %add15, %16
68 %17 = call i32 @llvm.read_register.i32(metadata !29)
69 %add17 = add i32 %add16, %17
70 %18 = call i32 @llvm.read_register.i32(metadata !30)
71 %add18 = add i32 %add17, %18
72 %19 = call i32 @llvm.read_register.i32(metadata !31)
73 %add19 = add i32 %add18, %19
74 %20 = call i32 @llvm.read_register.i32(metadata !32)
75 %add20 = add i32 %add19, %20
76 %21 = call i32 @llvm.read_register.i32(metadata !33)
77 %add21 = add i32 %add20, %21
78 %22 = call i32 @llvm.read_register.i32(metadata !34)
79 %add22 = add i32 %add21, %22
80 %23 = call i32 @llvm.read_register.i32(metadata !35)
81 %add23 = add i32 %add22, %23
82 %24 = call i32 @llvm.read_register.i32(metadata !36)
83 %add24 = add i32 %add23, %24
84 %25 = call i32 @llvm.read_register.i32(metadata !37)
85 %add25 = add i32 %add24, %25
86 ret i32 %add25
87 }
88
89 define void @write_mclass_registers(i32 %x) nounwind {
90 entry:
91 ; MAINLINE-LABEL: write_mclass_registers:
92 ; MAINLINE: msr apsr_nzcvqg, r0
93 ; MAINLINE: msr apsr_nzcvq, r0
94 ; MAINLINE: msr apsr_g, r0
95 ; MAINLINE: msr apsr_nzcvqg, r0
96 ; MAINLINE: msr iapsr_nzcvqg, r0
97 ; MAINLINE: msr iapsr_nzcvq, r0
98 ; MAINLINE: msr iapsr_g, r0
99 ; MAINLINE: msr iapsr_nzcvqg, r0
100 ; MAINLINE: msr eapsr_nzcvqg, r0
101 ; MAINLINE: msr eapsr_nzcvq, r0
102 ; MAINLINE: msr eapsr_g, r0
103 ; MAINLINE: msr eapsr_nzcvqg, r0
104 ; MAINLINE: msr xpsr_nzcvqg, r0
105 ; MAINLINE: msr xpsr_nzcvq, r0
106 ; MAINLINE: msr xpsr_g, r0
107 ; MAINLINE: msr xpsr_nzcvqg, r0
108 ; MAINLINE: msr ipsr, r0
109 ; MAINLINE: msr epsr, r0
110 ; MAINLINE: msr iepsr, r0
111 ; MAINLINE: msr msp, r0
112 ; MAINLINE: msr psp, r0
113 ; MAINLINE: msr primask, r0
114 ; MAINLINE: msr basepri, r0
115 ; MAINLINE: msr basepri_max, r0
116 ; MAINLINE: msr faultmask, r0
117 ; MAINLINE: msr control, r0
118 ; MAINLINE: msr msplim, r0
119 ; MAINLINE: msr psplim, r0
120 ; MAINLINE: msr msp_ns, r0
121 ; MAINLINE: msr psp_ns, r0
122 ; MAINLINE: msr msplim_ns, r0
123 ; MAINLINE: msr psplim_ns, r0
124 ; MAINLINE: msr primask_ns, r0
125 ; MAINLINE: msr basepri_ns, r0
126 ; MAINLINE: msr faultmask_ns, r0
127 ; MAINLINE: msr control_ns, r0
128 ; MAINLINE: msr sp_ns, r0
129 ; MAINLINE: msr basepri_max_ns, r0
130
131 call void @llvm.write_register.i32(metadata !0, i32 %x)
132 call void @llvm.write_register.i32(metadata !1, i32 %x)
133 call void @llvm.write_register.i32(metadata !2, i32 %x)
134 call void @llvm.write_register.i32(metadata !3, i32 %x)
135 call void @llvm.write_register.i32(metadata !4, i32 %x)
136 call void @llvm.write_register.i32(metadata !5, i32 %x)
137 call void @llvm.write_register.i32(metadata !6, i32 %x)
138 call void @llvm.write_register.i32(metadata !7, i32 %x)
139 call void @llvm.write_register.i32(metadata !8, i32 %x)
140 call void @llvm.write_register.i32(metadata !9, i32 %x)
141 call void @llvm.write_register.i32(metadata !10, i32 %x)
142 call void @llvm.write_register.i32(metadata !11, i32 %x)
143 call void @llvm.write_register.i32(metadata !12, i32 %x)
144 call void @llvm.write_register.i32(metadata !13, i32 %x)
145 call void @llvm.write_register.i32(metadata !14, i32 %x)
146 call void @llvm.write_register.i32(metadata !15, i32 %x)
147 call void @llvm.write_register.i32(metadata !16, i32 %x)
148 call void @llvm.write_register.i32(metadata !17, i32 %x)
149 call void @llvm.write_register.i32(metadata !18, i32 %x)
150 call void @llvm.write_register.i32(metadata !19, i32 %x)
151 call void @llvm.write_register.i32(metadata !20, i32 %x)
152 call void @llvm.write_register.i32(metadata !21, i32 %x)
153 call void @llvm.write_register.i32(metadata !22, i32 %x)
154 call void @llvm.write_register.i32(metadata !23, i32 %x)
155 call void @llvm.write_register.i32(metadata !24, i32 %x)
156 call void @llvm.write_register.i32(metadata !25, i32 %x)
157 call void @llvm.write_register.i32(metadata !26, i32 %x)
158 call void @llvm.write_register.i32(metadata !27, i32 %x)
159 call void @llvm.write_register.i32(metadata !28, i32 %x)
160 call void @llvm.write_register.i32(metadata !29, i32 %x)
161 call void @llvm.write_register.i32(metadata !30, i32 %x)
162 call void @llvm.write_register.i32(metadata !31, i32 %x)
163 call void @llvm.write_register.i32(metadata !32, i32 %x)
164 call void @llvm.write_register.i32(metadata !33, i32 %x)
165 call void @llvm.write_register.i32(metadata !34, i32 %x)
166 call void @llvm.write_register.i32(metadata !35, i32 %x)
167 call void @llvm.write_register.i32(metadata !36, i32 %x)
168 call void @llvm.write_register.i32(metadata !37, i32 %x)
169 ret void
170 }
171
172 declare i32 @llvm.read_register.i32(metadata) nounwind
173 declare void @llvm.write_register.i32(metadata, i32) nounwind
174
175 !0 = !{!"apsr"}
176 !1 = !{!"apsr_nzcvq"}
177 !2 = !{!"apsr_g"}
178 !3 = !{!"apsr_nzcvqg"}
179 !4 = !{!"iapsr"}
180 !5 = !{!"iapsr_nzcvq"}
181 !6 = !{!"iapsr_g"}
182 !7 = !{!"iapsr_nzcvqg"}
183 !8 = !{!"eapsr"}
184 !9 = !{!"eapsr_nzcvq"}
185 !10 = !{!"eapsr_g"}
186 !11 = !{!"eapsr_nzcvqg"}
187 !12 = !{!"xpsr"}
188 !13 = !{!"xpsr_nzcvq"}
189 !14 = !{!"xpsr_g"}
190 !15 = !{!"xpsr_nzcvqg"}
191 !16 = !{!"ipsr"}
192 !17 = !{!"epsr"}
193 !18 = !{!"iepsr"}
194 !19 = !{!"msp"}
195 !20 = !{!"psp"}
196 !21 = !{!"primask"}
197 !22 = !{!"basepri"}
198 !23 = !{!"basepri_max"}
199 !24 = !{!"faultmask"}
200 !25 = !{!"control"}
201 !26 = !{!"msplim"}
202 !27 = !{!"psplim"}
203 !28 = !{!"msp_ns"}
204 !29 = !{!"psp_ns"}
205 !30 = !{!"msplim_ns"}
206 !31 = !{!"psplim_ns"}
207 !32 = !{!"primask_ns"}
208 !33 = !{!"basepri_ns"}
209 !34 = !{!"faultmask_ns"}
210 !35 = !{!"control_ns"}
211 !36 = !{!"sp_ns"}
212 !37 = !{!"basepri_max_ns"}
213
208208 @ CHECK-OBJ-NEXT: Value: 0
209209 @ CHECK-OBJ-NEXT: TagName: DIV_use
210210 @ CHECK-OBJ-NEXT: Description: If Available
211 .eabi_attribute Tag_DSP_extension, 0
212 @ CHECK: .eabi_attribute 46, 0
213 @ CHECK-OBJ: Tag: 46
214 @ CHECK-OBJ-NEXT: Value: 0
215 @ CHECK-OBJ-NEXT: TagName: DSP_extension
216 @ CHECK-OBJ-NEXT: Description: Not Permitted
217211 .eabi_attribute Tag_nodefaults, 0
218212 @ CHECK: .eabi_attribute 64, 0
219213 @ CHECK-OBJ: Tag: 64
33 // RUN: not llvm-mc -triple=thumbv8m.main -show-encoding < %s 2>%t \
44 // RUN: | FileCheck --check-prefix=CHECK-MAINLINE --check-prefix=CHECK %s
55 // RUN: FileCheck --check-prefix=UNDEF-MAINLINE --check-prefix=UNDEF < %t %s
6 // RUN: not llvm-mc -triple=thumbv8m.main -mattr=+dsp,+t2xtpk -show-encoding < %s 2>%t \
7 // RUN: | FileCheck --check-prefix=CHECK-MAINLINE_DSP --check-prefix=CHECK %s
8 // RUN: FileCheck --check-prefix=UNDEF-MAINLINE_DSP --check-prefix=UNDEF < %t %s
96
107 // Simple check that baseline is v6M and mainline is v7M
118 // UNDEF-BASELINE: error: instruction requires: thumb2
129 // UNDEF-MAINLINE-NOT: error: instruction requires:
13 // UNDEF-MAINLINE_DSP-NOT: error: instruction requires:
1410 mov.w r0, r0
1511
1612 // Check that .arm is invalid
1713 // UNDEF: target does not support ARM mode
1814 .arm
1915
20 // And only +dsp,+t2xtpk has DSP and t2xtpk instructions
21 // UNDEF-BASELINE: error: instruction requires: arm-mode
22 // UNDEF-MAINLINE: error: instruction requires: arm-mode
23 // UNDEF-MAINLINE_DSP-NOT: error: instruction requires:
24 qadd16 r0, r0, r0
25 // UNDEF-BASELINE: error: instruction requires: arm-mode
26 // UNDEF-MAINLINE: error: instruction requires: arm-mode
27 // UNDEF-MAINLINE_DSP-NOT: error: instruction requires:
28 uxtab16 r0, r1, r2
29
3016 // Instruction availibility checks
3117
3218 // 'Barrier instructions'
170156
171157 // UNDEF-BASELINE: error: instruction requires: armv8m.main
172158 // CHECK-MAINLINE: vlldm r5 @ encoding: [0x35,0xec,0x00,0x0a]
173 // CHECK-MAINLINE_DSP: vlldm r5 @ encoding: [0x35,0xec,0x00,0x0a]
174159 vlldm r5
175160
176161 // UNDEF-BASELINE: error: instruction requires: armv8m.main
177162 // CHECK-MAINLINE: vlstm r10 @ encoding: [0x2a,0xec,0x00,0x0a]
178 // CHECK-MAINLINE_DSP: vlstm r10 @ encoding: [0x2a,0xec,0x00,0x0a]
179163 vlstm r10
180164
181 // New SYSm's
182
183 MRS r1, MSP_NS
184 // CHECK: mrs r1, msp_ns @ encoding: [0xef,0xf3,0x88,0x81]
185 MSR PSP_NS, r2
186 // CHECK: msr psp_ns, r2 @ encoding: [0x82,0xf3,0x89,0x88]
187 MRS r3, PRIMASK_NS
188 // CHECK: mrs r3, primask_ns @ encoding: [0xef,0xf3,0x90,0x83]
189 MSR CONTROL_NS, r4
190 // CHECK: msr control_ns, r4 @ encoding: [0x84,0xf3,0x94,0x88]
191 MRS r5, SP_NS
192 // CHECK: mrs r5, sp_ns @ encoding: [0xef,0xf3,0x98,0x85]
193 MRS r6,MSPLIM
194 // CHECK: mrs r6, msplim @ encoding: [0xef,0xf3,0x0a,0x86]
195 MRS r7,PSPLIM
196 // CHECK: mrs r7, psplim @ encoding: [0xef,0xf3,0x0b,0x87]
197 MSR MSPLIM,r8
198 // CHECK: msr msplim, r8 @ encoding: [0x88,0xf3,0x0a,0x88]
199 MSR PSPLIM,r9
200 // CHECK: msr psplim, r9 @ encoding: [0x89,0xf3,0x0b,0x88]
201
202 MRS r10, MSPLIM_NS
203 // CHECK-MAINLINE: mrs r10, msplim_ns @ encoding: [0xef,0xf3,0x8a,0x8a]
204 // UNDEF-BASELINE: error: invalid operand for instruction
205 MSR PSPLIM_NS, r11
206 // CHECK-MAINLINE: msr psplim_ns, r11 @ encoding: [0x8b,0xf3,0x8b,0x88]
207 // UNDEF-BASELINE: error: invalid operand for instruction
208 MRS r12, BASEPRI_NS
209 // CHECK-MAINLINE: mrs r12, basepri_ns @ encoding: [0xef,0xf3,0x91,0x8c]
210 // UNDEF-BASELINE: error: invalid operand for instruction
211 MRS r12, BASEPRI_MAX_NS
212 // CHECK-MAINLINE: mrs r12, basepri_max_ns @ encoding: [0xef,0xf3,0x92,0x8c]
213 // UNDEF-BASELINE: error: invalid operand for instruction
214 MSR FAULTMASK_NS, r14
215 // CHECK-MAINLINE: msr faultmask_ns, lr @ encoding: [0x8e,0xf3,0x93,0x88]
216 // UNDEF-BASELINE: error: invalid operand for instruction
217165
218166 // Invalid operand tests
219167 // UNDEF: error: invalid operand for instruction
+0
-25
test/MC/Disassembler/ARM/thumb2-v8m.txt less more
None # RUN: llvm-mc -triple=thumbv8m.base -disassemble < %s 2>%t | FileCheck %s
1 # RUN: FileCheck < %t %s --check-prefix=CHECK-STDERR
2 # RUN: llvm-mc -triple=thumbv8m.main -disassemble < %s | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-MAINLINE
3
4 0xef 0xf3 0x0a 0x83
5 # CHECK: mrs r3, msplim
6 0xef 0xf3 0x0b 0x84
7 # CHECK: mrs r4, psplim
8 0x8b 0xf3 0x0a 0x88
9 # CHECK: msr msplim, r11
10 0x8c 0xf3 0x0b 0x88
11 # CHECK: msr psplim, r12
12
13 0xef 0xf3 0x90 0x86
14 # CHECK: mrs r6, primask_ns
15 0x88 0xf3 0x98 0x88
16 # CHECK: msr sp_ns, r8
17
18 0xef 0xf3 0x8a 0x85
19 # CHECK-STDERR: warning: invalid instruction encoding
20 # CHECK-MAINLINE: mrs r5, msplim_ns
21 0x87 0xf3 0x93 0x88
22 # CHECK-STDERR: warning: invalid instruction encoding
23 # CHECK-MAINLINE: msr faultmask_ns, r7
24
224224 @CHECK-OBJ-NEXT: TagName: DIV_use
225225 @CHECK-OBJ-NEXT: Description: If Available
226226
227 .eabi_attribute Tag_DSP_extension, 0
228 @CHECK: .eabi_attribute 46, 0
229 @CHECK-OBJ: Tag: 46
230 @CHECK-OBJ-NEXT: Value: 0
231 @CHECK-OBJ-NEXT: TagName: DSP_extension
232 @CHECK-OBJ-NEXT: Description: Not Permitted
233
234227 .eabi_attribute Tag_Virtualization_use, 0
235228 @CHECK: .eabi_attribute 68, 0
236229 @CHECK-OBJ: Tag: 68
210210 @CHECK-OBJ-NEXT: TagName: DIV_use
211211 @CHECK-OBJ-NEXT: Description: Not Permitted
212212
213 .eabi_attribute Tag_DSP_extension, 1
214 @CHECK: .eabi_attribute 46, 1
215 @CHECK-OBJ: Tag: 46
216 @CHECK-OBJ-NEXT: Value: 1
217 @CHECK-OBJ-NEXT: TagName: DSP_extension
218 @CHECK-OBJ-NEXT: Description: Permitted
219
220213 .eabi_attribute Tag_Virtualization_use, 1
221214 @CHECK: .eabi_attribute 68, 1
222215 @CHECK-OBJ: Tag: 68
6262 ATTRIBUTE_HANDLER(ABI_FP_16bit_format),
6363 ATTRIBUTE_HANDLER(MPextension_use),
6464 ATTRIBUTE_HANDLER(DIV_use),
65 ATTRIBUTE_HANDLER(DSP_extension),
6665 ATTRIBUTE_HANDLER(T2EE_use),
6766 ATTRIBUTE_HANDLER(Virtualization_use),
6867 ATTRIBUTE_HANDLER(nodefaults)
510509 static const char *const Strings[] = {
511510 "If Available", "Not Permitted", "Permitted"
512511 };
513
514 uint64_t Value = ParseInteger(Data, Offset);
515 StringRef ValueDesc =
516 (Value < array_lengthof(Strings)) ? Strings[Value] : nullptr;
517 PrintAttribute(Tag, Value, ValueDesc);
518 }
519
520 void ARMAttributeParser::DSP_extension(AttrType Tag, const uint8_t *Data,
521 uint32_t &Offset) {
522 static const char *const Strings[] = { "Not Permitted", "Permitted" };
523512
524513 uint64_t Value = ParseInteger(Data, Offset);
525514 StringRef ValueDesc =
9999 uint32_t &Offset);
100100 void DIV_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
101101 uint32_t &Offset);
102 void DSP_extension(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
103 uint32_t &Offset);
104102 void T2EE_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,
105103 uint32_t &Offset);
106104 void Virtualization_use(ARMBuildAttrs::AttrType Tag, const uint8_t *Data,