Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: src/trusted/validator_arm/gen/arm32_decode_media_instructions_tests.cc

Issue 11569019: Fix uses in ARM table media_instructions. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The Native Client Authors. All rights reserved. 2 * Copyright 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can 3 * Use of this source code is governed by a BSD-style license that can
4 * be found in the LICENSE file. 4 * be found in the LICENSE file.
5 */ 5 */
6 6
7 // DO NOT EDIT: GENERATED CODE 7 // DO NOT EDIT: GENERATED CODE
8 8
9 #ifndef NACL_TRUSTED_BUT_NOT_TCB 9 #ifndef NACL_TRUSTED_BUT_NOT_TCB
10 #error This file is not meant for use in the TCB 10 #error This file is not meant for use in the TCB
(...skipping 17 matching lines...) Expand all
28 // add row pattern constraints and decoder restrictions to each tester. 28 // add row pattern constraints and decoder restrictions to each tester.
29 // This is done so that it can be used to make sure that the 29 // This is done so that it can be used to make sure that the
30 // corresponding pattern is not tested for cases that would be excluded 30 // corresponding pattern is not tested for cases that would be excluded
31 // due to row checks, or restrictions specified by the row restrictions. 31 // due to row checks, or restrictions specified by the row restrictions.
32 32
33 33
34 // Neutral case: 34 // Neutral case:
35 // inst(24:20)=11000 & inst(7:5)=000 & inst(15:12)=~1111 35 // inst(24:20)=11000 & inst(7:5)=000 & inst(15:12)=~1111
36 // = {baseline: 'Binary4RegisterDualOp', 36 // = {baseline: 'Binary4RegisterDualOp',
37 // constraints: , 37 // constraints: ,
38 // safety: ["'RegsNotPc'"]} 38 // defs: {inst(19:16)},
39 // safety: ['15 == inst(15:12) => DECODER_ERROR', '15 == inst(19:16) || 15 == inst(3:0) || 15 == inst(11:8) => UNPREDICTABLE']}
39 // 40 //
40 // Representaive case: 41 // Representaive case:
41 // op1(24:20)=11000 & op2(7:5)=000 & Rd(15:12)=~1111 42 // op1(24:20)=11000 & op2(7:5)=000 & Rd(15:12)=~1111
42 // = {baseline: Binary4RegisterDualOp, 43 // = {Pc: 15,
44 // Ra: Ra(15:12),
45 // Rd: Rd(19:16),
46 // Rm: Rm(11:8),
47 // Rn: Rn(3:0),
48 // baseline: Binary4RegisterDualOp,
43 // constraints: , 49 // constraints: ,
44 // safety: ['RegsNotPc']} 50 // defs: {Rd},
51 // fields: [Rd(19:16), Ra(15:12), Rm(11:8), Rn(3:0)],
52 // safety: [Ra == Pc => DECODER_ERROR, Pc in {Rd,Rn,Rm} => UNPREDICTABLE]}
45 class Binary4RegisterDualOpTesterCase0 53 class Binary4RegisterDualOpTesterCase0
46 : public Binary4RegisterDualOpTesterRegsNotPc { 54 : public Binary4RegisterDualOpTester {
47 public: 55 public:
48 Binary4RegisterDualOpTesterCase0(const NamedClassDecoder& decoder) 56 Binary4RegisterDualOpTesterCase0(const NamedClassDecoder& decoder)
49 : Binary4RegisterDualOpTesterRegsNotPc(decoder) {} 57 : Binary4RegisterDualOpTester(decoder) {}
50 virtual bool PassesParsePreconditions( 58 virtual bool PassesParsePreconditions(
51 nacl_arm_dec::Instruction inst, 59 nacl_arm_dec::Instruction inst,
52 const NamedClassDecoder& decoder); 60 const NamedClassDecoder& decoder);
61 virtual bool ApplySanityChecks(nacl_arm_dec::Instruction inst,
62 const NamedClassDecoder& decoder);
53 }; 63 };
54 64
55 bool Binary4RegisterDualOpTesterCase0 65 bool Binary4RegisterDualOpTesterCase0
56 ::PassesParsePreconditions( 66 ::PassesParsePreconditions(
57 nacl_arm_dec::Instruction inst, 67 nacl_arm_dec::Instruction inst,
58 const NamedClassDecoder& decoder) { 68 const NamedClassDecoder& decoder) {
59 69
60 // Check that row patterns apply to pattern being checked.' 70 // Check that row patterns apply to pattern being checked.'
61 if ((inst.Bits() & 0x01F00000) != 0x01800000 /* op1(24:20)=~11000 */) return f alse; 71 if ((inst.Bits() & 0x01F00000) != 0x01800000 /* op1(24:20)=~11000 */) return f alse;
62 if ((inst.Bits() & 0x000000E0) != 0x00000000 /* op2(7:5)=~000 */) return false ; 72 if ((inst.Bits() & 0x000000E0) != 0x00000000 /* op2(7:5)=~000 */) return false ;
63 if ((inst.Bits() & 0x0000F000) == 0x0000F000 /* Rd(15:12)=1111 */) return fals e; 73 if ((inst.Bits() & 0x0000F000) == 0x0000F000 /* Rd(15:12)=1111 */) return fals e;
64 74
65 // Check other preconditions defined for the base decoder. 75 // Check other preconditions defined for the base decoder.
66 return Binary4RegisterDualOpTesterRegsNotPc:: 76 return Binary4RegisterDualOpTester::
67 PassesParsePreconditions(inst, decoder); 77 PassesParsePreconditions(inst, decoder);
68 } 78 }
69 79
80 bool Binary4RegisterDualOpTesterCase0
81 ::ApplySanityChecks(nacl_arm_dec::Instruction inst,
82 const NamedClassDecoder& decoder) {
83 NC_PRECOND(Binary4RegisterDualOpTester::ApplySanityChecks(inst, decoder));
84
85 // safety: Ra == Pc => DECODER_ERROR
86 EXPECT_TRUE(((((inst.Bits() & 0x0000F000) >> 12)) != (15)));
87
88 // safety: Pc in {Rd,Rn,Rm} => UNPREDICTABLE
89 EXPECT_TRUE(!((((15) == (((inst.Bits() & 0x000F0000) >> 16)))) || (((15) == (( inst.Bits() & 0x0000000F)))) || (((15) == (((inst.Bits() & 0x00000F00) >> 8))))) );
90
91 // defs: {Rd};
92 EXPECT_TRUE(decoder.defs(inst).IsSame(RegisterList().Add(Register(((inst.Bits( ) & 0x000F0000) >> 16)))));
93
94 return true;
95 }
96
70 // Neutral case: 97 // Neutral case:
71 // inst(24:20)=11000 & inst(7:5)=000 & inst(15:12)=1111 98 // inst(24:20)=11000 & inst(7:5)=000 & inst(15:12)=1111
72 // = {baseline: 'Binary3RegisterOpAltA', 99 // = {baseline: 'Binary3RegisterOpAltA',
73 // constraints: , 100 // constraints: ,
74 // safety: ["'RegsNotPc'"]} 101 // defs: {inst(19:16)},
102 // safety: ['15 == inst(19:16) || 15 == inst(3:0) || 15 == inst(11:8) => U NPREDICTABLE']}
75 // 103 //
76 // Representaive case: 104 // Representaive case:
77 // op1(24:20)=11000 & op2(7:5)=000 & Rd(15:12)=1111 105 // op1(24:20)=11000 & op2(7:5)=000 & Rd(15:12)=1111
78 // = {baseline: Binary3RegisterOpAltA, 106 // = {Pc: 15,
107 // Rd: Rd(19:16),
108 // Rm: Rm(11:8),
109 // Rn: Rn(3:0),
110 // baseline: Binary3RegisterOpAltA,
79 // constraints: , 111 // constraints: ,
80 // safety: ['RegsNotPc']} 112 // defs: {Rd},
113 // fields: [Rd(19:16), Rm(11:8), Rn(3:0)],
114 // safety: [Pc in {Rd,Rn,Rm} => UNPREDICTABLE]}
81 class Binary3RegisterOpAltATesterCase1 115 class Binary3RegisterOpAltATesterCase1
82 : public Binary3RegisterOpAltATesterRegsNotPc { 116 : public Binary3RegisterOpAltATester {
83 public: 117 public:
84 Binary3RegisterOpAltATesterCase1(const NamedClassDecoder& decoder) 118 Binary3RegisterOpAltATesterCase1(const NamedClassDecoder& decoder)
85 : Binary3RegisterOpAltATesterRegsNotPc(decoder) {} 119 : Binary3RegisterOpAltATester(decoder) {}
86 virtual bool PassesParsePreconditions( 120 virtual bool PassesParsePreconditions(
87 nacl_arm_dec::Instruction inst, 121 nacl_arm_dec::Instruction inst,
88 const NamedClassDecoder& decoder); 122 const NamedClassDecoder& decoder);
123 virtual bool ApplySanityChecks(nacl_arm_dec::Instruction inst,
124 const NamedClassDecoder& decoder);
89 }; 125 };
90 126
91 bool Binary3RegisterOpAltATesterCase1 127 bool Binary3RegisterOpAltATesterCase1
92 ::PassesParsePreconditions( 128 ::PassesParsePreconditions(
93 nacl_arm_dec::Instruction inst, 129 nacl_arm_dec::Instruction inst,
94 const NamedClassDecoder& decoder) { 130 const NamedClassDecoder& decoder) {
95 131
96 // Check that row patterns apply to pattern being checked.' 132 // Check that row patterns apply to pattern being checked.'
97 if ((inst.Bits() & 0x01F00000) != 0x01800000 /* op1(24:20)=~11000 */) return f alse; 133 if ((inst.Bits() & 0x01F00000) != 0x01800000 /* op1(24:20)=~11000 */) return f alse;
98 if ((inst.Bits() & 0x000000E0) != 0x00000000 /* op2(7:5)=~000 */) return false ; 134 if ((inst.Bits() & 0x000000E0) != 0x00000000 /* op2(7:5)=~000 */) return false ;
99 if ((inst.Bits() & 0x0000F000) != 0x0000F000 /* Rd(15:12)=~1111 */) return fal se; 135 if ((inst.Bits() & 0x0000F000) != 0x0000F000 /* Rd(15:12)=~1111 */) return fal se;
100 136
101 // Check other preconditions defined for the base decoder. 137 // Check other preconditions defined for the base decoder.
102 return Binary3RegisterOpAltATesterRegsNotPc:: 138 return Binary3RegisterOpAltATester::
103 PassesParsePreconditions(inst, decoder); 139 PassesParsePreconditions(inst, decoder);
104 } 140 }
105 141
142 bool Binary3RegisterOpAltATesterCase1
143 ::ApplySanityChecks(nacl_arm_dec::Instruction inst,
144 const NamedClassDecoder& decoder) {
145 NC_PRECOND(Binary3RegisterOpAltATester::ApplySanityChecks(inst, decoder));
146
147 // safety: Pc in {Rd,Rn,Rm} => UNPREDICTABLE
148 EXPECT_TRUE(!((((15) == (((inst.Bits() & 0x000F0000) >> 16)))) || (((15) == (( inst.Bits() & 0x0000000F)))) || (((15) == (((inst.Bits() & 0x00000F00) >> 8))))) );
149
150 // defs: {Rd};
151 EXPECT_TRUE(decoder.defs(inst).IsSame(RegisterList().Add(Register(((inst.Bits( ) & 0x000F0000) >> 16)))));
152
153 return true;
154 }
155
106 // Neutral case: 156 // Neutral case:
107 // inst(24:20)=11111 & inst(7:5)=111 157 // inst(24:20)=11111 & inst(7:5)=111
108 // = {baseline: 'PermanentlyUndefined', 158 // = {baseline: 'PermanentlyUndefined',
109 // constraints: } 159 // constraints: }
110 // 160 //
111 // Representaive case: 161 // Representaive case:
112 // op1(24:20)=11111 & op2(7:5)=111 162 // op1(24:20)=11111 & op2(7:5)=111
113 // = {baseline: PermanentlyUndefined, 163 // = {baseline: PermanentlyUndefined,
114 // constraints: } 164 // constraints: }
115 class PermanentlyUndefinedTesterCase2 165 class PermanentlyUndefinedTesterCase2
(...skipping 17 matching lines...) Expand all
133 183
134 // Check other preconditions defined for the base decoder. 184 // Check other preconditions defined for the base decoder.
135 return PermanentlyUndefinedTester:: 185 return PermanentlyUndefinedTester::
136 PassesParsePreconditions(inst, decoder); 186 PassesParsePreconditions(inst, decoder);
137 } 187 }
138 188
139 // Neutral case: 189 // Neutral case:
140 // inst(24:20)=1101x & inst(7:5)=x10 190 // inst(24:20)=1101x & inst(7:5)=x10
141 // = {baseline: 'Binary2RegisterBitRangeNotRnIsPcBitfieldExtract', 191 // = {baseline: 'Binary2RegisterBitRangeNotRnIsPcBitfieldExtract',
142 // constraints: , 192 // constraints: ,
143 // safety: ["'RegsNotPc'"]} 193 // defs: {inst(15:12)},
194 // safety: ['15 == inst(15:12) || 15 == inst(3:0) => UNPREDICTABLE', '31 < = inst(11:7) + inst(20:16) => UNPREDICTABLE']}
144 // 195 //
145 // Representaive case: 196 // Representaive case:
146 // op1(24:20)=1101x & op2(7:5)=x10 197 // op1(24:20)=1101x & op2(7:5)=x10
147 // = {baseline: Binary2RegisterBitRangeNotRnIsPcBitfieldExtract, 198 // = {Pc: 15,
199 // Rd: Rd(15:12),
200 // Rn: Rn(3:0),
201 // baseline: Binary2RegisterBitRangeNotRnIsPcBitfieldExtract,
148 // constraints: , 202 // constraints: ,
149 // safety: ['RegsNotPc']} 203 // defs: {Rd},
204 // fields: [widthm1(20:16), Rd(15:12), lsb(11:7), Rn(3:0)],
205 // lsb: lsb(11:7),
206 // safety: [Pc in {Rd,Rn} => UNPREDICTABLE, lsb + widthm1 > 31 => UNPREDIC TABLE],
207 // widthm1: widthm1(20:16)}
150 class Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterCase3 208 class Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterCase3
151 : public Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterRegsNotPc { 209 : public Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester {
152 public: 210 public:
153 Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterCase3(const NamedClassDec oder& decoder) 211 Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterCase3(const NamedClassDec oder& decoder)
154 : Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterRegsNotPc(decoder) {} 212 : Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester(decoder) {}
155 virtual bool PassesParsePreconditions( 213 virtual bool PassesParsePreconditions(
156 nacl_arm_dec::Instruction inst, 214 nacl_arm_dec::Instruction inst,
157 const NamedClassDecoder& decoder); 215 const NamedClassDecoder& decoder);
216 virtual bool ApplySanityChecks(nacl_arm_dec::Instruction inst,
217 const NamedClassDecoder& decoder);
158 }; 218 };
159 219
160 bool Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterCase3 220 bool Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterCase3
161 ::PassesParsePreconditions( 221 ::PassesParsePreconditions(
162 nacl_arm_dec::Instruction inst, 222 nacl_arm_dec::Instruction inst,
163 const NamedClassDecoder& decoder) { 223 const NamedClassDecoder& decoder) {
164 224
165 // Check that row patterns apply to pattern being checked.' 225 // Check that row patterns apply to pattern being checked.'
166 if ((inst.Bits() & 0x01E00000) != 0x01A00000 /* op1(24:20)=~1101x */) return f alse; 226 if ((inst.Bits() & 0x01E00000) != 0x01A00000 /* op1(24:20)=~1101x */) return f alse;
167 if ((inst.Bits() & 0x00000060) != 0x00000040 /* op2(7:5)=~x10 */) return false ; 227 if ((inst.Bits() & 0x00000060) != 0x00000040 /* op2(7:5)=~x10 */) return false ;
168 228
169 // Check other preconditions defined for the base decoder. 229 // Check other preconditions defined for the base decoder.
170 return Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterRegsNotPc:: 230 return Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester::
171 PassesParsePreconditions(inst, decoder); 231 PassesParsePreconditions(inst, decoder);
172 } 232 }
173 233
234 bool Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterCase3
235 ::ApplySanityChecks(nacl_arm_dec::Instruction inst,
236 const NamedClassDecoder& decoder) {
237 NC_PRECOND(Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester::ApplySanityC hecks(inst, decoder));
238
239 // safety: Pc in {Rd,Rn} => UNPREDICTABLE
240 EXPECT_TRUE(!((((15) == (((inst.Bits() & 0x0000F000) >> 12)))) || (((15) == (( inst.Bits() & 0x0000000F))))));
241
242 // safety: lsb + widthm1 > 31 => UNPREDICTABLE
243 EXPECT_TRUE(((((inst.Bits() & 0x00000F80) >> 7) + ((inst.Bits() & 0x001F0000) >> 16)) <= (31)));
244
245 // defs: {Rd};
246 EXPECT_TRUE(decoder.defs(inst).IsSame(RegisterList().Add(Register(((inst.Bits( ) & 0x0000F000) >> 12)))));
247
248 return true;
249 }
250
174 // Neutral case: 251 // Neutral case:
175 // inst(24:20)=1110x & inst(7:5)=x00 & inst(3:0)=~1111 252 // inst(24:20)=1110x & inst(7:5)=x00 & inst(3:0)=~1111
176 // = {baseline: 'Binary2RegisterBitRangeMsbGeLsb', 253 // = {baseline: 'Binary2RegisterBitRangeMsbGeLsb',
177 // constraints: , 254 // constraints: ,
178 // safety: ["'RegsNotPc'"]} 255 // defs: {inst(15:12)},
256 // safety: ['15 == inst(3:0) => DECODER_ERROR', '15 == inst(15:12) => UNPR EDICTABLE', 'inst(20:16) < inst(11:7) => UNPREDICTABLE']}
179 // 257 //
180 // Representaive case: 258 // Representaive case:
181 // op1(24:20)=1110x & op2(7:5)=x00 & Rn(3:0)=~1111 259 // op1(24:20)=1110x & op2(7:5)=x00 & Rn(3:0)=~1111
182 // = {baseline: Binary2RegisterBitRangeMsbGeLsb, 260 // = {Pc: 15,
261 // Rd: Rd(15:12),
262 // Rn: Rn(3:0),
263 // baseline: Binary2RegisterBitRangeMsbGeLsb,
183 // constraints: , 264 // constraints: ,
184 // safety: ['RegsNotPc']} 265 // defs: {Rd},
266 // fields: [msb(20:16), Rd(15:12), lsb(11:7), Rn(3:0)],
267 // lsb: lsb(11:7),
268 // msb: msb(20:16),
269 // safety: [Rn == Pc => DECODER_ERROR, Rd == Pc => UNPREDICTABLE, msb < ls b => UNPREDICTABLE]}
185 class Binary2RegisterBitRangeMsbGeLsbTesterCase4 270 class Binary2RegisterBitRangeMsbGeLsbTesterCase4
186 : public Binary2RegisterBitRangeMsbGeLsbTesterRegsNotPc { 271 : public Binary2RegisterBitRangeMsbGeLsbTester {
187 public: 272 public:
188 Binary2RegisterBitRangeMsbGeLsbTesterCase4(const NamedClassDecoder& decoder) 273 Binary2RegisterBitRangeMsbGeLsbTesterCase4(const NamedClassDecoder& decoder)
189 : Binary2RegisterBitRangeMsbGeLsbTesterRegsNotPc(decoder) {} 274 : Binary2RegisterBitRangeMsbGeLsbTester(decoder) {}
190 virtual bool PassesParsePreconditions( 275 virtual bool PassesParsePreconditions(
191 nacl_arm_dec::Instruction inst, 276 nacl_arm_dec::Instruction inst,
192 const NamedClassDecoder& decoder); 277 const NamedClassDecoder& decoder);
278 virtual bool ApplySanityChecks(nacl_arm_dec::Instruction inst,
279 const NamedClassDecoder& decoder);
193 }; 280 };
194 281
195 bool Binary2RegisterBitRangeMsbGeLsbTesterCase4 282 bool Binary2RegisterBitRangeMsbGeLsbTesterCase4
196 ::PassesParsePreconditions( 283 ::PassesParsePreconditions(
197 nacl_arm_dec::Instruction inst, 284 nacl_arm_dec::Instruction inst,
198 const NamedClassDecoder& decoder) { 285 const NamedClassDecoder& decoder) {
199 286
200 // Check that row patterns apply to pattern being checked.' 287 // Check that row patterns apply to pattern being checked.'
201 if ((inst.Bits() & 0x01E00000) != 0x01C00000 /* op1(24:20)=~1110x */) return f alse; 288 if ((inst.Bits() & 0x01E00000) != 0x01C00000 /* op1(24:20)=~1110x */) return f alse;
202 if ((inst.Bits() & 0x00000060) != 0x00000000 /* op2(7:5)=~x00 */) return false ; 289 if ((inst.Bits() & 0x00000060) != 0x00000000 /* op2(7:5)=~x00 */) return false ;
203 if ((inst.Bits() & 0x0000000F) == 0x0000000F /* Rn(3:0)=1111 */) return false; 290 if ((inst.Bits() & 0x0000000F) == 0x0000000F /* Rn(3:0)=1111 */) return false;
204 291
205 // Check other preconditions defined for the base decoder. 292 // Check other preconditions defined for the base decoder.
206 return Binary2RegisterBitRangeMsbGeLsbTesterRegsNotPc:: 293 return Binary2RegisterBitRangeMsbGeLsbTester::
207 PassesParsePreconditions(inst, decoder); 294 PassesParsePreconditions(inst, decoder);
208 } 295 }
209 296
297 bool Binary2RegisterBitRangeMsbGeLsbTesterCase4
298 ::ApplySanityChecks(nacl_arm_dec::Instruction inst,
299 const NamedClassDecoder& decoder) {
300 NC_PRECOND(Binary2RegisterBitRangeMsbGeLsbTester::ApplySanityChecks(inst, deco der));
301
302 // safety: Rn == Pc => DECODER_ERROR
303 EXPECT_TRUE((((inst.Bits() & 0x0000000F)) != (15)));
304
305 // safety: Rd == Pc => UNPREDICTABLE
306 EXPECT_TRUE(((((inst.Bits() & 0x0000F000) >> 12)) != (15)));
307
308 // safety: msb < lsb => UNPREDICTABLE
309 EXPECT_TRUE(((((inst.Bits() & 0x001F0000) >> 16)) >= (((inst.Bits() & 0x00000F 80) >> 7))));
310
311 // defs: {Rd};
312 EXPECT_TRUE(decoder.defs(inst).IsSame(RegisterList().Add(Register(((inst.Bits( ) & 0x0000F000) >> 12)))));
313
314 return true;
315 }
316
210 // Neutral case: 317 // Neutral case:
211 // inst(24:20)=1110x & inst(7:5)=x00 & inst(3:0)=1111 318 // inst(24:20)=1110x & inst(7:5)=x00 & inst(3:0)=1111
212 // = {baseline: 'Unary1RegisterBitRangeMsbGeLsb', 319 // = {baseline: 'Unary1RegisterBitRangeMsbGeLsb',
213 // constraints: , 320 // constraints: ,
214 // safety: ["'RegsNotPc'"]} 321 // defs: {inst(15:12)},
322 // safety: ['15 == inst(15:12) => UNPREDICTABLE', 'inst(20:16) < inst(11:7 ) => UNPREDICTABLE']}
215 // 323 //
216 // Representaive case: 324 // Representaive case:
217 // op1(24:20)=1110x & op2(7:5)=x00 & Rn(3:0)=1111 325 // op1(24:20)=1110x & op2(7:5)=x00 & Rn(3:0)=1111
218 // = {baseline: Unary1RegisterBitRangeMsbGeLsb, 326 // = {Pc: 15,
327 // Rd: Rd(15:12),
328 // baseline: Unary1RegisterBitRangeMsbGeLsb,
219 // constraints: , 329 // constraints: ,
220 // safety: ['RegsNotPc']} 330 // defs: {Rd},
331 // fields: [msb(20:16), Rd(15:12), lsb(11:7)],
332 // lsb: lsb(11:7),
333 // msb: msb(20:16),
334 // safety: [Rd == Pc => UNPREDICTABLE, msb < lsb => UNPREDICTABLE]}
221 class Unary1RegisterBitRangeMsbGeLsbTesterCase5 335 class Unary1RegisterBitRangeMsbGeLsbTesterCase5
222 : public Unary1RegisterBitRangeMsbGeLsbTesterRegsNotPc { 336 : public Unary1RegisterBitRangeMsbGeLsbTester {
223 public: 337 public:
224 Unary1RegisterBitRangeMsbGeLsbTesterCase5(const NamedClassDecoder& decoder) 338 Unary1RegisterBitRangeMsbGeLsbTesterCase5(const NamedClassDecoder& decoder)
225 : Unary1RegisterBitRangeMsbGeLsbTesterRegsNotPc(decoder) {} 339 : Unary1RegisterBitRangeMsbGeLsbTester(decoder) {}
226 virtual bool PassesParsePreconditions( 340 virtual bool PassesParsePreconditions(
227 nacl_arm_dec::Instruction inst, 341 nacl_arm_dec::Instruction inst,
228 const NamedClassDecoder& decoder); 342 const NamedClassDecoder& decoder);
343 virtual bool ApplySanityChecks(nacl_arm_dec::Instruction inst,
344 const NamedClassDecoder& decoder);
229 }; 345 };
230 346
231 bool Unary1RegisterBitRangeMsbGeLsbTesterCase5 347 bool Unary1RegisterBitRangeMsbGeLsbTesterCase5
232 ::PassesParsePreconditions( 348 ::PassesParsePreconditions(
233 nacl_arm_dec::Instruction inst, 349 nacl_arm_dec::Instruction inst,
234 const NamedClassDecoder& decoder) { 350 const NamedClassDecoder& decoder) {
235 351
236 // Check that row patterns apply to pattern being checked.' 352 // Check that row patterns apply to pattern being checked.'
237 if ((inst.Bits() & 0x01E00000) != 0x01C00000 /* op1(24:20)=~1110x */) return f alse; 353 if ((inst.Bits() & 0x01E00000) != 0x01C00000 /* op1(24:20)=~1110x */) return f alse;
238 if ((inst.Bits() & 0x00000060) != 0x00000000 /* op2(7:5)=~x00 */) return false ; 354 if ((inst.Bits() & 0x00000060) != 0x00000000 /* op2(7:5)=~x00 */) return false ;
239 if ((inst.Bits() & 0x0000000F) != 0x0000000F /* Rn(3:0)=~1111 */) return false ; 355 if ((inst.Bits() & 0x0000000F) != 0x0000000F /* Rn(3:0)=~1111 */) return false ;
240 356
241 // Check other preconditions defined for the base decoder. 357 // Check other preconditions defined for the base decoder.
242 return Unary1RegisterBitRangeMsbGeLsbTesterRegsNotPc:: 358 return Unary1RegisterBitRangeMsbGeLsbTester::
243 PassesParsePreconditions(inst, decoder); 359 PassesParsePreconditions(inst, decoder);
244 } 360 }
245 361
362 bool Unary1RegisterBitRangeMsbGeLsbTesterCase5
363 ::ApplySanityChecks(nacl_arm_dec::Instruction inst,
364 const NamedClassDecoder& decoder) {
365 NC_PRECOND(Unary1RegisterBitRangeMsbGeLsbTester::ApplySanityChecks(inst, decod er));
366
367 // safety: Rd == Pc => UNPREDICTABLE
368 EXPECT_TRUE(((((inst.Bits() & 0x0000F000) >> 12)) != (15)));
369
370 // safety: msb < lsb => UNPREDICTABLE
371 EXPECT_TRUE(((((inst.Bits() & 0x001F0000) >> 16)) >= (((inst.Bits() & 0x00000F 80) >> 7))));
372
373 // defs: {Rd};
374 EXPECT_TRUE(decoder.defs(inst).IsSame(RegisterList().Add(Register(((inst.Bits( ) & 0x0000F000) >> 12)))));
375
376 return true;
377 }
378
246 // Neutral case: 379 // Neutral case:
247 // inst(24:20)=1111x & inst(7:5)=x10 380 // inst(24:20)=1111x & inst(7:5)=x10
248 // = {baseline: 'Binary2RegisterBitRangeNotRnIsPcBitfieldExtract', 381 // = {baseline: 'Unary1RegisterBitRangeMsbGeLsb',
249 // constraints: , 382 // constraints: ,
250 // safety: ["'RegsNotPc'"]} 383 // defs: {inst(15:12)},
384 // safety: ['15 == inst(15:12) => UNPREDICTABLE', 'inst(20:16) < inst(11:7 ) => UNPREDICTABLE']}
251 // 385 //
252 // Representaive case: 386 // Representaive case:
253 // op1(24:20)=1111x & op2(7:5)=x10 387 // op1(24:20)=1111x & op2(7:5)=x10
254 // = {baseline: Binary2RegisterBitRangeNotRnIsPcBitfieldExtract, 388 // = {Pc: 15,
389 // Rd: Rd(15:12),
390 // baseline: Unary1RegisterBitRangeMsbGeLsb,
255 // constraints: , 391 // constraints: ,
256 // safety: ['RegsNotPc']} 392 // defs: {Rd},
257 class Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterCase6 393 // fields: [msb(20:16), Rd(15:12), lsb(11:7)],
258 : public Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterRegsNotPc { 394 // lsb: lsb(11:7),
395 // msb: msb(20:16),
396 // safety: [Rd == Pc => UNPREDICTABLE, msb < lsb => UNPREDICTABLE]}
397 class Unary1RegisterBitRangeMsbGeLsbTesterCase6
398 : public Unary1RegisterBitRangeMsbGeLsbTester {
259 public: 399 public:
260 Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterCase6(const NamedClassDec oder& decoder) 400 Unary1RegisterBitRangeMsbGeLsbTesterCase6(const NamedClassDecoder& decoder)
261 : Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterRegsNotPc(decoder) {} 401 : Unary1RegisterBitRangeMsbGeLsbTester(decoder) {}
262 virtual bool PassesParsePreconditions( 402 virtual bool PassesParsePreconditions(
263 nacl_arm_dec::Instruction inst, 403 nacl_arm_dec::Instruction inst,
264 const NamedClassDecoder& decoder); 404 const NamedClassDecoder& decoder);
405 virtual bool ApplySanityChecks(nacl_arm_dec::Instruction inst,
406 const NamedClassDecoder& decoder);
265 }; 407 };
266 408
267 bool Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterCase6 409 bool Unary1RegisterBitRangeMsbGeLsbTesterCase6
268 ::PassesParsePreconditions( 410 ::PassesParsePreconditions(
269 nacl_arm_dec::Instruction inst, 411 nacl_arm_dec::Instruction inst,
270 const NamedClassDecoder& decoder) { 412 const NamedClassDecoder& decoder) {
271 413
272 // Check that row patterns apply to pattern being checked.' 414 // Check that row patterns apply to pattern being checked.'
273 if ((inst.Bits() & 0x01E00000) != 0x01E00000 /* op1(24:20)=~1111x */) return f alse; 415 if ((inst.Bits() & 0x01E00000) != 0x01E00000 /* op1(24:20)=~1111x */) return f alse;
274 if ((inst.Bits() & 0x00000060) != 0x00000040 /* op2(7:5)=~x10 */) return false ; 416 if ((inst.Bits() & 0x00000060) != 0x00000040 /* op2(7:5)=~x10 */) return false ;
275 417
276 // Check other preconditions defined for the base decoder. 418 // Check other preconditions defined for the base decoder.
277 return Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterRegsNotPc:: 419 return Unary1RegisterBitRangeMsbGeLsbTester::
278 PassesParsePreconditions(inst, decoder); 420 PassesParsePreconditions(inst, decoder);
279 } 421 }
280 422
423 bool Unary1RegisterBitRangeMsbGeLsbTesterCase6
424 ::ApplySanityChecks(nacl_arm_dec::Instruction inst,
425 const NamedClassDecoder& decoder) {
426 NC_PRECOND(Unary1RegisterBitRangeMsbGeLsbTester::ApplySanityChecks(inst, decod er));
427
428 // safety: Rd == Pc => UNPREDICTABLE
429 EXPECT_TRUE(((((inst.Bits() & 0x0000F000) >> 12)) != (15)));
430
431 // safety: msb < lsb => UNPREDICTABLE
432 EXPECT_TRUE(((((inst.Bits() & 0x001F0000) >> 16)) >= (((inst.Bits() & 0x00000F 80) >> 7))));
433
434 // defs: {Rd};
435 EXPECT_TRUE(decoder.defs(inst).IsSame(RegisterList().Add(Register(((inst.Bits( ) & 0x0000F000) >> 12)))));
436
437 return true;
438 }
439
281 // The following are derived class decoder testers for decoder actions 440 // The following are derived class decoder testers for decoder actions
282 // associated with a pattern of an action. These derived classes introduce 441 // associated with a pattern of an action. These derived classes introduce
283 // a default constructor that automatically initializes the expected decoder 442 // a default constructor that automatically initializes the expected decoder
284 // to the corresponding instance in the generated DecoderState. 443 // to the corresponding instance in the generated DecoderState.
285 444
286 // Neutral case: 445 // Neutral case:
287 // inst(24:20)=11000 & inst(7:5)=000 & inst(15:12)=~1111 446 // inst(24:20)=11000 & inst(7:5)=000 & inst(15:12)=~1111
288 // = {baseline: 'Binary4RegisterDualOp', 447 // = {baseline: 'Binary4RegisterDualOp',
289 // constraints: , 448 // constraints: ,
290 // rule: 'Usada8_Rule_254_A1_P502', 449 // defs: {inst(19:16)},
291 // safety: ["'RegsNotPc'"]} 450 // rule: 'USADA8',
451 // safety: ['15 == inst(15:12) => DECODER_ERROR', '15 == inst(19:16) || 15 == inst(3:0) || 15 == inst(11:8) => UNPREDICTABLE']}
292 // 452 //
293 // Representative case: 453 // Representative case:
294 // op1(24:20)=11000 & op2(7:5)=000 & Rd(15:12)=~1111 454 // op1(24:20)=11000 & op2(7:5)=000 & Rd(15:12)=~1111
295 // = {baseline: Binary4RegisterDualOp, 455 // = {Pc: 15,
456 // Ra: Ra(15:12),
457 // Rd: Rd(19:16),
458 // Rm: Rm(11:8),
459 // Rn: Rn(3:0),
460 // baseline: Binary4RegisterDualOp,
296 // constraints: , 461 // constraints: ,
297 // rule: Usada8_Rule_254_A1_P502, 462 // defs: {Rd},
298 // safety: ['RegsNotPc']} 463 // fields: [Rd(19:16), Ra(15:12), Rm(11:8), Rn(3:0)],
464 // rule: USADA8,
465 // safety: [Ra == Pc => DECODER_ERROR, Pc in {Rd,Rn,Rm} => UNPREDICTABLE]}
299 class Binary4RegisterDualOpTester_Case0 466 class Binary4RegisterDualOpTester_Case0
300 : public Binary4RegisterDualOpTesterCase0 { 467 : public Binary4RegisterDualOpTesterCase0 {
301 public: 468 public:
302 Binary4RegisterDualOpTester_Case0() 469 Binary4RegisterDualOpTester_Case0()
303 : Binary4RegisterDualOpTesterCase0( 470 : Binary4RegisterDualOpTesterCase0(
304 state_.Binary4RegisterDualOp_Usada8_Rule_254_A1_P502_instance_) 471 state_.Binary4RegisterDualOp_USADA8_instance_)
305 {} 472 {}
306 }; 473 };
307 474
308 // Neutral case: 475 // Neutral case:
309 // inst(24:20)=11000 & inst(7:5)=000 & inst(15:12)=1111 476 // inst(24:20)=11000 & inst(7:5)=000 & inst(15:12)=1111
310 // = {baseline: 'Binary3RegisterOpAltA', 477 // = {baseline: 'Binary3RegisterOpAltA',
311 // constraints: , 478 // constraints: ,
312 // rule: 'Usad8_Rule_253_A1_P500', 479 // defs: {inst(19:16)},
313 // safety: ["'RegsNotPc'"]} 480 // rule: 'USAD8',
481 // safety: ['15 == inst(19:16) || 15 == inst(3:0) || 15 == inst(11:8) => U NPREDICTABLE']}
314 // 482 //
315 // Representative case: 483 // Representative case:
316 // op1(24:20)=11000 & op2(7:5)=000 & Rd(15:12)=1111 484 // op1(24:20)=11000 & op2(7:5)=000 & Rd(15:12)=1111
317 // = {baseline: Binary3RegisterOpAltA, 485 // = {Pc: 15,
486 // Rd: Rd(19:16),
487 // Rm: Rm(11:8),
488 // Rn: Rn(3:0),
489 // baseline: Binary3RegisterOpAltA,
318 // constraints: , 490 // constraints: ,
319 // rule: Usad8_Rule_253_A1_P500, 491 // defs: {Rd},
320 // safety: ['RegsNotPc']} 492 // fields: [Rd(19:16), Rm(11:8), Rn(3:0)],
493 // rule: USAD8,
494 // safety: [Pc in {Rd,Rn,Rm} => UNPREDICTABLE]}
321 class Binary3RegisterOpAltATester_Case1 495 class Binary3RegisterOpAltATester_Case1
322 : public Binary3RegisterOpAltATesterCase1 { 496 : public Binary3RegisterOpAltATesterCase1 {
323 public: 497 public:
324 Binary3RegisterOpAltATester_Case1() 498 Binary3RegisterOpAltATester_Case1()
325 : Binary3RegisterOpAltATesterCase1( 499 : Binary3RegisterOpAltATesterCase1(
326 state_.Binary3RegisterOpAltA_Usad8_Rule_253_A1_P500_instance_) 500 state_.Binary3RegisterOpAltA_USAD8_instance_)
327 {} 501 {}
328 }; 502 };
329 503
330 // Neutral case: 504 // Neutral case:
331 // inst(24:20)=11111 & inst(7:5)=111 505 // inst(24:20)=11111 & inst(7:5)=111
332 // = {baseline: 'PermanentlyUndefined', 506 // = {baseline: 'PermanentlyUndefined',
333 // constraints: , 507 // constraints: ,
334 // rule: 'Udf_Rule_A1'} 508 // rule: 'UDF'}
335 // 509 //
336 // Representative case: 510 // Representative case:
337 // op1(24:20)=11111 & op2(7:5)=111 511 // op1(24:20)=11111 & op2(7:5)=111
338 // = {baseline: PermanentlyUndefined, 512 // = {baseline: PermanentlyUndefined,
339 // constraints: , 513 // constraints: ,
340 // rule: Udf_Rule_A1} 514 // rule: UDF}
341 class PermanentlyUndefinedTester_Case2 515 class PermanentlyUndefinedTester_Case2
342 : public PermanentlyUndefinedTesterCase2 { 516 : public PermanentlyUndefinedTesterCase2 {
343 public: 517 public:
344 PermanentlyUndefinedTester_Case2() 518 PermanentlyUndefinedTester_Case2()
345 : PermanentlyUndefinedTesterCase2( 519 : PermanentlyUndefinedTesterCase2(
346 state_.PermanentlyUndefined_Udf_Rule_A1_instance_) 520 state_.PermanentlyUndefined_UDF_instance_)
347 {} 521 {}
348 }; 522 };
349 523
350 // Neutral case: 524 // Neutral case:
351 // inst(24:20)=1101x & inst(7:5)=x10 525 // inst(24:20)=1101x & inst(7:5)=x10
352 // = {baseline: 'Binary2RegisterBitRangeNotRnIsPcBitfieldExtract', 526 // = {baseline: 'Binary2RegisterBitRangeNotRnIsPcBitfieldExtract',
353 // constraints: , 527 // constraints: ,
354 // rule: 'Sbfx_Rule_154_A1_P308', 528 // defs: {inst(15:12)},
355 // safety: ["'RegsNotPc'"]} 529 // rule: 'SBFX',
530 // safety: ['15 == inst(15:12) || 15 == inst(3:0) => UNPREDICTABLE', '31 < = inst(11:7) + inst(20:16) => UNPREDICTABLE']}
356 // 531 //
357 // Representative case: 532 // Representative case:
358 // op1(24:20)=1101x & op2(7:5)=x10 533 // op1(24:20)=1101x & op2(7:5)=x10
359 // = {baseline: Binary2RegisterBitRangeNotRnIsPcBitfieldExtract, 534 // = {Pc: 15,
535 // Rd: Rd(15:12),
536 // Rn: Rn(3:0),
537 // baseline: Binary2RegisterBitRangeNotRnIsPcBitfieldExtract,
360 // constraints: , 538 // constraints: ,
361 // rule: Sbfx_Rule_154_A1_P308, 539 // defs: {Rd},
362 // safety: ['RegsNotPc']} 540 // fields: [widthm1(20:16), Rd(15:12), lsb(11:7), Rn(3:0)],
541 // lsb: lsb(11:7),
542 // rule: SBFX,
543 // safety: [Pc in {Rd,Rn} => UNPREDICTABLE, lsb + widthm1 > 31 => UNPREDIC TABLE],
544 // widthm1: widthm1(20:16)}
363 class Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester_Case3 545 class Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester_Case3
364 : public Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterCase3 { 546 : public Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterCase3 {
365 public: 547 public:
366 Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester_Case3() 548 Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester_Case3()
367 : Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterCase3( 549 : Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterCase3(
368 state_.Binary2RegisterBitRangeNotRnIsPcBitfieldExtract_Sbfx_Rule_154_A1_P3 08_instance_) 550 state_.Binary2RegisterBitRangeNotRnIsPcBitfieldExtract_SBFX_instance_)
369 {} 551 {}
370 }; 552 };
371 553
372 // Neutral case: 554 // Neutral case:
373 // inst(24:20)=1110x & inst(7:5)=x00 & inst(3:0)=~1111 555 // inst(24:20)=1110x & inst(7:5)=x00 & inst(3:0)=~1111
374 // = {baseline: 'Binary2RegisterBitRangeMsbGeLsb', 556 // = {baseline: 'Binary2RegisterBitRangeMsbGeLsb',
375 // constraints: , 557 // constraints: ,
376 // rule: 'Bfi_Rule_18_A1_P48', 558 // defs: {inst(15:12)},
377 // safety: ["'RegsNotPc'"]} 559 // rule: 'BFI',
560 // safety: ['15 == inst(3:0) => DECODER_ERROR', '15 == inst(15:12) => UNPR EDICTABLE', 'inst(20:16) < inst(11:7) => UNPREDICTABLE']}
378 // 561 //
379 // Representative case: 562 // Representative case:
380 // op1(24:20)=1110x & op2(7:5)=x00 & Rn(3:0)=~1111 563 // op1(24:20)=1110x & op2(7:5)=x00 & Rn(3:0)=~1111
381 // = {baseline: Binary2RegisterBitRangeMsbGeLsb, 564 // = {Pc: 15,
565 // Rd: Rd(15:12),
566 // Rn: Rn(3:0),
567 // baseline: Binary2RegisterBitRangeMsbGeLsb,
382 // constraints: , 568 // constraints: ,
383 // rule: Bfi_Rule_18_A1_P48, 569 // defs: {Rd},
384 // safety: ['RegsNotPc']} 570 // fields: [msb(20:16), Rd(15:12), lsb(11:7), Rn(3:0)],
571 // lsb: lsb(11:7),
572 // msb: msb(20:16),
573 // rule: BFI,
574 // safety: [Rn == Pc => DECODER_ERROR, Rd == Pc => UNPREDICTABLE, msb < ls b => UNPREDICTABLE]}
385 class Binary2RegisterBitRangeMsbGeLsbTester_Case4 575 class Binary2RegisterBitRangeMsbGeLsbTester_Case4
386 : public Binary2RegisterBitRangeMsbGeLsbTesterCase4 { 576 : public Binary2RegisterBitRangeMsbGeLsbTesterCase4 {
387 public: 577 public:
388 Binary2RegisterBitRangeMsbGeLsbTester_Case4() 578 Binary2RegisterBitRangeMsbGeLsbTester_Case4()
389 : Binary2RegisterBitRangeMsbGeLsbTesterCase4( 579 : Binary2RegisterBitRangeMsbGeLsbTesterCase4(
390 state_.Binary2RegisterBitRangeMsbGeLsb_Bfi_Rule_18_A1_P48_instance_) 580 state_.Binary2RegisterBitRangeMsbGeLsb_BFI_instance_)
391 {} 581 {}
392 }; 582 };
393 583
394 // Neutral case: 584 // Neutral case:
395 // inst(24:20)=1110x & inst(7:5)=x00 & inst(3:0)=1111 585 // inst(24:20)=1110x & inst(7:5)=x00 & inst(3:0)=1111
396 // = {baseline: 'Unary1RegisterBitRangeMsbGeLsb', 586 // = {baseline: 'Unary1RegisterBitRangeMsbGeLsb',
397 // constraints: , 587 // constraints: ,
398 // rule: 'Bfc_17_A1_P46', 588 // defs: {inst(15:12)},
399 // safety: ["'RegsNotPc'"]} 589 // rule: 'BFC',
590 // safety: ['15 == inst(15:12) => UNPREDICTABLE', 'inst(20:16) < inst(11:7 ) => UNPREDICTABLE']}
400 // 591 //
401 // Representative case: 592 // Representative case:
402 // op1(24:20)=1110x & op2(7:5)=x00 & Rn(3:0)=1111 593 // op1(24:20)=1110x & op2(7:5)=x00 & Rn(3:0)=1111
403 // = {baseline: Unary1RegisterBitRangeMsbGeLsb, 594 // = {Pc: 15,
595 // Rd: Rd(15:12),
596 // baseline: Unary1RegisterBitRangeMsbGeLsb,
404 // constraints: , 597 // constraints: ,
405 // rule: Bfc_17_A1_P46, 598 // defs: {Rd},
406 // safety: ['RegsNotPc']} 599 // fields: [msb(20:16), Rd(15:12), lsb(11:7)],
600 // lsb: lsb(11:7),
601 // msb: msb(20:16),
602 // rule: BFC,
603 // safety: [Rd == Pc => UNPREDICTABLE, msb < lsb => UNPREDICTABLE]}
407 class Unary1RegisterBitRangeMsbGeLsbTester_Case5 604 class Unary1RegisterBitRangeMsbGeLsbTester_Case5
408 : public Unary1RegisterBitRangeMsbGeLsbTesterCase5 { 605 : public Unary1RegisterBitRangeMsbGeLsbTesterCase5 {
409 public: 606 public:
410 Unary1RegisterBitRangeMsbGeLsbTester_Case5() 607 Unary1RegisterBitRangeMsbGeLsbTester_Case5()
411 : Unary1RegisterBitRangeMsbGeLsbTesterCase5( 608 : Unary1RegisterBitRangeMsbGeLsbTesterCase5(
412 state_.Unary1RegisterBitRangeMsbGeLsb_Bfc_17_A1_P46_instance_) 609 state_.Unary1RegisterBitRangeMsbGeLsb_BFC_instance_)
413 {} 610 {}
414 }; 611 };
415 612
416 // Neutral case: 613 // Neutral case:
417 // inst(24:20)=1111x & inst(7:5)=x10 614 // inst(24:20)=1111x & inst(7:5)=x10
418 // = {baseline: 'Binary2RegisterBitRangeNotRnIsPcBitfieldExtract', 615 // = {baseline: 'Unary1RegisterBitRangeMsbGeLsb',
419 // constraints: , 616 // constraints: ,
420 // rule: 'Ubfx_Rule_236_A1_P466', 617 // defs: {inst(15:12)},
421 // safety: ["'RegsNotPc'"]} 618 // rule: 'UBFX',
619 // safety: ['15 == inst(15:12) => UNPREDICTABLE', 'inst(20:16) < inst(11:7 ) => UNPREDICTABLE']}
422 // 620 //
423 // Representative case: 621 // Representative case:
424 // op1(24:20)=1111x & op2(7:5)=x10 622 // op1(24:20)=1111x & op2(7:5)=x10
425 // = {baseline: Binary2RegisterBitRangeNotRnIsPcBitfieldExtract, 623 // = {Pc: 15,
624 // Rd: Rd(15:12),
625 // baseline: Unary1RegisterBitRangeMsbGeLsb,
426 // constraints: , 626 // constraints: ,
427 // rule: Ubfx_Rule_236_A1_P466, 627 // defs: {Rd},
428 // safety: ['RegsNotPc']} 628 // fields: [msb(20:16), Rd(15:12), lsb(11:7)],
429 class Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester_Case6 629 // lsb: lsb(11:7),
430 : public Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterCase6 { 630 // msb: msb(20:16),
631 // rule: UBFX,
632 // safety: [Rd == Pc => UNPREDICTABLE, msb < lsb => UNPREDICTABLE]}
633 class Unary1RegisterBitRangeMsbGeLsbTester_Case6
634 : public Unary1RegisterBitRangeMsbGeLsbTesterCase6 {
431 public: 635 public:
432 Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester_Case6() 636 Unary1RegisterBitRangeMsbGeLsbTester_Case6()
433 : Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTesterCase6( 637 : Unary1RegisterBitRangeMsbGeLsbTesterCase6(
434 state_.Binary2RegisterBitRangeNotRnIsPcBitfieldExtract_Ubfx_Rule_236_A1_P4 66_instance_) 638 state_.Unary1RegisterBitRangeMsbGeLsb_UBFX_instance_)
435 {} 639 {}
436 }; 640 };
437 641
438 // Defines a gtest testing harness for tests. 642 // Defines a gtest testing harness for tests.
439 class Arm32DecoderStateTests : public ::testing::Test { 643 class Arm32DecoderStateTests : public ::testing::Test {
440 protected: 644 protected:
441 Arm32DecoderStateTests() {} 645 Arm32DecoderStateTests() {}
442 }; 646 };
443 647
444 // The following functions test each pattern specified in parse 648 // The following functions test each pattern specified in parse
445 // decoder tables. 649 // decoder tables.
446 650
447 // Neutral case: 651 // Neutral case:
448 // inst(24:20)=11000 & inst(7:5)=000 & inst(15:12)=~1111 652 // inst(24:20)=11000 & inst(7:5)=000 & inst(15:12)=~1111
449 // = {actual: 'Defs16To19CondsDontCareRdRaRmRnNotPc', 653 // = {actual: 'Binary4RegisterDualOp',
450 // baseline: 'Binary4RegisterDualOp', 654 // baseline: 'Binary4RegisterDualOp',
451 // constraints: , 655 // constraints: ,
656 // defs: {inst(19:16)},
452 // pattern: 'cccc01111000ddddaaaammmm0001nnnn', 657 // pattern: 'cccc01111000ddddaaaammmm0001nnnn',
453 // rule: 'Usada8_Rule_254_A1_P502', 658 // rule: 'USADA8',
454 // safety: ["'RegsNotPc'"]} 659 // safety: ['15 == inst(15:12) => DECODER_ERROR', '15 == inst(19:16) || 15 == inst(3:0) || 15 == inst(11:8) => UNPREDICTABLE']}
455 // 660 //
456 // Representative case: 661 // Representaive case:
457 // op1(24:20)=11000 & op2(7:5)=000 & Rd(15:12)=~1111 662 // op1(24:20)=11000 & op2(7:5)=000 & Rd(15:12)=~1111
458 // = {actual: Defs16To19CondsDontCareRdRaRmRnNotPc, 663 // = {Pc: 15,
664 // Ra: Ra(15:12),
665 // Rd: Rd(19:16),
666 // Rm: Rm(11:8),
667 // Rn: Rn(3:0),
668 // actual: Binary4RegisterDualOp,
459 // baseline: Binary4RegisterDualOp, 669 // baseline: Binary4RegisterDualOp,
460 // constraints: , 670 // constraints: ,
671 // defs: {Rd},
672 // fields: [Rd(19:16), Ra(15:12), Rm(11:8), Rn(3:0)],
461 // pattern: cccc01111000ddddaaaammmm0001nnnn, 673 // pattern: cccc01111000ddddaaaammmm0001nnnn,
462 // rule: Usada8_Rule_254_A1_P502, 674 // rule: USADA8,
463 // safety: ['RegsNotPc']} 675 // safety: [Ra == Pc => DECODER_ERROR, Pc in {Rd,Rn,Rm} => UNPREDICTABLE]}
464 TEST_F(Arm32DecoderStateTests, 676 TEST_F(Arm32DecoderStateTests,
465 Binary4RegisterDualOpTester_Case0_TestCase0) { 677 Binary4RegisterDualOpTester_Case0_TestCase0) {
466 Binary4RegisterDualOpTester_Case0 baseline_tester; 678 Binary4RegisterDualOpTester_Case0 tester;
467 NamedDefs16To19CondsDontCareRdRaRmRnNotPc_Usada8_Rule_254_A1_P502 actual; 679 tester.Test("cccc01111000ddddaaaammmm0001nnnn");
468 ActualVsBaselineTester a_vs_b_tester(actual, baseline_tester);
469 a_vs_b_tester.Test("cccc01111000ddddaaaammmm0001nnnn");
470 } 680 }
471 681
472 // Neutral case: 682 // Neutral case:
473 // inst(24:20)=11000 & inst(7:5)=000 & inst(15:12)=1111 683 // inst(24:20)=11000 & inst(7:5)=000 & inst(15:12)=1111
474 // = {actual: 'Defs16To19CondsDontCareRdRmRnNotPc', 684 // = {actual: 'Binary3RegisterOpAltA',
475 // baseline: 'Binary3RegisterOpAltA', 685 // baseline: 'Binary3RegisterOpAltA',
476 // constraints: , 686 // constraints: ,
687 // defs: {inst(19:16)},
477 // pattern: 'cccc01111000dddd1111mmmm0001nnnn', 688 // pattern: 'cccc01111000dddd1111mmmm0001nnnn',
478 // rule: 'Usad8_Rule_253_A1_P500', 689 // rule: 'USAD8',
479 // safety: ["'RegsNotPc'"]} 690 // safety: ['15 == inst(19:16) || 15 == inst(3:0) || 15 == inst(11:8) => U NPREDICTABLE']}
480 // 691 //
481 // Representative case: 692 // Representaive case:
482 // op1(24:20)=11000 & op2(7:5)=000 & Rd(15:12)=1111 693 // op1(24:20)=11000 & op2(7:5)=000 & Rd(15:12)=1111
483 // = {actual: Defs16To19CondsDontCareRdRmRnNotPc, 694 // = {Pc: 15,
695 // Rd: Rd(19:16),
696 // Rm: Rm(11:8),
697 // Rn: Rn(3:0),
698 // actual: Binary3RegisterOpAltA,
484 // baseline: Binary3RegisterOpAltA, 699 // baseline: Binary3RegisterOpAltA,
485 // constraints: , 700 // constraints: ,
701 // defs: {Rd},
702 // fields: [Rd(19:16), Rm(11:8), Rn(3:0)],
486 // pattern: cccc01111000dddd1111mmmm0001nnnn, 703 // pattern: cccc01111000dddd1111mmmm0001nnnn,
487 // rule: Usad8_Rule_253_A1_P500, 704 // rule: USAD8,
488 // safety: ['RegsNotPc']} 705 // safety: [Pc in {Rd,Rn,Rm} => UNPREDICTABLE]}
489 TEST_F(Arm32DecoderStateTests, 706 TEST_F(Arm32DecoderStateTests,
490 Binary3RegisterOpAltATester_Case1_TestCase1) { 707 Binary3RegisterOpAltATester_Case1_TestCase1) {
491 Binary3RegisterOpAltATester_Case1 baseline_tester; 708 Binary3RegisterOpAltATester_Case1 tester;
492 NamedDefs16To19CondsDontCareRdRmRnNotPc_Usad8_Rule_253_A1_P500 actual; 709 tester.Test("cccc01111000dddd1111mmmm0001nnnn");
493 ActualVsBaselineTester a_vs_b_tester(actual, baseline_tester);
494 a_vs_b_tester.Test("cccc01111000dddd1111mmmm0001nnnn");
495 } 710 }
496 711
497 // Neutral case: 712 // Neutral case:
498 // inst(24:20)=11111 & inst(7:5)=111 713 // inst(24:20)=11111 & inst(7:5)=111
499 // = {actual: 'PermanentlyUndefined', 714 // = {actual: 'PermanentlyUndefined',
500 // baseline: 'PermanentlyUndefined', 715 // baseline: 'PermanentlyUndefined',
501 // constraints: , 716 // constraints: ,
502 // pattern: 'cccc01111111iiiiiiiiiiii1111iiii', 717 // pattern: 'cccc01111111iiiiiiiiiiii1111iiii',
503 // rule: 'Udf_Rule_A1'} 718 // rule: 'UDF'}
504 // 719 //
505 // Representaive case: 720 // Representaive case:
506 // op1(24:20)=11111 & op2(7:5)=111 721 // op1(24:20)=11111 & op2(7:5)=111
507 // = {actual: PermanentlyUndefined, 722 // = {actual: PermanentlyUndefined,
508 // baseline: PermanentlyUndefined, 723 // baseline: PermanentlyUndefined,
509 // constraints: , 724 // constraints: ,
510 // pattern: cccc01111111iiiiiiiiiiii1111iiii, 725 // pattern: cccc01111111iiiiiiiiiiii1111iiii,
511 // rule: Udf_Rule_A1} 726 // rule: UDF}
512 TEST_F(Arm32DecoderStateTests, 727 TEST_F(Arm32DecoderStateTests,
513 PermanentlyUndefinedTester_Case2_TestCase2) { 728 PermanentlyUndefinedTester_Case2_TestCase2) {
514 PermanentlyUndefinedTester_Case2 tester; 729 PermanentlyUndefinedTester_Case2 tester;
515 tester.Test("cccc01111111iiiiiiiiiiii1111iiii"); 730 tester.Test("cccc01111111iiiiiiiiiiii1111iiii");
516 } 731 }
517 732
518 // Neutral case: 733 // Neutral case:
519 // inst(24:20)=1101x & inst(7:5)=x10 734 // inst(24:20)=1101x & inst(7:5)=x10
520 // = {actual: 'Defs12To15CondsDontCareRdRnNotPcBitfieldExtract', 735 // = {actual: 'Binary2RegisterBitRangeNotRnIsPcBitfieldExtract',
521 // baseline: 'Binary2RegisterBitRangeNotRnIsPcBitfieldExtract', 736 // baseline: 'Binary2RegisterBitRangeNotRnIsPcBitfieldExtract',
522 // constraints: , 737 // constraints: ,
738 // defs: {inst(15:12)},
523 // pattern: 'cccc0111101wwwwwddddlllll101nnnn', 739 // pattern: 'cccc0111101wwwwwddddlllll101nnnn',
524 // rule: 'Sbfx_Rule_154_A1_P308', 740 // rule: 'SBFX',
525 // safety: ["'RegsNotPc'"]} 741 // safety: ['15 == inst(15:12) || 15 == inst(3:0) => UNPREDICTABLE', '31 < = inst(11:7) + inst(20:16) => UNPREDICTABLE']}
526 // 742 //
527 // Representative case: 743 // Representaive case:
528 // op1(24:20)=1101x & op2(7:5)=x10 744 // op1(24:20)=1101x & op2(7:5)=x10
529 // = {actual: Defs12To15CondsDontCareRdRnNotPcBitfieldExtract, 745 // = {Pc: 15,
746 // Rd: Rd(15:12),
747 // Rn: Rn(3:0),
748 // actual: Binary2RegisterBitRangeNotRnIsPcBitfieldExtract,
530 // baseline: Binary2RegisterBitRangeNotRnIsPcBitfieldExtract, 749 // baseline: Binary2RegisterBitRangeNotRnIsPcBitfieldExtract,
531 // constraints: , 750 // constraints: ,
751 // defs: {Rd},
752 // fields: [widthm1(20:16), Rd(15:12), lsb(11:7), Rn(3:0)],
753 // lsb: lsb(11:7),
532 // pattern: cccc0111101wwwwwddddlllll101nnnn, 754 // pattern: cccc0111101wwwwwddddlllll101nnnn,
533 // rule: Sbfx_Rule_154_A1_P308, 755 // rule: SBFX,
534 // safety: ['RegsNotPc']} 756 // safety: [Pc in {Rd,Rn} => UNPREDICTABLE, lsb + widthm1 > 31 => UNPREDIC TABLE],
757 // widthm1: widthm1(20:16)}
535 TEST_F(Arm32DecoderStateTests, 758 TEST_F(Arm32DecoderStateTests,
536 Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester_Case3_TestCase3) { 759 Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester_Case3_TestCase3) {
537 Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester_Case3 baseline_tester; 760 Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester_Case3 tester;
538 NamedDefs12To15CondsDontCareRdRnNotPcBitfieldExtract_Sbfx_Rule_154_A1_P308 act ual; 761 tester.Test("cccc0111101wwwwwddddlllll101nnnn");
539 ActualVsBaselineTester a_vs_b_tester(actual, baseline_tester);
540 a_vs_b_tester.Test("cccc0111101wwwwwddddlllll101nnnn");
541 } 762 }
542 763
543 // Neutral case: 764 // Neutral case:
544 // inst(24:20)=1110x & inst(7:5)=x00 & inst(3:0)=~1111 765 // inst(24:20)=1110x & inst(7:5)=x00 & inst(3:0)=~1111
545 // = {actual: 'Defs12To15CondsDontCareMsbGeLsb', 766 // = {actual: 'Binary2RegisterBitRangeMsbGeLsb',
546 // baseline: 'Binary2RegisterBitRangeMsbGeLsb', 767 // baseline: 'Binary2RegisterBitRangeMsbGeLsb',
547 // constraints: , 768 // constraints: ,
769 // defs: {inst(15:12)},
548 // pattern: 'cccc0111110mmmmmddddlllll001nnnn', 770 // pattern: 'cccc0111110mmmmmddddlllll001nnnn',
549 // rule: 'Bfi_Rule_18_A1_P48', 771 // rule: 'BFI',
550 // safety: ["'RegsNotPc'"]} 772 // safety: ['15 == inst(3:0) => DECODER_ERROR', '15 == inst(15:12) => UNPR EDICTABLE', 'inst(20:16) < inst(11:7) => UNPREDICTABLE']}
551 // 773 //
552 // Representative case: 774 // Representaive case:
553 // op1(24:20)=1110x & op2(7:5)=x00 & Rn(3:0)=~1111 775 // op1(24:20)=1110x & op2(7:5)=x00 & Rn(3:0)=~1111
554 // = {actual: Defs12To15CondsDontCareMsbGeLsb, 776 // = {Pc: 15,
777 // Rd: Rd(15:12),
778 // Rn: Rn(3:0),
779 // actual: Binary2RegisterBitRangeMsbGeLsb,
555 // baseline: Binary2RegisterBitRangeMsbGeLsb, 780 // baseline: Binary2RegisterBitRangeMsbGeLsb,
556 // constraints: , 781 // constraints: ,
782 // defs: {Rd},
783 // fields: [msb(20:16), Rd(15:12), lsb(11:7), Rn(3:0)],
784 // lsb: lsb(11:7),
785 // msb: msb(20:16),
557 // pattern: cccc0111110mmmmmddddlllll001nnnn, 786 // pattern: cccc0111110mmmmmddddlllll001nnnn,
558 // rule: Bfi_Rule_18_A1_P48, 787 // rule: BFI,
559 // safety: ['RegsNotPc']} 788 // safety: [Rn == Pc => DECODER_ERROR, Rd == Pc => UNPREDICTABLE, msb < ls b => UNPREDICTABLE]}
560 TEST_F(Arm32DecoderStateTests, 789 TEST_F(Arm32DecoderStateTests,
561 Binary2RegisterBitRangeMsbGeLsbTester_Case4_TestCase4) { 790 Binary2RegisterBitRangeMsbGeLsbTester_Case4_TestCase4) {
562 Binary2RegisterBitRangeMsbGeLsbTester_Case4 baseline_tester; 791 Binary2RegisterBitRangeMsbGeLsbTester_Case4 tester;
563 NamedDefs12To15CondsDontCareMsbGeLsb_Bfi_Rule_18_A1_P48 actual; 792 tester.Test("cccc0111110mmmmmddddlllll001nnnn");
564 ActualVsBaselineTester a_vs_b_tester(actual, baseline_tester);
565 a_vs_b_tester.Test("cccc0111110mmmmmddddlllll001nnnn");
566 } 793 }
567 794
568 // Neutral case: 795 // Neutral case:
569 // inst(24:20)=1110x & inst(7:5)=x00 & inst(3:0)=1111 796 // inst(24:20)=1110x & inst(7:5)=x00 & inst(3:0)=1111
570 // = {actual: 'Unary1RegisterBitRangeMsbGeLsb', 797 // = {actual: 'Unary1RegisterBitRangeMsbGeLsb',
571 // baseline: 'Unary1RegisterBitRangeMsbGeLsb', 798 // baseline: 'Unary1RegisterBitRangeMsbGeLsb',
572 // constraints: , 799 // constraints: ,
800 // defs: {inst(15:12)},
573 // pattern: 'cccc0111110mmmmmddddlllll0011111', 801 // pattern: 'cccc0111110mmmmmddddlllll0011111',
574 // rule: 'Bfc_17_A1_P46', 802 // rule: 'BFC',
575 // safety: ["'RegsNotPc'"]} 803 // safety: ['15 == inst(15:12) => UNPREDICTABLE', 'inst(20:16) < inst(11:7 ) => UNPREDICTABLE']}
576 // 804 //
577 // Representaive case: 805 // Representaive case:
578 // op1(24:20)=1110x & op2(7:5)=x00 & Rn(3:0)=1111 806 // op1(24:20)=1110x & op2(7:5)=x00 & Rn(3:0)=1111
579 // = {actual: Unary1RegisterBitRangeMsbGeLsb, 807 // = {Pc: 15,
808 // Rd: Rd(15:12),
809 // actual: Unary1RegisterBitRangeMsbGeLsb,
580 // baseline: Unary1RegisterBitRangeMsbGeLsb, 810 // baseline: Unary1RegisterBitRangeMsbGeLsb,
581 // constraints: , 811 // constraints: ,
812 // defs: {Rd},
813 // fields: [msb(20:16), Rd(15:12), lsb(11:7)],
814 // lsb: lsb(11:7),
815 // msb: msb(20:16),
582 // pattern: cccc0111110mmmmmddddlllll0011111, 816 // pattern: cccc0111110mmmmmddddlllll0011111,
583 // rule: Bfc_17_A1_P46, 817 // rule: BFC,
584 // safety: ['RegsNotPc']} 818 // safety: [Rd == Pc => UNPREDICTABLE, msb < lsb => UNPREDICTABLE]}
585 TEST_F(Arm32DecoderStateTests, 819 TEST_F(Arm32DecoderStateTests,
586 Unary1RegisterBitRangeMsbGeLsbTester_Case5_TestCase5) { 820 Unary1RegisterBitRangeMsbGeLsbTester_Case5_TestCase5) {
587 Unary1RegisterBitRangeMsbGeLsbTester_Case5 tester; 821 Unary1RegisterBitRangeMsbGeLsbTester_Case5 tester;
588 tester.Test("cccc0111110mmmmmddddlllll0011111"); 822 tester.Test("cccc0111110mmmmmddddlllll0011111");
589 } 823 }
590 824
591 // Neutral case: 825 // Neutral case:
592 // inst(24:20)=1111x & inst(7:5)=x10 826 // inst(24:20)=1111x & inst(7:5)=x10
593 // = {actual: 'Defs12To15CondsDontCareRdRnNotPcBitfieldExtract', 827 // = {actual: 'Unary1RegisterBitRangeMsbGeLsb',
594 // baseline: 'Binary2RegisterBitRangeNotRnIsPcBitfieldExtract', 828 // baseline: 'Unary1RegisterBitRangeMsbGeLsb',
595 // constraints: , 829 // constraints: ,
830 // defs: {inst(15:12)},
596 // pattern: 'cccc0111111mmmmmddddlllll101nnnn', 831 // pattern: 'cccc0111111mmmmmddddlllll101nnnn',
597 // rule: 'Ubfx_Rule_236_A1_P466', 832 // rule: 'UBFX',
598 // safety: ["'RegsNotPc'"]} 833 // safety: ['15 == inst(15:12) => UNPREDICTABLE', 'inst(20:16) < inst(11:7 ) => UNPREDICTABLE']}
599 // 834 //
600 // Representative case: 835 // Representaive case:
601 // op1(24:20)=1111x & op2(7:5)=x10 836 // op1(24:20)=1111x & op2(7:5)=x10
602 // = {actual: Defs12To15CondsDontCareRdRnNotPcBitfieldExtract, 837 // = {Pc: 15,
603 // baseline: Binary2RegisterBitRangeNotRnIsPcBitfieldExtract, 838 // Rd: Rd(15:12),
839 // actual: Unary1RegisterBitRangeMsbGeLsb,
840 // baseline: Unary1RegisterBitRangeMsbGeLsb,
604 // constraints: , 841 // constraints: ,
842 // defs: {Rd},
843 // fields: [msb(20:16), Rd(15:12), lsb(11:7)],
844 // lsb: lsb(11:7),
845 // msb: msb(20:16),
605 // pattern: cccc0111111mmmmmddddlllll101nnnn, 846 // pattern: cccc0111111mmmmmddddlllll101nnnn,
606 // rule: Ubfx_Rule_236_A1_P466, 847 // rule: UBFX,
607 // safety: ['RegsNotPc']} 848 // safety: [Rd == Pc => UNPREDICTABLE, msb < lsb => UNPREDICTABLE]}
608 TEST_F(Arm32DecoderStateTests, 849 TEST_F(Arm32DecoderStateTests,
609 Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester_Case6_TestCase6) { 850 Unary1RegisterBitRangeMsbGeLsbTester_Case6_TestCase6) {
610 Binary2RegisterBitRangeNotRnIsPcBitfieldExtractTester_Case6 baseline_tester; 851 Unary1RegisterBitRangeMsbGeLsbTester_Case6 tester;
611 NamedDefs12To15CondsDontCareRdRnNotPcBitfieldExtract_Ubfx_Rule_236_A1_P466 act ual; 852 tester.Test("cccc0111111mmmmmddddlllll101nnnn");
612 ActualVsBaselineTester a_vs_b_tester(actual, baseline_tester);
613 a_vs_b_tester.Test("cccc0111111mmmmmddddlllll101nnnn");
614 } 853 }
615 854
616 } // namespace nacl_arm_test 855 } // namespace nacl_arm_test
617 856
618 int main(int argc, char* argv[]) { 857 int main(int argc, char* argv[]) {
619 testing::InitGoogleTest(&argc, argv); 858 testing::InitGoogleTest(&argc, argv);
620 return RUN_ALL_TESTS(); 859 return RUN_ALL_TESTS();
621 } 860 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698