Mercurial > hg > CbC > CbC_llvm
comparison llvm/test/TableGen/BitOffsetDecoder.td @ 207:2e18cbf3894f
LLVM12
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 08 Jun 2021 06:07:14 +0900 |
parents | 1d019706d866 |
children |
comparison
equal
deleted
inserted
replaced
173:0572611fdcc8 | 207:2e18cbf3894f |
---|---|
17 | 17 |
18 def foo : Instruction { | 18 def foo : Instruction { |
19 let InOperandList = (ins i32imm:$factor); | 19 let InOperandList = (ins i32imm:$factor); |
20 field bits<16> Inst; | 20 field bits<16> Inst; |
21 bits<32> factor; | 21 bits<32> factor; |
22 let Inst{7-0} = 0xAA; | 22 let Inst{7...0} = 0xAA; |
23 let Inst{14-8} = factor{6-0}; // no offset | 23 let Inst{14...8} = factor{6...0}; // no offset |
24 let AsmString = "foo $factor"; | 24 let AsmString = "foo $factor"; |
25 field bits<16> SoftFail = 0; | 25 field bits<16> SoftFail = 0; |
26 } | 26 } |
27 | 27 |
28 def bar : Instruction { | 28 def bar : Instruction { |
29 let InOperandList = (ins i32imm:$factor); | 29 let InOperandList = (ins i32imm:$factor); |
30 field bits<16> Inst; | 30 field bits<16> Inst; |
31 bits<32> factor; | 31 bits<32> factor; |
32 let Inst{7-0} = 0xBB; | 32 let Inst{7...0} = 0xBB; |
33 let Inst{15-8} = factor{10-3}; // offset by 3 | 33 let Inst{15...8} = factor{10...3}; // offset by 3 |
34 let AsmString = "bar $factor"; | 34 let AsmString = "bar $factor"; |
35 field bits<16> SoftFail = 0; | 35 field bits<16> SoftFail = 0; |
36 } | 36 } |
37 | 37 |
38 def biz : Instruction { | 38 def biz : Instruction { |
39 let InOperandList = (ins i32imm:$factor); | 39 let InOperandList = (ins i32imm:$factor); |
40 field bits<16> Inst; | 40 field bits<16> Inst; |
41 bits<32> factor; | 41 bits<32> factor; |
42 let Inst{7-0} = 0xCC; | 42 let Inst{7...0} = 0xCC; |
43 let Inst{11-8,15-12} = factor{10-3}; // offset by 3, multipart | 43 let Inst{11...8,15...12} = factor{10...3}; // offset by 3, multipart |
44 let AsmString = "biz $factor"; | 44 let AsmString = "biz $factor"; |
45 field bits<16> SoftFail = 0; | 45 field bits<16> SoftFail = 0; |
46 } | 46 } |
47 | 47 |
48 def baz : Instruction { | 48 def baz : Instruction { |
49 let InOperandList = (ins Myi32:$factor); | 49 let InOperandList = (ins Myi32:$factor); |
50 field bits<16> Inst; | 50 field bits<16> Inst; |
51 bits<32> factor; | 51 bits<32> factor; |
52 let Inst{7-0} = 0xDD; | 52 let Inst{7...0} = 0xDD; |
53 let Inst{15-8} = factor{11-4}; // offset by 4 + custom decode | 53 let Inst{15...8} = factor{11...4}; // offset by 4 + custom decode |
54 let AsmString = "baz $factor"; | 54 let AsmString = "baz $factor"; |
55 field bits<16> SoftFail = 0; | 55 field bits<16> SoftFail = 0; |
56 } | 56 } |
57 | 57 |
58 } | 58 } |
59 | 59 |
60 // CHECK: tmp = fieldFromInstruction(insn, 8, 7); | 60 // CHECK: tmp = fieldFromInstruction(insn, 8, 7); |
61 // CHECK: tmp = fieldFromInstruction(insn, 8, 8) << 3; | 61 // CHECK: tmp = fieldFromInstruction(insn, 8, 8) << 3; |
62 // CHECK: tmp |= fieldFromInstruction(insn, 8, 4) << 7; | 62 // CHECK: insertBits(tmp, fieldFromInstruction(insn, 8, 4), 7, 4); |
63 // CHECK: tmp |= fieldFromInstruction(insn, 12, 4) << 3; | 63 // CHECK: insertBits(tmp, fieldFromInstruction(insn, 12, 4), 3, 4); |
64 // CHECK: tmp = fieldFromInstruction(insn, 8, 8) << 4; | 64 // CHECK: tmp = fieldFromInstruction(insn, 8, 8) << 4; |