1 //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
4 // 1. The instruction sequences for vector vice scalar differ by a
7 // 2. There are no "immediate" forms, since loading 64-bit constants
8 // could be a constant pool load.
10 // 3. i64 setcc results are i32, which are subsequently converted to a FSM
11 // mask when used in a select pattern.
13 // 4. v2i64 setcc results are v4i32, which can be converted to a FSM mask
16 // M00$E Kan be Pretty N@sTi!!!!! (appologies to Monty!)
17 //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
19 // selb instruction definition for i64. Note that the selection mask is
20 // a vector, produced by various forms of FSM:
22 SELBInst<(outs R64C:$rT), (ins R64C:$rA, R64C:$rB, VECREG:$rC),
25 class CodeFrag<dag frag> {
29 class I64SELECTNegCond<PatFrag cond, CodeFrag cmpare>:
30 Pat<(select (i32 (cond R64C:$rA, R64C:$rB)), R64C:$rTrue, R64C:$rFalse),
31 (SELBr64_cond R64C:$rTrue, R64C:$rFalse, (FSMr32 cmpare.Fragment))>;
33 class I64SETCCNegCond<PatFrag cond, CodeFrag cmpare>:
34 Pat<(cond R64C:$rA, R64C:$rB),
35 (XORIr32 cmpare.Fragment, -1)>;
37 // The i64 seteq fragment that does the scalar->vector conversion and
40 CodeFrag<(CGTIv4i32 (GBv4i32 (CEQv4i32 (ORv2i64_i64 R64C:$rA),
41 (ORv2i64_i64 R64C:$rB))),
45 // The i64 seteq fragment that does the vector comparison
47 CodeFrag<(CGTIv4i32 (GBv4i32 (CEQv4i32 VECREG:$rA, VECREG:$rB)),
50 // i64 seteq (equality): the setcc result is i32, which is converted to a
51 // vector FSM mask when used in a select pattern.
53 // v2i64 seteq (equality): the setcc result is v4i32
54 multiclass CompareEqual64 {
55 // Plain old comparison, converts back to i32 scalar
56 def r64: CodeFrag<(ORi32_v4i32 CEQr64compare.Fragment)>;
57 def v2i64: CodeFrag<(ORi32_v4i32 CEQv2i64compare.Fragment)>;
59 // SELB mask from FSM:
60 def r64mask: CodeFrag<(ORi32_v4i32 (FSMv4i32 CEQr64compare.Fragment))>;
61 def v2i64mask: CodeFrag<(ORi32_v4i32 (FSMv4i32 CEQv2i64compare.Fragment))>;
64 defm I64EQ: CompareEqual64;
66 def : Pat<(seteq R64C:$rA, R64C:$rB), I64EQr64.Fragment>;
68 def : Pat<(seteq (v2i64 VECREG:$rA), (v2i64 VECREG:$rB)),
72 Pat<(select R32C:$rC, R64C:$rB, R64C:$rA),
73 (SELBr64_cond R64C:$rA, R64C:$rB, (FSMr32 R32C:$rC))>;
75 def : I64SETCCNegCond<setne, I64EQr64>;
77 def : I64SELECTNegCond<setne, I64EQr64>;