xref: /aosp_15_r20/external/llvm/lib/Target/PowerPC/README_P9.txt (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker//===- README_P9.txt - Notes for improving Power9 code gen ----------------===//
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard WorkerTODO: Instructions Need Implement Instrinstics or Map to LLVM IR
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard WorkerAltivec:
6*9880d681SAndroid Build Coastguard Worker- Vector Compare Not Equal (Zero):
7*9880d681SAndroid Build Coastguard Worker  vcmpneb(.) vcmpneh(.) vcmpnew(.)
8*9880d681SAndroid Build Coastguard Worker  vcmpnezb(.) vcmpnezh(.) vcmpnezw(.)
9*9880d681SAndroid Build Coastguard Worker  . Same as other VCMP*, use VCMP/VCMPo form (support intrinsic)
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker- Vector Extract Unsigned: vextractub vextractuh vextractuw vextractd
12*9880d681SAndroid Build Coastguard Worker  . Don't use llvm extractelement because they have different semantics
13*9880d681SAndroid Build Coastguard Worker  . Use instrinstics:
14*9880d681SAndroid Build Coastguard Worker    (set v2i64:$vD, (int_ppc_altivec_vextractub v16i8:$vA, imm:$UIMM))
15*9880d681SAndroid Build Coastguard Worker    (set v2i64:$vD, (int_ppc_altivec_vextractuh v8i16:$vA, imm:$UIMM))
16*9880d681SAndroid Build Coastguard Worker    (set v2i64:$vD, (int_ppc_altivec_vextractuw v4i32:$vA, imm:$UIMM))
17*9880d681SAndroid Build Coastguard Worker    (set v2i64:$vD, (int_ppc_altivec_vextractd  v2i64:$vA, imm:$UIMM))
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker- Vector Extract Unsigned Byte Left/Right-Indexed:
20*9880d681SAndroid Build Coastguard Worker  vextublx vextubrx vextuhlx vextuhrx vextuwlx vextuwrx
21*9880d681SAndroid Build Coastguard Worker  . Use instrinstics:
22*9880d681SAndroid Build Coastguard Worker    // Left-Indexed
23*9880d681SAndroid Build Coastguard Worker    (set i64:$rD, (int_ppc_altivec_vextublx i64:$rA, v16i8:$vB))
24*9880d681SAndroid Build Coastguard Worker    (set i64:$rD, (int_ppc_altivec_vextuhlx i64:$rA, v8i16:$vB))
25*9880d681SAndroid Build Coastguard Worker    (set i64:$rD, (int_ppc_altivec_vextuwlx i64:$rA, v4i32:$vB))
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Worker    // Right-Indexed
28*9880d681SAndroid Build Coastguard Worker    (set i64:$rD, (int_ppc_altivec_vextubrx i64:$rA, v16i8:$vB))
29*9880d681SAndroid Build Coastguard Worker    (set i64:$rD, (int_ppc_altivec_vextuhrx i64:$rA, v8i16:$vB))
30*9880d681SAndroid Build Coastguard Worker    (set i64:$rD, (int_ppc_altivec_vextuwrx i64:$rA, v4i32:$vB))
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker- Vector Insert Element Instructions: vinsertb vinsertd vinserth vinsertw
33*9880d681SAndroid Build Coastguard Worker    (set v16i8:$vD, (int_ppc_altivec_vinsertb v16i8:$vA, imm:$UIMM))
34*9880d681SAndroid Build Coastguard Worker    (set v8i16:$vD, (int_ppc_altivec_vinsertd v8i16:$vA, imm:$UIMM))
35*9880d681SAndroid Build Coastguard Worker    (set v4i32:$vD, (int_ppc_altivec_vinserth v4i32:$vA, imm:$UIMM))
36*9880d681SAndroid Build Coastguard Worker    (set v2i64:$vD, (int_ppc_altivec_vinsertw v2i64:$vA, imm:$UIMM))
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Worker- Vector Count Leading/Trailing Zero LSB. Result is placed into GPR[rD]:
39*9880d681SAndroid Build Coastguard Worker  vclzlsbb vctzlsbb
40*9880d681SAndroid Build Coastguard Worker  . Use intrinsic:
41*9880d681SAndroid Build Coastguard Worker    (set i64:$rD, (int_ppc_altivec_vclzlsbb v16i8:$vB))
42*9880d681SAndroid Build Coastguard Worker    (set i64:$rD, (int_ppc_altivec_vctzlsbb v16i8:$vB))
43*9880d681SAndroid Build Coastguard Worker
44*9880d681SAndroid Build Coastguard Worker- Vector Count Trailing Zeros: vctzb vctzh vctzw vctzd
45*9880d681SAndroid Build Coastguard Worker  . Map to llvm cttz
46*9880d681SAndroid Build Coastguard Worker    (set v16i8:$vD, (cttz v16i8:$vB))     // vctzb
47*9880d681SAndroid Build Coastguard Worker    (set v8i16:$vD, (cttz v8i16:$vB))     // vctzh
48*9880d681SAndroid Build Coastguard Worker    (set v4i32:$vD, (cttz v4i32:$vB))     // vctzw
49*9880d681SAndroid Build Coastguard Worker    (set v2i64:$vD, (cttz v2i64:$vB))     // vctzd
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Worker- Vector Extend Sign: vextsb2w vextsh2w vextsb2d vextsh2d vextsw2d
52*9880d681SAndroid Build Coastguard Worker  . vextsb2w:
53*9880d681SAndroid Build Coastguard Worker    (set v4i32:$vD, (sext v4i8:$vB))
54*9880d681SAndroid Build Coastguard Worker
55*9880d681SAndroid Build Coastguard Worker    // PowerISA_V3.0:
56*9880d681SAndroid Build Coastguard Worker    do i = 0 to 3
57*9880d681SAndroid Build Coastguard Worker       VR[VRT].word[i] ← EXTS32(VR[VRB].word[i].byte[3])
58*9880d681SAndroid Build Coastguard Worker    end
59*9880d681SAndroid Build Coastguard Worker
60*9880d681SAndroid Build Coastguard Worker  . vextsh2w:
61*9880d681SAndroid Build Coastguard Worker    (set v4i32:$vD, (sext v4i16:$vB))
62*9880d681SAndroid Build Coastguard Worker
63*9880d681SAndroid Build Coastguard Worker    // PowerISA_V3.0:
64*9880d681SAndroid Build Coastguard Worker    do i = 0 to 3
65*9880d681SAndroid Build Coastguard Worker       VR[VRT].word[i] ← EXTS32(VR[VRB].word[i].hword[1])
66*9880d681SAndroid Build Coastguard Worker    end
67*9880d681SAndroid Build Coastguard Worker
68*9880d681SAndroid Build Coastguard Worker  . vextsb2d
69*9880d681SAndroid Build Coastguard Worker    (set v2i64:$vD, (sext v2i8:$vB))
70*9880d681SAndroid Build Coastguard Worker
71*9880d681SAndroid Build Coastguard Worker    // PowerISA_V3.0:
72*9880d681SAndroid Build Coastguard Worker    do i = 0 to 1
73*9880d681SAndroid Build Coastguard Worker       VR[VRT].dword[i] ← EXTS64(VR[VRB].dword[i].byte[7])
74*9880d681SAndroid Build Coastguard Worker    end
75*9880d681SAndroid Build Coastguard Worker
76*9880d681SAndroid Build Coastguard Worker  . vextsh2d
77*9880d681SAndroid Build Coastguard Worker    (set v2i64:$vD, (sext v2i16:$vB))
78*9880d681SAndroid Build Coastguard Worker
79*9880d681SAndroid Build Coastguard Worker    // PowerISA_V3.0:
80*9880d681SAndroid Build Coastguard Worker    do i = 0 to 1
81*9880d681SAndroid Build Coastguard Worker       VR[VRT].dword[i] ← EXTS64(VR[VRB].dword[i].hword[3])
82*9880d681SAndroid Build Coastguard Worker    end
83*9880d681SAndroid Build Coastguard Worker
84*9880d681SAndroid Build Coastguard Worker  . vextsw2d
85*9880d681SAndroid Build Coastguard Worker    (set v2i64:$vD, (sext v2i32:$vB))
86*9880d681SAndroid Build Coastguard Worker
87*9880d681SAndroid Build Coastguard Worker    // PowerISA_V3.0:
88*9880d681SAndroid Build Coastguard Worker    do i = 0 to 1
89*9880d681SAndroid Build Coastguard Worker       VR[VRT].dword[i] ← EXTS64(VR[VRB].dword[i].word[1])
90*9880d681SAndroid Build Coastguard Worker    end
91*9880d681SAndroid Build Coastguard Worker
92*9880d681SAndroid Build Coastguard Worker- Vector Integer Negate: vnegw vnegd
93*9880d681SAndroid Build Coastguard Worker  . Map to llvm ineg
94*9880d681SAndroid Build Coastguard Worker    (set v4i32:$rT, (ineg v4i32:$rA))       // vnegw
95*9880d681SAndroid Build Coastguard Worker    (set v2i64:$rT, (ineg v2i64:$rA))       // vnegd
96*9880d681SAndroid Build Coastguard Worker
97*9880d681SAndroid Build Coastguard Worker- Vector Parity Byte: vprtybw vprtybd vprtybq
98*9880d681SAndroid Build Coastguard Worker  . Use intrinsic:
99*9880d681SAndroid Build Coastguard Worker    (set v4i32:$rD, (int_ppc_altivec_vprtybw v4i32:$vB))
100*9880d681SAndroid Build Coastguard Worker    (set v2i64:$rD, (int_ppc_altivec_vprtybd v2i64:$vB))
101*9880d681SAndroid Build Coastguard Worker    (set v1i128:$rD, (int_ppc_altivec_vprtybq v1i128:$vB))
102*9880d681SAndroid Build Coastguard Worker
103*9880d681SAndroid Build Coastguard Worker- Vector (Bit) Permute (Right-indexed):
104*9880d681SAndroid Build Coastguard Worker  . vbpermd: Same as "vbpermq", use VX1_Int_Ty2:
105*9880d681SAndroid Build Coastguard Worker    VX1_Int_Ty2<1484, "vbpermd", int_ppc_altivec_vbpermd, v2i64, v2i64>;
106*9880d681SAndroid Build Coastguard Worker
107*9880d681SAndroid Build Coastguard Worker  . vpermr: use VA1a_Int_Ty3
108*9880d681SAndroid Build Coastguard Worker    VA1a_Int_Ty3<59, "vpermr", int_ppc_altivec_vpermr, v16i8, v16i8, v16i8>;
109*9880d681SAndroid Build Coastguard Worker
110*9880d681SAndroid Build Coastguard Worker- Vector Rotate Left Mask/Mask-Insert: vrlwnm vrlwmi vrldnm vrldmi
111*9880d681SAndroid Build Coastguard Worker  . Use intrinsic:
112*9880d681SAndroid Build Coastguard Worker    VX1_Int_Ty<389, "vrlwnm", int_ppc_altivec_vrlwnm, v4i32>;
113*9880d681SAndroid Build Coastguard Worker    VX1_Int_Ty<133, "vrlwmi", int_ppc_altivec_vrlwmi, v4i32>;
114*9880d681SAndroid Build Coastguard Worker    VX1_Int_Ty<453, "vrldnm", int_ppc_altivec_vrldnm, v2i64>;
115*9880d681SAndroid Build Coastguard Worker    VX1_Int_Ty<197, "vrldmi", int_ppc_altivec_vrldmi, v2i64>;
116*9880d681SAndroid Build Coastguard Worker
117*9880d681SAndroid Build Coastguard Worker- Vector Shift Left/Right: vslv vsrv
118*9880d681SAndroid Build Coastguard Worker  . Use intrinsic, don't map to llvm shl and lshr, because they have different
119*9880d681SAndroid Build Coastguard Worker    semantics, e.g. vslv:
120*9880d681SAndroid Build Coastguard Worker
121*9880d681SAndroid Build Coastguard Worker      do i = 0 to 15
122*9880d681SAndroid Build Coastguard Worker         sh ← VR[VRB].byte[i].bit[5:7]
123*9880d681SAndroid Build Coastguard Worker         VR[VRT].byte[i] ← src.byte[i:i+1].bit[sh:sh+7]
124*9880d681SAndroid Build Coastguard Worker      end
125*9880d681SAndroid Build Coastguard Worker
126*9880d681SAndroid Build Coastguard Worker    VR[VRT].byte[i] is composed of 2 bytes from src.byte[i:i+1]
127*9880d681SAndroid Build Coastguard Worker
128*9880d681SAndroid Build Coastguard Worker  . VX1_Int_Ty<1860, "vslv", int_ppc_altivec_vslv, v16i8>;
129*9880d681SAndroid Build Coastguard Worker    VX1_Int_Ty<1796, "vsrv", int_ppc_altivec_vsrv, v16i8>;
130*9880d681SAndroid Build Coastguard Worker
131*9880d681SAndroid Build Coastguard Worker- Vector Multiply-by-10 (& Write Carry) Unsigned Quadword:
132*9880d681SAndroid Build Coastguard Worker  vmul10uq vmul10cuq
133*9880d681SAndroid Build Coastguard Worker  . Use intrinsic:
134*9880d681SAndroid Build Coastguard Worker    VX1_Int_Ty<513, "vmul10uq",   int_ppc_altivec_vmul10uq,  v1i128>;
135*9880d681SAndroid Build Coastguard Worker    VX1_Int_Ty<  1, "vmul10cuq",  int_ppc_altivec_vmul10cuq, v1i128>;
136*9880d681SAndroid Build Coastguard Worker
137*9880d681SAndroid Build Coastguard Worker- Vector Multiply-by-10 Extended (& Write Carry) Unsigned Quadword:
138*9880d681SAndroid Build Coastguard Worker  vmul10euq vmul10ecuq
139*9880d681SAndroid Build Coastguard Worker  . Use intrinsic:
140*9880d681SAndroid Build Coastguard Worker    VX1_Int_Ty<577, "vmul10euq",  int_ppc_altivec_vmul10euq, v1i128>;
141*9880d681SAndroid Build Coastguard Worker    VX1_Int_Ty< 65, "vmul10ecuq", int_ppc_altivec_vmul10ecuq, v1i128>;
142*9880d681SAndroid Build Coastguard Worker
143*9880d681SAndroid Build Coastguard Worker- Decimal Convert From/to National/Zoned/Signed-QWord:
144*9880d681SAndroid Build Coastguard Worker  bcdcfn. bcdcfz. bcdctn. bcdctz. bcdcfsq. bcdctsq.
145*9880d681SAndroid Build Coastguard Worker  . Use instrinstics:
146*9880d681SAndroid Build Coastguard Worker    (set v1i128:$vD, (int_ppc_altivec_bcdcfno  v1i128:$vB, i1:$PS))
147*9880d681SAndroid Build Coastguard Worker    (set v1i128:$vD, (int_ppc_altivec_bcdcfzo  v1i128:$vB, i1:$PS))
148*9880d681SAndroid Build Coastguard Worker    (set v1i128:$vD, (int_ppc_altivec_bcdctno  v1i128:$vB))
149*9880d681SAndroid Build Coastguard Worker    (set v1i128:$vD, (int_ppc_altivec_bcdctzo  v1i128:$vB, i1:$PS))
150*9880d681SAndroid Build Coastguard Worker    (set v1i128:$vD, (int_ppc_altivec_bcdcfsqo v1i128:$vB, i1:$PS))
151*9880d681SAndroid Build Coastguard Worker    (set v1i128:$vD, (int_ppc_altivec_bcdctsqo v1i128:$vB))
152*9880d681SAndroid Build Coastguard Worker
153*9880d681SAndroid Build Coastguard Worker- Decimal Copy-Sign/Set-Sign: bcdcpsgn. bcdsetsgn.
154*9880d681SAndroid Build Coastguard Worker  . Use instrinstics:
155*9880d681SAndroid Build Coastguard Worker    (set v1i128:$vD, (int_ppc_altivec_bcdcpsgno v1i128:$vA, v1i128:$vB))
156*9880d681SAndroid Build Coastguard Worker    (set v1i128:$vD, (int_ppc_altivec_bcdsetsgno v1i128:$vB, i1:$PS))
157*9880d681SAndroid Build Coastguard Worker
158*9880d681SAndroid Build Coastguard Worker- Decimal Shift/Unsigned-Shift/Shift-and-Round: bcds. bcdus. bcdsr.
159*9880d681SAndroid Build Coastguard Worker  . Use instrinstics:
160*9880d681SAndroid Build Coastguard Worker    (set v1i128:$vD, (int_ppc_altivec_bcdso  v1i128:$vA, v1i128:$vB, i1:$PS))
161*9880d681SAndroid Build Coastguard Worker    (set v1i128:$vD, (int_ppc_altivec_bcduso v1i128:$vA, v1i128:$vB))
162*9880d681SAndroid Build Coastguard Worker    (set v1i128:$vD, (int_ppc_altivec_bcdsro v1i128:$vA, v1i128:$vB, i1:$PS))
163*9880d681SAndroid Build Coastguard Worker
164*9880d681SAndroid Build Coastguard Worker  . Note! Their VA is accessed only 1 byte, i.e. VA.byte[7]
165*9880d681SAndroid Build Coastguard Worker
166*9880d681SAndroid Build Coastguard Worker- Decimal (Unsigned) Truncate: bcdtrunc. bcdutrunc.
167*9880d681SAndroid Build Coastguard Worker  . Use instrinstics:
168*9880d681SAndroid Build Coastguard Worker    (set v1i128:$vD, (int_ppc_altivec_bcdso  v1i128:$vA, v1i128:$vB, i1:$PS))
169*9880d681SAndroid Build Coastguard Worker    (set v1i128:$vD, (int_ppc_altivec_bcduso v1i128:$vA, v1i128:$vB))
170*9880d681SAndroid Build Coastguard Worker
171*9880d681SAndroid Build Coastguard Worker  . Note! Their VA is accessed only 2 byte, i.e. VA.hword[3] (VA.bit[48:63])
172*9880d681SAndroid Build Coastguard Worker
173*9880d681SAndroid Build Coastguard WorkerVSX:
174*9880d681SAndroid Build Coastguard Worker- QP Copy Sign: xscpsgnqp
175*9880d681SAndroid Build Coastguard Worker  . Similar to xscpsgndp
176*9880d681SAndroid Build Coastguard Worker  . (set f128:$vT, (fcopysign f128:$vB, f128:$vA)
177*9880d681SAndroid Build Coastguard Worker
178*9880d681SAndroid Build Coastguard Worker- QP Absolute/Negative-Absolute/Negate: xsabsqp xsnabsqp xsnegqp
179*9880d681SAndroid Build Coastguard Worker  . Similar to xsabsdp/xsnabsdp/xsnegdp
180*9880d681SAndroid Build Coastguard Worker  . (set f128:$vT, (fabs f128:$vB))             // xsabsqp
181*9880d681SAndroid Build Coastguard Worker    (set f128:$vT, (fneg (fabs f128:$vB)))      // xsnabsqp
182*9880d681SAndroid Build Coastguard Worker    (set f128:$vT, (fneg f128:$vB))             // xsnegqp
183*9880d681SAndroid Build Coastguard Worker
184*9880d681SAndroid Build Coastguard Worker- QP Add/Divide/Multiply/Subtract/Square-Root:
185*9880d681SAndroid Build Coastguard Worker  xsaddqp xsdivqp xsmulqp xssubqp xssqrtqp
186*9880d681SAndroid Build Coastguard Worker  . Similar to xsadddp
187*9880d681SAndroid Build Coastguard Worker  . isCommutable = 1
188*9880d681SAndroid Build Coastguard Worker    (set f128:$vT, (fadd f128:$vA, f128:$vB))   // xsaddqp
189*9880d681SAndroid Build Coastguard Worker    (set f128:$vT, (fmul f128:$vA, f128:$vB))   // xsmulqp
190*9880d681SAndroid Build Coastguard Worker
191*9880d681SAndroid Build Coastguard Worker  . isCommutable = 0
192*9880d681SAndroid Build Coastguard Worker    (set f128:$vT, (fdiv f128:$vA, f128:$vB))   // xsdivqp
193*9880d681SAndroid Build Coastguard Worker    (set f128:$vT, (fsub f128:$vA, f128:$vB))   // xssubqp
194*9880d681SAndroid Build Coastguard Worker    (set f128:$vT, (fsqrt f128:$vB)))           // xssqrtqp
195*9880d681SAndroid Build Coastguard Worker
196*9880d681SAndroid Build Coastguard Worker- Round to Odd of QP Add/Divide/Multiply/Subtract/Square-Root:
197*9880d681SAndroid Build Coastguard Worker  xsaddqpo xsdivqpo xsmulqpo xssubqpo xssqrtqpo
198*9880d681SAndroid Build Coastguard Worker  . Similar to xsrsqrtedp??
199*9880d681SAndroid Build Coastguard Worker      def XSRSQRTEDP : XX2Form<60, 74,
200*9880d681SAndroid Build Coastguard Worker                               (outs vsfrc:$XT), (ins vsfrc:$XB),
201*9880d681SAndroid Build Coastguard Worker                               "xsrsqrtedp $XT, $XB", IIC_VecFP,
202*9880d681SAndroid Build Coastguard Worker                               [(set f64:$XT, (PPCfrsqrte f64:$XB))]>;
203*9880d681SAndroid Build Coastguard Worker
204*9880d681SAndroid Build Coastguard Worker  . Define DAG Node in PPCInstrInfo.td:
205*9880d681SAndroid Build Coastguard Worker    def PPCfaddrto: SDNode<"PPCISD::FADDRTO", SDTFPBinOp, []>;
206*9880d681SAndroid Build Coastguard Worker    def PPCfdivrto: SDNode<"PPCISD::FDIVRTO", SDTFPBinOp, []>;
207*9880d681SAndroid Build Coastguard Worker    def PPCfmulrto: SDNode<"PPCISD::FMULRTO", SDTFPBinOp, []>;
208*9880d681SAndroid Build Coastguard Worker    def PPCfsubrto: SDNode<"PPCISD::FSUBRTO", SDTFPBinOp, []>;
209*9880d681SAndroid Build Coastguard Worker    def PPCfsqrtrto: SDNode<"PPCISD::FSQRTRTO", SDTFPUnaryOp, []>;
210*9880d681SAndroid Build Coastguard Worker
211*9880d681SAndroid Build Coastguard Worker    DAG patterns of each instruction (PPCInstrVSX.td):
212*9880d681SAndroid Build Coastguard Worker    . isCommutable = 1
213*9880d681SAndroid Build Coastguard Worker      (set f128:$vT, (PPCfaddrto f128:$vA, f128:$vB))   // xsaddqpo
214*9880d681SAndroid Build Coastguard Worker      (set f128:$vT, (PPCfmulrto f128:$vA, f128:$vB))   // xsmulqpo
215*9880d681SAndroid Build Coastguard Worker
216*9880d681SAndroid Build Coastguard Worker    . isCommutable = 0
217*9880d681SAndroid Build Coastguard Worker      (set f128:$vT, (PPCfdivrto f128:$vA, f128:$vB))   // xsdivqpo
218*9880d681SAndroid Build Coastguard Worker      (set f128:$vT, (PPCfsubrto f128:$vA, f128:$vB))   // xssubqpo
219*9880d681SAndroid Build Coastguard Worker      (set f128:$vT, (PPCfsqrtrto f128:$vB))            // xssqrtqpo
220*9880d681SAndroid Build Coastguard Worker
221*9880d681SAndroid Build Coastguard Worker- QP (Negative) Multiply-{Add/Subtract}: xsmaddqp xsmsubqp xsnmaddqp xsnmsubqp
222*9880d681SAndroid Build Coastguard Worker  . Ref: xsmaddadp/xsmsubadp/xsnmaddadp/xsnmsubadp
223*9880d681SAndroid Build Coastguard Worker
224*9880d681SAndroid Build Coastguard Worker  . isCommutable = 1
225*9880d681SAndroid Build Coastguard Worker    // xsmaddqp
226*9880d681SAndroid Build Coastguard Worker    [(set f128:$vT, (fma f128:$vA, f128:$vB, f128:$vTi))]>,
227*9880d681SAndroid Build Coastguard Worker    RegConstraint<"$vTi = $vT">, NoEncode<"$vTi">,
228*9880d681SAndroid Build Coastguard Worker    AltVSXFMARel;
229*9880d681SAndroid Build Coastguard Worker
230*9880d681SAndroid Build Coastguard Worker    // xsmsubqp
231*9880d681SAndroid Build Coastguard Worker    [(set f128:$vT, (fma f128:$vA, f128:$vB, (fneg f128:$vTi)))]>,
232*9880d681SAndroid Build Coastguard Worker    RegConstraint<"$vTi = $vT">, NoEncode<"$vTi">,
233*9880d681SAndroid Build Coastguard Worker    AltVSXFMARel;
234*9880d681SAndroid Build Coastguard Worker
235*9880d681SAndroid Build Coastguard Worker    // xsnmaddqp
236*9880d681SAndroid Build Coastguard Worker    [(set f128:$vT, (fneg (fma f128:$vA, f128:$vB, f128:$vTi)))]>,
237*9880d681SAndroid Build Coastguard Worker    RegConstraint<"$vTi = $vT">, NoEncode<"$vTi">,
238*9880d681SAndroid Build Coastguard Worker    AltVSXFMARel;
239*9880d681SAndroid Build Coastguard Worker
240*9880d681SAndroid Build Coastguard Worker    // xsnmsubqp
241*9880d681SAndroid Build Coastguard Worker    [(set f128:$vT, (fneg (fma f128:$vA, f128:$vB, (fneg f128:$vTi))))]>,
242*9880d681SAndroid Build Coastguard Worker    RegConstraint<"$vTi = $vT">, NoEncode<"$vTi">,
243*9880d681SAndroid Build Coastguard Worker    AltVSXFMARel;
244*9880d681SAndroid Build Coastguard Worker
245*9880d681SAndroid Build Coastguard Worker- Round to Odd of QP (Negative) Multiply-{Add/Subtract}:
246*9880d681SAndroid Build Coastguard Worker  xsmaddqpo xsmsubqpo xsnmaddqpo xsnmsubqpo
247*9880d681SAndroid Build Coastguard Worker  . Similar to xsrsqrtedp??
248*9880d681SAndroid Build Coastguard Worker
249*9880d681SAndroid Build Coastguard Worker  . Define DAG Node in PPCInstrInfo.td:
250*9880d681SAndroid Build Coastguard Worker    def PPCfmarto: SDNode<"PPCISD::FMARTO", SDTFPTernaryOp, []>;
251*9880d681SAndroid Build Coastguard Worker
252*9880d681SAndroid Build Coastguard Worker    It looks like we only need to define "PPCfmarto" for these instructions,
253*9880d681SAndroid Build Coastguard Worker    because according to PowerISA_V3.0, these instructions perform RTO on
254*9880d681SAndroid Build Coastguard Worker    fma's result:
255*9880d681SAndroid Build Coastguard Worker        xsmaddqp(o)
256*9880d681SAndroid Build Coastguard Worker        v      ← bfp_MULTIPLY_ADD(src1, src3, src2)
257*9880d681SAndroid Build Coastguard Worker        rnd    ← bfp_ROUND_TO_BFP128(RO, FPSCR.RN, v)
258*9880d681SAndroid Build Coastguard Worker        result ← bfp_CONVERT_TO_BFP128(rnd)
259*9880d681SAndroid Build Coastguard Worker
260*9880d681SAndroid Build Coastguard Worker        xsmsubqp(o)
261*9880d681SAndroid Build Coastguard Worker        v      ← bfp_MULTIPLY_ADD(src1, src3, bfp_NEGATE(src2))
262*9880d681SAndroid Build Coastguard Worker        rnd    ← bfp_ROUND_TO_BFP128(RO, FPSCR.RN, v)
263*9880d681SAndroid Build Coastguard Worker        result ← bfp_CONVERT_TO_BFP128(rnd)
264*9880d681SAndroid Build Coastguard Worker
265*9880d681SAndroid Build Coastguard Worker        xsnmaddqp(o)
266*9880d681SAndroid Build Coastguard Worker        v      ← bfp_MULTIPLY_ADD(src1,src3,src2)
267*9880d681SAndroid Build Coastguard Worker        rnd    ← bfp_NEGATE(bfp_ROUND_TO_BFP128(RO, FPSCR.RN, v))
268*9880d681SAndroid Build Coastguard Worker        result ← bfp_CONVERT_TO_BFP128(rnd)
269*9880d681SAndroid Build Coastguard Worker
270*9880d681SAndroid Build Coastguard Worker        xsnmsubqp(o)
271*9880d681SAndroid Build Coastguard Worker        v      ← bfp_MULTIPLY_ADD(src1, src3, bfp_NEGATE(src2))
272*9880d681SAndroid Build Coastguard Worker        rnd    ← bfp_NEGATE(bfp_ROUND_TO_BFP128(RO, FPSCR.RN, v))
273*9880d681SAndroid Build Coastguard Worker        result ← bfp_CONVERT_TO_BFP128(rnd)
274*9880d681SAndroid Build Coastguard Worker
275*9880d681SAndroid Build Coastguard Worker    DAG patterns of each instruction (PPCInstrVSX.td):
276*9880d681SAndroid Build Coastguard Worker    . isCommutable = 1
277*9880d681SAndroid Build Coastguard Worker      // xsmaddqpo
278*9880d681SAndroid Build Coastguard Worker      [(set f128:$vT, (PPCfmarto f128:$vA, f128:$vB, f128:$vTi))]>,
279*9880d681SAndroid Build Coastguard Worker      RegConstraint<"$vTi = $vT">, NoEncode<"$vTi">,
280*9880d681SAndroid Build Coastguard Worker      AltVSXFMARel;
281*9880d681SAndroid Build Coastguard Worker
282*9880d681SAndroid Build Coastguard Worker      // xsmsubqpo
283*9880d681SAndroid Build Coastguard Worker      [(set f128:$vT, (PPCfmarto f128:$vA, f128:$vB, (fneg f128:$vTi)))]>,
284*9880d681SAndroid Build Coastguard Worker      RegConstraint<"$vTi = $vT">, NoEncode<"$vTi">,
285*9880d681SAndroid Build Coastguard Worker      AltVSXFMARel;
286*9880d681SAndroid Build Coastguard Worker
287*9880d681SAndroid Build Coastguard Worker      // xsnmaddqpo
288*9880d681SAndroid Build Coastguard Worker      [(set f128:$vT, (fneg (PPCfmarto f128:$vA, f128:$vB, f128:$vTi)))]>,
289*9880d681SAndroid Build Coastguard Worker      RegConstraint<"$vTi = $vT">, NoEncode<"$vTi">,
290*9880d681SAndroid Build Coastguard Worker      AltVSXFMARel;
291*9880d681SAndroid Build Coastguard Worker
292*9880d681SAndroid Build Coastguard Worker      // xsnmsubqpo
293*9880d681SAndroid Build Coastguard Worker      [(set f128:$vT, (fneg (PPCfmarto f128:$vA, f128:$vB, (fneg f128:$vTi))))]>,
294*9880d681SAndroid Build Coastguard Worker      RegConstraint<"$vTi = $vT">, NoEncode<"$vTi">,
295*9880d681SAndroid Build Coastguard Worker      AltVSXFMARel;
296*9880d681SAndroid Build Coastguard Worker
297*9880d681SAndroid Build Coastguard Worker- QP Compare Ordered/Unordered: xscmpoqp xscmpuqp
298*9880d681SAndroid Build Coastguard Worker  . ref: XSCMPUDP
299*9880d681SAndroid Build Coastguard Worker      def XSCMPUDP : XX3Form_1<60, 35,
300*9880d681SAndroid Build Coastguard Worker                               (outs crrc:$crD), (ins vsfrc:$XA, vsfrc:$XB),
301*9880d681SAndroid Build Coastguard Worker                               "xscmpudp $crD, $XA, $XB", IIC_FPCompare, []>;
302*9880d681SAndroid Build Coastguard Worker
303*9880d681SAndroid Build Coastguard Worker  . No SDAG, intrinsic, builtin are required??
304*9880d681SAndroid Build Coastguard Worker    Or llvm fcmp order/unorder compare??
305*9880d681SAndroid Build Coastguard Worker
306*9880d681SAndroid Build Coastguard Worker- DP/QP Compare Exponents: xscmpexpdp xscmpexpqp
307*9880d681SAndroid Build Coastguard Worker  . No SDAG, intrinsic, builtin are required?
308*9880d681SAndroid Build Coastguard Worker
309*9880d681SAndroid Build Coastguard Worker- DP Compare ==, >=, >, !=: xscmpeqdp xscmpgedp xscmpgtdp xscmpnedp
310*9880d681SAndroid Build Coastguard Worker  . I checked existing instruction "XSCMPUDP". They are different in target
311*9880d681SAndroid Build Coastguard Worker    register. "XSCMPUDP" write to CR field, xscmp*dp write to VSX register
312*9880d681SAndroid Build Coastguard Worker
313*9880d681SAndroid Build Coastguard Worker  . Use instrinsic:
314*9880d681SAndroid Build Coastguard Worker    (set i128:$XT, (int_ppc_vsx_xscmpeqdp f64:$XA, f64:$XB))
315*9880d681SAndroid Build Coastguard Worker    (set i128:$XT, (int_ppc_vsx_xscmpgedp f64:$XA, f64:$XB))
316*9880d681SAndroid Build Coastguard Worker    (set i128:$XT, (int_ppc_vsx_xscmpgtdp f64:$XA, f64:$XB))
317*9880d681SAndroid Build Coastguard Worker    (set i128:$XT, (int_ppc_vsx_xscmpnedp f64:$XA, f64:$XB))
318*9880d681SAndroid Build Coastguard Worker
319*9880d681SAndroid Build Coastguard Worker- Vector Compare Not Equal: xvcmpnedp xvcmpnedp. xvcmpnesp xvcmpnesp.
320*9880d681SAndroid Build Coastguard Worker  . Similar to xvcmpeqdp:
321*9880d681SAndroid Build Coastguard Worker      defm XVCMPEQDP : XX3Form_Rcr<60, 99,
322*9880d681SAndroid Build Coastguard Worker                                 "xvcmpeqdp", "$XT, $XA, $XB", IIC_VecFPCompare,
323*9880d681SAndroid Build Coastguard Worker                                 int_ppc_vsx_xvcmpeqdp, v2i64, v2f64>;
324*9880d681SAndroid Build Coastguard Worker
325*9880d681SAndroid Build Coastguard Worker  . So we should use "XX3Form_Rcr" to implement instrinsic
326*9880d681SAndroid Build Coastguard Worker
327*9880d681SAndroid Build Coastguard Worker- Convert DP -> QP: xscvdpqp
328*9880d681SAndroid Build Coastguard Worker  . Similar to XSCVDPSP:
329*9880d681SAndroid Build Coastguard Worker      def XSCVDPSP : XX2Form<60, 265,
330*9880d681SAndroid Build Coastguard Worker                          (outs vsfrc:$XT), (ins vsfrc:$XB),
331*9880d681SAndroid Build Coastguard Worker                          "xscvdpsp $XT, $XB", IIC_VecFP, []>;
332*9880d681SAndroid Build Coastguard Worker  . So, No SDAG, intrinsic, builtin are required??
333*9880d681SAndroid Build Coastguard Worker
334*9880d681SAndroid Build Coastguard Worker- Round & Convert QP -> DP (dword[1] is set to zero): xscvqpdp xscvqpdpo
335*9880d681SAndroid Build Coastguard Worker  . Similar to XSCVDPSP
336*9880d681SAndroid Build Coastguard Worker  . No SDAG, intrinsic, builtin are required??
337*9880d681SAndroid Build Coastguard Worker
338*9880d681SAndroid Build Coastguard Worker- Truncate & Convert QP -> (Un)Signed (D)Word (dword[1] is set to zero):
339*9880d681SAndroid Build Coastguard Worker  xscvqpsdz xscvqpswz xscvqpudz xscvqpuwz
340*9880d681SAndroid Build Coastguard Worker  . According to PowerISA_V3.0, these are similar to "XSCVDPSXDS", "XSCVDPSXWS",
341*9880d681SAndroid Build Coastguard Worker    "XSCVDPUXDS", "XSCVDPUXWS"
342*9880d681SAndroid Build Coastguard Worker
343*9880d681SAndroid Build Coastguard Worker  . DAG patterns:
344*9880d681SAndroid Build Coastguard Worker    (set f128:$XT, (PPCfctidz f128:$XB))    // xscvqpsdz
345*9880d681SAndroid Build Coastguard Worker    (set f128:$XT, (PPCfctiwz f128:$XB))    // xscvqpswz
346*9880d681SAndroid Build Coastguard Worker    (set f128:$XT, (PPCfctiduz f128:$XB))   // xscvqpudz
347*9880d681SAndroid Build Coastguard Worker    (set f128:$XT, (PPCfctiwuz f128:$XB))   // xscvqpuwz
348*9880d681SAndroid Build Coastguard Worker
349*9880d681SAndroid Build Coastguard Worker- Convert (Un)Signed DWord -> QP: xscvsdqp xscvudqp
350*9880d681SAndroid Build Coastguard Worker  . Similar to XSCVSXDSP
351*9880d681SAndroid Build Coastguard Worker  . (set f128:$XT, (PPCfcfids f64:$XB))     // xscvsdqp
352*9880d681SAndroid Build Coastguard Worker    (set f128:$XT, (PPCfcfidus f64:$XB))    // xscvudqp
353*9880d681SAndroid Build Coastguard Worker
354*9880d681SAndroid Build Coastguard Worker- (Round &) Convert DP <-> HP: xscvdphp xscvhpdp
355*9880d681SAndroid Build Coastguard Worker  . Similar to XSCVDPSP
356*9880d681SAndroid Build Coastguard Worker  . No SDAG, intrinsic, builtin are required??
357*9880d681SAndroid Build Coastguard Worker
358*9880d681SAndroid Build Coastguard Worker- Vector HP -> SP: xvcvhpsp xvcvsphp
359*9880d681SAndroid Build Coastguard Worker  . Similar to XVCVDPSP:
360*9880d681SAndroid Build Coastguard Worker      def XVCVDPSP : XX2Form<60, 393,
361*9880d681SAndroid Build Coastguard Worker                          (outs vsrc:$XT), (ins vsrc:$XB),
362*9880d681SAndroid Build Coastguard Worker                          "xvcvdpsp $XT, $XB", IIC_VecFP, []>;
363*9880d681SAndroid Build Coastguard Worker  . No SDAG, intrinsic, builtin are required??
364*9880d681SAndroid Build Coastguard Worker
365*9880d681SAndroid Build Coastguard Worker- Round to Quad-Precision Integer: xsrqpi xsrqpix
366*9880d681SAndroid Build Coastguard Worker  . These are combination of "XSRDPI", "XSRDPIC", "XSRDPIM", .., because you
367*9880d681SAndroid Build Coastguard Worker    need to assign rounding mode in instruction
368*9880d681SAndroid Build Coastguard Worker  . Provide builtin?
369*9880d681SAndroid Build Coastguard Worker    (set f128:$vT, (int_ppc_vsx_xsrqpi f128:$vB))
370*9880d681SAndroid Build Coastguard Worker    (set f128:$vT, (int_ppc_vsx_xsrqpix f128:$vB))
371*9880d681SAndroid Build Coastguard Worker
372*9880d681SAndroid Build Coastguard Worker- Round Quad-Precision to Double-Extended Precision (fp80): xsrqpxp
373*9880d681SAndroid Build Coastguard Worker  . Provide builtin?
374*9880d681SAndroid Build Coastguard Worker    (set f128:$vT, (int_ppc_vsx_xsrqpxp f128:$vB))
375*9880d681SAndroid Build Coastguard Worker
376*9880d681SAndroid Build Coastguard WorkerFixed Point Facility:
377*9880d681SAndroid Build Coastguard Worker
378*9880d681SAndroid Build Coastguard Worker- Exploit cmprb and cmpeqb (perhaps for something like
379*9880d681SAndroid Build Coastguard Worker  isalpha/isdigit/isupper/islower and isspace respectivelly). This can
380*9880d681SAndroid Build Coastguard Worker  perhaps be done through a builtin.
381*9880d681SAndroid Build Coastguard Worker
382*9880d681SAndroid Build Coastguard Worker- Provide testing for cnttz[dw]
383*9880d681SAndroid Build Coastguard Worker- Insert Exponent DP/QP: xsiexpdp xsiexpqp
384*9880d681SAndroid Build Coastguard Worker  . Use intrinsic?
385*9880d681SAndroid Build Coastguard Worker  . xsiexpdp:
386*9880d681SAndroid Build Coastguard Worker    // Note: rA and rB are the unsigned integer value.
387*9880d681SAndroid Build Coastguard Worker    (set f128:$XT, (int_ppc_vsx_xsiexpdp i64:$rA, i64:$rB))
388*9880d681SAndroid Build Coastguard Worker
389*9880d681SAndroid Build Coastguard Worker  . xsiexpqp:
390*9880d681SAndroid Build Coastguard Worker    (set f128:$vT, (int_ppc_vsx_xsiexpqp f128:$vA, f64:$vB))
391*9880d681SAndroid Build Coastguard Worker
392*9880d681SAndroid Build Coastguard Worker- Extract Exponent/Significand DP/QP: xsxexpdp xsxsigdp xsxexpqp xsxsigqp
393*9880d681SAndroid Build Coastguard Worker  . Use intrinsic?
394*9880d681SAndroid Build Coastguard Worker  . (set i64:$rT, (int_ppc_vsx_xsxexpdp f64$XB))    // xsxexpdp
395*9880d681SAndroid Build Coastguard Worker    (set i64:$rT, (int_ppc_vsx_xsxsigdp f64$XB))    // xsxsigdp
396*9880d681SAndroid Build Coastguard Worker    (set f128:$vT, (int_ppc_vsx_xsxexpqp f128$vB))  // xsxexpqp
397*9880d681SAndroid Build Coastguard Worker    (set f128:$vT, (int_ppc_vsx_xsxsigqp f128$vB))  // xsxsigqp
398*9880d681SAndroid Build Coastguard Worker
399*9880d681SAndroid Build Coastguard Worker- Vector Insert Word: xxinsertw
400*9880d681SAndroid Build Coastguard Worker  - Useful for inserting f32/i32 elements into vectors (the element to be
401*9880d681SAndroid Build Coastguard Worker    inserted needs to be prepared)
402*9880d681SAndroid Build Coastguard Worker  . Note: llvm has insertelem in "Vector Operations"
403*9880d681SAndroid Build Coastguard Worker    ; yields <n x <ty>>
404*9880d681SAndroid Build Coastguard Worker    <result> = insertelement <n x <ty>> <val>, <ty> <elt>, <ty2> <idx>
405*9880d681SAndroid Build Coastguard Worker
406*9880d681SAndroid Build Coastguard Worker    But how to map to it??
407*9880d681SAndroid Build Coastguard Worker    [(set v1f128:$XT, (insertelement v1f128:$XTi, f128:$XB, i4:$UIMM))]>,
408*9880d681SAndroid Build Coastguard Worker    RegConstraint<"$XTi = $XT">, NoEncode<"$XTi">,
409*9880d681SAndroid Build Coastguard Worker
410*9880d681SAndroid Build Coastguard Worker  . Or use intrinsic?
411*9880d681SAndroid Build Coastguard Worker    (set v1f128:$XT, (int_ppc_vsx_xxinsertw v1f128:$XTi, f128:$XB, i4:$UIMM))
412*9880d681SAndroid Build Coastguard Worker
413*9880d681SAndroid Build Coastguard Worker- Vector Extract Unsigned Word: xxextractuw
414*9880d681SAndroid Build Coastguard Worker  - Not useful for extraction of f32 from v4f32 (the current pattern is better -
415*9880d681SAndroid Build Coastguard Worker    shift->convert)
416*9880d681SAndroid Build Coastguard Worker  - It is useful for (uint_to_fp (vector_extract v4i32, N))
417*9880d681SAndroid Build Coastguard Worker  - Unfortunately, it can't be used for (sint_to_fp (vector_extract v4i32, N))
418*9880d681SAndroid Build Coastguard Worker  . Note: llvm has extractelement in "Vector Operations"
419*9880d681SAndroid Build Coastguard Worker    ; yields <ty>
420*9880d681SAndroid Build Coastguard Worker    <result> = extractelement <n x <ty>> <val>, <ty2> <idx>
421*9880d681SAndroid Build Coastguard Worker
422*9880d681SAndroid Build Coastguard Worker    How to map to it??
423*9880d681SAndroid Build Coastguard Worker    [(set f128:$XT, (extractelement v1f128:$XB, i4:$UIMM))]
424*9880d681SAndroid Build Coastguard Worker
425*9880d681SAndroid Build Coastguard Worker  . Or use intrinsic?
426*9880d681SAndroid Build Coastguard Worker    (set f128:$XT, (int_ppc_vsx_xxextractuw v1f128:$XB, i4:$UIMM))
427*9880d681SAndroid Build Coastguard Worker
428*9880d681SAndroid Build Coastguard Worker- Vector Insert Exponent DP/SP: xviexpdp xviexpsp
429*9880d681SAndroid Build Coastguard Worker  . Use intrinsic
430*9880d681SAndroid Build Coastguard Worker    (set v2f64:$XT, (int_ppc_vsx_xviexpdp v2f64:$XA, v2f64:$XB))
431*9880d681SAndroid Build Coastguard Worker    (set v4f32:$XT, (int_ppc_vsx_xviexpsp v4f32:$XA, v4f32:$XB))
432*9880d681SAndroid Build Coastguard Worker
433*9880d681SAndroid Build Coastguard Worker- Vector Extract Exponent/Significand DP/SP: xvxexpdp xvxexpsp xvxsigdp xvxsigsp
434*9880d681SAndroid Build Coastguard Worker  . Use intrinsic
435*9880d681SAndroid Build Coastguard Worker    (set v2f64:$XT, (int_ppc_vsx_xvxexpdp v2f64:$XB))
436*9880d681SAndroid Build Coastguard Worker    (set v4f32:$XT, (int_ppc_vsx_xvxexpsp v4f32:$XB))
437*9880d681SAndroid Build Coastguard Worker    (set v2f64:$XT, (int_ppc_vsx_xvxsigdp v2f64:$XB))
438*9880d681SAndroid Build Coastguard Worker    (set v4f32:$XT, (int_ppc_vsx_xvxsigsp v4f32:$XB))
439*9880d681SAndroid Build Coastguard Worker
440*9880d681SAndroid Build Coastguard Worker- Test Data Class SP/DP/QP: xststdcsp xststdcdp xststdcqp
441*9880d681SAndroid Build Coastguard Worker  . No SDAG, intrinsic, builtin are required?
442*9880d681SAndroid Build Coastguard Worker    Because it seems that we have no way to map BF field?
443*9880d681SAndroid Build Coastguard Worker
444*9880d681SAndroid Build Coastguard Worker    Instruction Form: [PO T XO B XO BX TX]
445*9880d681SAndroid Build Coastguard Worker    Asm: xststd* BF,XB,DCMX
446*9880d681SAndroid Build Coastguard Worker
447*9880d681SAndroid Build Coastguard Worker    BF is an index to CR register field.
448*9880d681SAndroid Build Coastguard Worker
449*9880d681SAndroid Build Coastguard Worker- Vector Test Data Class SP/DP: xvtstdcsp xvtstdcdp
450*9880d681SAndroid Build Coastguard Worker  . Use intrinsic
451*9880d681SAndroid Build Coastguard Worker    (set v4f32:$XT, (int_ppc_vsx_xvtstdcsp v4f32:$XB, i7:$DCMX))
452*9880d681SAndroid Build Coastguard Worker    (set v2f64:$XT, (int_ppc_vsx_xvtstdcdp v2f64:$XB, i7:$DCMX))
453*9880d681SAndroid Build Coastguard Worker
454*9880d681SAndroid Build Coastguard Worker- Maximum/Minimum Type-C/Type-J DP: xsmaxcdp xsmaxjdp xsmincdp xsminjdp
455*9880d681SAndroid Build Coastguard Worker  . PowerISA_V3.0:
456*9880d681SAndroid Build Coastguard Worker    "xsmaxcdp can be used to implement the C/C++/Java conditional operation
457*9880d681SAndroid Build Coastguard Worker     (x>y)?x:y for single-precision and double-precision arguments."
458*9880d681SAndroid Build Coastguard Worker
459*9880d681SAndroid Build Coastguard Worker    Note! c type and j type have different behavior when:
460*9880d681SAndroid Build Coastguard Worker    1. Either input is NaN
461*9880d681SAndroid Build Coastguard Worker    2. Both input are +-Infinity, +-Zero
462*9880d681SAndroid Build Coastguard Worker
463*9880d681SAndroid Build Coastguard Worker  . dtype map to llvm fmaxnum/fminnum
464*9880d681SAndroid Build Coastguard Worker    jtype use intrinsic
465*9880d681SAndroid Build Coastguard Worker
466*9880d681SAndroid Build Coastguard Worker  . xsmaxcdp xsmincdp
467*9880d681SAndroid Build Coastguard Worker    (set f64:$XT, (fmaxnum f64:$XA, f64:$XB))
468*9880d681SAndroid Build Coastguard Worker    (set f64:$XT, (fminnum f64:$XA, f64:$XB))
469*9880d681SAndroid Build Coastguard Worker
470*9880d681SAndroid Build Coastguard Worker  . xsmaxjdp xsminjdp
471*9880d681SAndroid Build Coastguard Worker    (set f64:$XT, (int_ppc_vsx_xsmaxjdp f64:$XA, f64:$XB))
472*9880d681SAndroid Build Coastguard Worker    (set f64:$XT, (int_ppc_vsx_xsminjdp f64:$XA, f64:$XB))
473*9880d681SAndroid Build Coastguard Worker
474*9880d681SAndroid Build Coastguard Worker- Vector Byte-Reverse H/W/D/Q Word: xxbrh xxbrw xxbrd xxbrq
475*9880d681SAndroid Build Coastguard Worker  . Use intrinsic
476*9880d681SAndroid Build Coastguard Worker    (set v8i16:$XT, (int_ppc_vsx_xxbrh v8i16:$XB))
477*9880d681SAndroid Build Coastguard Worker    (set v4i32:$XT, (int_ppc_vsx_xxbrw v4i32:$XB))
478*9880d681SAndroid Build Coastguard Worker    (set v2i64:$XT, (int_ppc_vsx_xxbrd v2i64:$XB))
479*9880d681SAndroid Build Coastguard Worker    (set v1i128:$XT, (int_ppc_vsx_xxbrq v1i128:$XB))
480*9880d681SAndroid Build Coastguard Worker
481*9880d681SAndroid Build Coastguard Worker- Vector Permute: xxperm xxpermr
482*9880d681SAndroid Build Coastguard Worker  . I have checked "PPCxxswapd" in PPCInstrVSX.td, but they are different
483*9880d681SAndroid Build Coastguard Worker  . Use intrinsic
484*9880d681SAndroid Build Coastguard Worker    (set v16i8:$XT, (int_ppc_vsx_xxperm v16i8:$XA, v16i8:$XB))
485*9880d681SAndroid Build Coastguard Worker    (set v16i8:$XT, (int_ppc_vsx_xxpermr v16i8:$XA, v16i8:$XB))
486*9880d681SAndroid Build Coastguard Worker
487*9880d681SAndroid Build Coastguard Worker- Vector Splat Immediate Byte: xxspltib
488*9880d681SAndroid Build Coastguard Worker  . Similar to XXSPLTW:
489*9880d681SAndroid Build Coastguard Worker      def XXSPLTW : XX2Form_2<60, 164,
490*9880d681SAndroid Build Coastguard Worker                           (outs vsrc:$XT), (ins vsrc:$XB, u2imm:$UIM),
491*9880d681SAndroid Build Coastguard Worker                           "xxspltw $XT, $XB, $UIM", IIC_VecPerm, []>;
492*9880d681SAndroid Build Coastguard Worker
493*9880d681SAndroid Build Coastguard Worker  . No SDAG, intrinsic, builtin are required?
494*9880d681SAndroid Build Coastguard Worker
495*9880d681SAndroid Build Coastguard Worker- Load/Store Vector: lxv stxv
496*9880d681SAndroid Build Coastguard Worker  . Has likely SDAG match:
497*9880d681SAndroid Build Coastguard Worker    (set v?:$XT, (load ix16addr:$src))
498*9880d681SAndroid Build Coastguard Worker    (set v?:$XT, (store ix16addr:$dst))
499*9880d681SAndroid Build Coastguard Worker
500*9880d681SAndroid Build Coastguard Worker  . Need define ix16addr in PPCInstrInfo.td
501*9880d681SAndroid Build Coastguard Worker    ix16addr: 16-byte aligned, see "def memrix16" in PPCInstrInfo.td
502*9880d681SAndroid Build Coastguard Worker
503*9880d681SAndroid Build Coastguard Worker- Load/Store Vector Indexed: lxvx stxvx
504*9880d681SAndroid Build Coastguard Worker  . Has likely SDAG match:
505*9880d681SAndroid Build Coastguard Worker    (set v?:$XT, (load xoaddr:$src))
506*9880d681SAndroid Build Coastguard Worker    (set v?:$XT, (store xoaddr:$dst))
507*9880d681SAndroid Build Coastguard Worker
508*9880d681SAndroid Build Coastguard Worker- Load/Store DWord: lxsd stxsd
509*9880d681SAndroid Build Coastguard Worker  . Similar to lxsdx/stxsdx:
510*9880d681SAndroid Build Coastguard Worker    def LXSDX : XX1Form<31, 588,
511*9880d681SAndroid Build Coastguard Worker                        (outs vsfrc:$XT), (ins memrr:$src),
512*9880d681SAndroid Build Coastguard Worker                        "lxsdx $XT, $src", IIC_LdStLFD,
513*9880d681SAndroid Build Coastguard Worker                        [(set f64:$XT, (load xoaddr:$src))]>;
514*9880d681SAndroid Build Coastguard Worker
515*9880d681SAndroid Build Coastguard Worker  . (set f64:$XT, (load ixaddr:$src))
516*9880d681SAndroid Build Coastguard Worker    (set f64:$XT, (store ixaddr:$dst))
517*9880d681SAndroid Build Coastguard Worker
518*9880d681SAndroid Build Coastguard Worker- Load/Store SP, with conversion from/to DP: lxssp stxssp
519*9880d681SAndroid Build Coastguard Worker  . Similar to lxsspx/stxsspx:
520*9880d681SAndroid Build Coastguard Worker    def LXSSPX : XX1Form<31, 524, (outs vssrc:$XT), (ins memrr:$src),
521*9880d681SAndroid Build Coastguard Worker                         "lxsspx $XT, $src", IIC_LdStLFD,
522*9880d681SAndroid Build Coastguard Worker                         [(set f32:$XT, (load xoaddr:$src))]>;
523*9880d681SAndroid Build Coastguard Worker
524*9880d681SAndroid Build Coastguard Worker  . (set f32:$XT, (load ixaddr:$src))
525*9880d681SAndroid Build Coastguard Worker    (set f32:$XT, (store ixaddr:$dst))
526*9880d681SAndroid Build Coastguard Worker
527*9880d681SAndroid Build Coastguard Worker- Load as Integer Byte/Halfword & Zero Indexed: lxsibzx lxsihzx
528*9880d681SAndroid Build Coastguard Worker  . Similar to lxsiwzx:
529*9880d681SAndroid Build Coastguard Worker    def LXSIWZX : XX1Form<31, 12, (outs vsfrc:$XT), (ins memrr:$src),
530*9880d681SAndroid Build Coastguard Worker                          "lxsiwzx $XT, $src", IIC_LdStLFD,
531*9880d681SAndroid Build Coastguard Worker                          [(set f64:$XT, (PPClfiwzx xoaddr:$src))]>;
532*9880d681SAndroid Build Coastguard Worker
533*9880d681SAndroid Build Coastguard Worker  . (set f64:$XT, (PPClfiwzx xoaddr:$src))
534*9880d681SAndroid Build Coastguard Worker
535*9880d681SAndroid Build Coastguard Worker- Store as Integer Byte/Halfword Indexed: stxsibx stxsihx
536*9880d681SAndroid Build Coastguard Worker  . Similar to stxsiwx:
537*9880d681SAndroid Build Coastguard Worker    def STXSIWX : XX1Form<31, 140, (outs), (ins vsfrc:$XT, memrr:$dst),
538*9880d681SAndroid Build Coastguard Worker                          "stxsiwx $XT, $dst", IIC_LdStSTFD,
539*9880d681SAndroid Build Coastguard Worker                          [(PPCstfiwx f64:$XT, xoaddr:$dst)]>;
540*9880d681SAndroid Build Coastguard Worker
541*9880d681SAndroid Build Coastguard Worker  . (PPCstfiwx f64:$XT, xoaddr:$dst)
542*9880d681SAndroid Build Coastguard Worker
543*9880d681SAndroid Build Coastguard Worker- Load Vector Halfword*8/Byte*16 Indexed: lxvh8x lxvb16x
544*9880d681SAndroid Build Coastguard Worker  . Similar to lxvd2x/lxvw4x:
545*9880d681SAndroid Build Coastguard Worker    def LXVD2X : XX1Form<31, 844,
546*9880d681SAndroid Build Coastguard Worker                         (outs vsrc:$XT), (ins memrr:$src),
547*9880d681SAndroid Build Coastguard Worker                         "lxvd2x $XT, $src", IIC_LdStLFD,
548*9880d681SAndroid Build Coastguard Worker                         [(set v2f64:$XT, (int_ppc_vsx_lxvd2x xoaddr:$src))]>;
549*9880d681SAndroid Build Coastguard Worker
550*9880d681SAndroid Build Coastguard Worker  . (set v8i16:$XT, (int_ppc_vsx_lxvh8x xoaddr:$src))
551*9880d681SAndroid Build Coastguard Worker    (set v16i8:$XT, (int_ppc_vsx_lxvb16x xoaddr:$src))
552*9880d681SAndroid Build Coastguard Worker
553*9880d681SAndroid Build Coastguard Worker- Store Vector Halfword*8/Byte*16 Indexed: stxvh8x stxvb16x
554*9880d681SAndroid Build Coastguard Worker  . Similar to stxvd2x/stxvw4x:
555*9880d681SAndroid Build Coastguard Worker    def STXVD2X : XX1Form<31, 972,
556*9880d681SAndroid Build Coastguard Worker                         (outs), (ins vsrc:$XT, memrr:$dst),
557*9880d681SAndroid Build Coastguard Worker                         "stxvd2x $XT, $dst", IIC_LdStSTFD,
558*9880d681SAndroid Build Coastguard Worker                         [(store v2f64:$XT, xoaddr:$dst)]>;
559*9880d681SAndroid Build Coastguard Worker
560*9880d681SAndroid Build Coastguard Worker  . (store v8i16:$XT, xoaddr:$dst)
561*9880d681SAndroid Build Coastguard Worker    (store v16i8:$XT, xoaddr:$dst)
562*9880d681SAndroid Build Coastguard Worker
563*9880d681SAndroid Build Coastguard Worker- Load/Store Vector (Left-justified) with Length: lxvl lxvll stxvl stxvll
564*9880d681SAndroid Build Coastguard Worker  . Likely needs an intrinsic
565*9880d681SAndroid Build Coastguard Worker  . (set v?:$XT, (int_ppc_vsx_lxvl xoaddr:$src))
566*9880d681SAndroid Build Coastguard Worker    (set v?:$XT, (int_ppc_vsx_lxvll xoaddr:$src))
567*9880d681SAndroid Build Coastguard Worker
568*9880d681SAndroid Build Coastguard Worker  . (int_ppc_vsx_stxvl xoaddr:$dst))
569*9880d681SAndroid Build Coastguard Worker    (int_ppc_vsx_stxvll xoaddr:$dst))
570*9880d681SAndroid Build Coastguard Worker
571*9880d681SAndroid Build Coastguard Worker- Load Vector Word & Splat Indexed: lxvwsx
572*9880d681SAndroid Build Coastguard Worker  . Likely needs an intrinsic
573*9880d681SAndroid Build Coastguard Worker  . (set v?:$XT, (int_ppc_vsx_lxvwsx xoaddr:$src))
574*9880d681SAndroid Build Coastguard Worker
575*9880d681SAndroid Build Coastguard WorkerAtomic operations (l[dw]at, st[dw]at):
576*9880d681SAndroid Build Coastguard Worker- Provide custom lowering for common atomic operations to use these
577*9880d681SAndroid Build Coastguard Worker  instructions with the correct Function Code
578*9880d681SAndroid Build Coastguard Worker- Ensure the operands are in the correct register (i.e. RT+1, RT+2)
579*9880d681SAndroid Build Coastguard Worker- Provide builtins since not all FC's necessarily have an existing LLVM
580*9880d681SAndroid Build Coastguard Worker  atomic operation
581*9880d681SAndroid Build Coastguard Worker
582*9880d681SAndroid Build Coastguard WorkerLoad Doubleword Monitored (ldmx):
583*9880d681SAndroid Build Coastguard Worker- Investigate whether there are any uses for this. It seems to be related to
584*9880d681SAndroid Build Coastguard Worker  Garbage Collection so it isn't likely to be all that useful for most
585*9880d681SAndroid Build Coastguard Worker  languages we deal with.
586*9880d681SAndroid Build Coastguard Worker
587*9880d681SAndroid Build Coastguard WorkerMove to CR from XER Extended (mcrxrx):
588*9880d681SAndroid Build Coastguard Worker- Is there a use for this in LLVM?
589*9880d681SAndroid Build Coastguard Worker
590*9880d681SAndroid Build Coastguard WorkerFixed Point Facility:
591*9880d681SAndroid Build Coastguard Worker
592*9880d681SAndroid Build Coastguard Worker- Copy-Paste Facility: copy copy_first cp_abort paste paste. paste_last
593*9880d681SAndroid Build Coastguard Worker  . Use instrinstics:
594*9880d681SAndroid Build Coastguard Worker    (int_ppc_copy_first i32:$rA, i32:$rB)
595*9880d681SAndroid Build Coastguard Worker    (int_ppc_copy i32:$rA, i32:$rB)
596*9880d681SAndroid Build Coastguard Worker
597*9880d681SAndroid Build Coastguard Worker    (int_ppc_paste i32:$rA, i32:$rB)
598*9880d681SAndroid Build Coastguard Worker    (int_ppc_paste_last i32:$rA, i32:$rB)
599*9880d681SAndroid Build Coastguard Worker
600*9880d681SAndroid Build Coastguard Worker    (int_cp_abort)
601*9880d681SAndroid Build Coastguard Worker
602*9880d681SAndroid Build Coastguard Worker- Message Synchronize: msgsync
603*9880d681SAndroid Build Coastguard Worker- SLB*: slbieg slbsync
604*9880d681SAndroid Build Coastguard Worker- stop
605*9880d681SAndroid Build Coastguard Worker  . No instrinstics
606