Arnold Schwaighofer | 373e865 | 2007-10-12 21:30:57 +0000 | [diff] [blame] | 1 | //====- X86InstrSSE.td - Describe the X86 Instruction Set --*- tablegen -*-===// |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2 | // |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 081ce94 | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 7 | // |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file describes the X86 SSE instruction set, defining the instructions, |
| 11 | // and properties of the instructions which are needed for code generation, |
| 12 | // machine code emission, and analysis. |
| 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | |
| 17 | //===----------------------------------------------------------------------===// |
| 18 | // SSE specific DAG Nodes. |
| 19 | //===----------------------------------------------------------------------===// |
| 20 | |
| 21 | def SDTX86FPShiftOp : SDTypeProfile<1, 2, [ SDTCisSameAs<0, 1>, |
| 22 | SDTCisFP<0>, SDTCisInt<2> ]>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 23 | def SDTX86VFCMP : SDTypeProfile<1, 3, [SDTCisInt<0>, SDTCisSameAs<1, 2>, |
| 24 | SDTCisFP<1>, SDTCisVT<3, i8>]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 25 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 26 | def X86fmin : SDNode<"X86ISD::FMIN", SDTFPBinOp>; |
| 27 | def X86fmax : SDNode<"X86ISD::FMAX", SDTFPBinOp>; |
| 28 | def X86fand : SDNode<"X86ISD::FAND", SDTFPBinOp, |
| 29 | [SDNPCommutative, SDNPAssociative]>; |
| 30 | def X86for : SDNode<"X86ISD::FOR", SDTFPBinOp, |
| 31 | [SDNPCommutative, SDNPAssociative]>; |
| 32 | def X86fxor : SDNode<"X86ISD::FXOR", SDTFPBinOp, |
| 33 | [SDNPCommutative, SDNPAssociative]>; |
| 34 | def X86frsqrt : SDNode<"X86ISD::FRSQRT", SDTFPUnaryOp>; |
| 35 | def X86frcp : SDNode<"X86ISD::FRCP", SDTFPUnaryOp>; |
| 36 | def X86fsrl : SDNode<"X86ISD::FSRL", SDTX86FPShiftOp>; |
Evan Cheng | f37bf45 | 2007-10-01 18:12:48 +0000 | [diff] [blame] | 37 | def X86comi : SDNode<"X86ISD::COMI", SDTX86CmpTest>; |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 38 | def X86ucomi : SDNode<"X86ISD::UCOMI", SDTX86CmpTest>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 39 | def X86pshufb : SDNode<"X86ISD::PSHUFB", |
Nate Begeman | 2c87c42 | 2009-02-23 08:49:38 +0000 | [diff] [blame] | 40 | SDTypeProfile<1, 2, [SDTCisVT<0, v16i8>, SDTCisSameAs<0,1>, |
| 41 | SDTCisSameAs<0,2>]>>; |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 42 | def X86pextrb : SDNode<"X86ISD::PEXTRB", |
| 43 | SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisPtrTy<2>]>>; |
| 44 | def X86pextrw : SDNode<"X86ISD::PEXTRW", |
| 45 | SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisPtrTy<2>]>>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 46 | def X86pinsrb : SDNode<"X86ISD::PINSRB", |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 47 | SDTypeProfile<1, 3, [SDTCisVT<0, v16i8>, SDTCisSameAs<0,1>, |
| 48 | SDTCisVT<2, i32>, SDTCisPtrTy<3>]>>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 49 | def X86pinsrw : SDNode<"X86ISD::PINSRW", |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 50 | SDTypeProfile<1, 3, [SDTCisVT<0, v8i16>, SDTCisSameAs<0,1>, |
| 51 | SDTCisVT<2, i32>, SDTCisPtrTy<3>]>>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 52 | def X86insrtps : SDNode<"X86ISD::INSERTPS", |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 53 | SDTypeProfile<1, 3, [SDTCisVT<0, v4f32>, SDTCisSameAs<0,1>, |
Eric Christopher | efb657e | 2009-07-24 00:33:09 +0000 | [diff] [blame] | 54 | SDTCisVT<2, v4f32>, SDTCisPtrTy<3>]>>; |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 55 | def X86vzmovl : SDNode<"X86ISD::VZEXT_MOVL", |
| 56 | SDTypeProfile<1, 1, [SDTCisSameAs<0,1>]>>; |
| 57 | def X86vzload : SDNode<"X86ISD::VZEXT_LOAD", SDTLoad, |
| 58 | [SDNPHasChain, SDNPMayLoad]>; |
Evan Cheng | dea9936 | 2008-05-29 08:22:04 +0000 | [diff] [blame] | 59 | def X86vshl : SDNode<"X86ISD::VSHL", SDTIntShiftOp>; |
| 60 | def X86vshr : SDNode<"X86ISD::VSRL", SDTIntShiftOp>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 61 | def X86cmpps : SDNode<"X86ISD::CMPPS", SDTX86VFCMP>; |
| 62 | def X86cmppd : SDNode<"X86ISD::CMPPD", SDTX86VFCMP>; |
| 63 | def X86pcmpeqb : SDNode<"X86ISD::PCMPEQB", SDTIntBinOp, [SDNPCommutative]>; |
| 64 | def X86pcmpeqw : SDNode<"X86ISD::PCMPEQW", SDTIntBinOp, [SDNPCommutative]>; |
| 65 | def X86pcmpeqd : SDNode<"X86ISD::PCMPEQD", SDTIntBinOp, [SDNPCommutative]>; |
| 66 | def X86pcmpeqq : SDNode<"X86ISD::PCMPEQQ", SDTIntBinOp, [SDNPCommutative]>; |
| 67 | def X86pcmpgtb : SDNode<"X86ISD::PCMPGTB", SDTIntBinOp>; |
| 68 | def X86pcmpgtw : SDNode<"X86ISD::PCMPGTW", SDTIntBinOp>; |
| 69 | def X86pcmpgtd : SDNode<"X86ISD::PCMPGTD", SDTIntBinOp>; |
| 70 | def X86pcmpgtq : SDNode<"X86ISD::PCMPGTQ", SDTIntBinOp>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 71 | |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 72 | def SDTX86CmpPTest : SDTypeProfile<0, 2, [SDTCisVT<0, v4f32>, |
| 73 | SDTCisVT<1, v4f32>]>; |
Eric Christopher | 95d7926 | 2009-07-29 00:28:05 +0000 | [diff] [blame] | 74 | def X86ptest : SDNode<"X86ISD::PTEST", SDTX86CmpPTest>; |
| 75 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 76 | //===----------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 77 | // SSE Complex Patterns |
| 78 | //===----------------------------------------------------------------------===// |
| 79 | |
| 80 | // These are 'extloads' from a scalar to the low element of a vector, zeroing |
| 81 | // the top elements. These are used for the SSE 'ss' and 'sd' instruction |
| 82 | // forms. |
Rafael Espindola | bca99f7 | 2009-04-08 21:14:34 +0000 | [diff] [blame] | 83 | def sse_load_f32 : ComplexPattern<v4f32, 5, "SelectScalarSSELoad", [], |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 84 | [SDNPHasChain, SDNPMayLoad]>; |
Rafael Espindola | bca99f7 | 2009-04-08 21:14:34 +0000 | [diff] [blame] | 85 | def sse_load_f64 : ComplexPattern<v2f64, 5, "SelectScalarSSELoad", [], |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 86 | [SDNPHasChain, SDNPMayLoad]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 87 | |
| 88 | def ssmem : Operand<v4f32> { |
| 89 | let PrintMethod = "printf32mem"; |
Dan Gohman | fe60682 | 2009-07-30 01:56:29 +0000 | [diff] [blame] | 90 | let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc_nosp, i32imm, i8imm); |
Daniel Dunbar | 0f10cbf | 2009-08-10 18:41:10 +0000 | [diff] [blame] | 91 | let ParserMatchClass = X86MemAsmOperand; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 92 | } |
| 93 | def sdmem : Operand<v2f64> { |
| 94 | let PrintMethod = "printf64mem"; |
Dan Gohman | fe60682 | 2009-07-30 01:56:29 +0000 | [diff] [blame] | 95 | let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc_nosp, i32imm, i8imm); |
Daniel Dunbar | 0f10cbf | 2009-08-10 18:41:10 +0000 | [diff] [blame] | 96 | let ParserMatchClass = X86MemAsmOperand; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 97 | } |
| 98 | |
| 99 | //===----------------------------------------------------------------------===// |
| 100 | // SSE pattern fragments |
| 101 | //===----------------------------------------------------------------------===// |
| 102 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 103 | def loadv4f32 : PatFrag<(ops node:$ptr), (v4f32 (load node:$ptr))>; |
| 104 | def loadv2f64 : PatFrag<(ops node:$ptr), (v2f64 (load node:$ptr))>; |
| 105 | def loadv4i32 : PatFrag<(ops node:$ptr), (v4i32 (load node:$ptr))>; |
| 106 | def loadv2i64 : PatFrag<(ops node:$ptr), (v2i64 (load node:$ptr))>; |
| 107 | |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 108 | // Like 'store', but always requires vector alignment. |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 109 | def alignedstore : PatFrag<(ops node:$val, node:$ptr), |
Dan Gohman | 2a17412 | 2008-10-15 06:50:19 +0000 | [diff] [blame] | 110 | (store node:$val, node:$ptr), [{ |
| 111 | return cast<StoreSDNode>(N)->getAlignment() >= 16; |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 112 | }]>; |
| 113 | |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 114 | // Like 'load', but always requires vector alignment. |
Dan Gohman | 2a17412 | 2008-10-15 06:50:19 +0000 | [diff] [blame] | 115 | def alignedload : PatFrag<(ops node:$ptr), (load node:$ptr), [{ |
| 116 | return cast<LoadSDNode>(N)->getAlignment() >= 16; |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 117 | }]>; |
| 118 | |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 119 | def alignedloadfsf32 : PatFrag<(ops node:$ptr), (f32 (alignedload node:$ptr))>; |
| 120 | def alignedloadfsf64 : PatFrag<(ops node:$ptr), (f64 (alignedload node:$ptr))>; |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 121 | def alignedloadv4f32 : PatFrag<(ops node:$ptr), (v4f32 (alignedload node:$ptr))>; |
| 122 | def alignedloadv2f64 : PatFrag<(ops node:$ptr), (v2f64 (alignedload node:$ptr))>; |
| 123 | def alignedloadv4i32 : PatFrag<(ops node:$ptr), (v4i32 (alignedload node:$ptr))>; |
| 124 | def alignedloadv2i64 : PatFrag<(ops node:$ptr), (v2i64 (alignedload node:$ptr))>; |
| 125 | |
| 126 | // Like 'load', but uses special alignment checks suitable for use in |
| 127 | // memory operands in most SSE instructions, which are required to |
| 128 | // be naturally aligned on some targets but not on others. |
| 129 | // FIXME: Actually implement support for targets that don't require the |
| 130 | // alignment. This probably wants a subtarget predicate. |
Dan Gohman | 2a17412 | 2008-10-15 06:50:19 +0000 | [diff] [blame] | 131 | def memop : PatFrag<(ops node:$ptr), (load node:$ptr), [{ |
| 132 | return cast<LoadSDNode>(N)->getAlignment() >= 16; |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 133 | }]>; |
| 134 | |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 135 | def memopfsf32 : PatFrag<(ops node:$ptr), (f32 (memop node:$ptr))>; |
| 136 | def memopfsf64 : PatFrag<(ops node:$ptr), (f64 (memop node:$ptr))>; |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 137 | def memopv4f32 : PatFrag<(ops node:$ptr), (v4f32 (memop node:$ptr))>; |
| 138 | def memopv2f64 : PatFrag<(ops node:$ptr), (v2f64 (memop node:$ptr))>; |
| 139 | def memopv4i32 : PatFrag<(ops node:$ptr), (v4i32 (memop node:$ptr))>; |
| 140 | def memopv2i64 : PatFrag<(ops node:$ptr), (v2i64 (memop node:$ptr))>; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 141 | def memopv16i8 : PatFrag<(ops node:$ptr), (v16i8 (memop node:$ptr))>; |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 142 | |
Bill Wendling | 3b15d72 | 2007-08-11 09:52:53 +0000 | [diff] [blame] | 143 | // SSSE3 uses MMX registers for some instructions. They aren't aligned on a |
| 144 | // 16-byte boundary. |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 145 | // FIXME: 8 byte alignment for mmx reads is not required |
Dan Gohman | 61efc5a | 2008-10-16 00:03:00 +0000 | [diff] [blame] | 146 | def memop64 : PatFrag<(ops node:$ptr), (load node:$ptr), [{ |
Dan Gohman | 2a17412 | 2008-10-15 06:50:19 +0000 | [diff] [blame] | 147 | return cast<LoadSDNode>(N)->getAlignment() >= 8; |
Bill Wendling | 3b15d72 | 2007-08-11 09:52:53 +0000 | [diff] [blame] | 148 | }]>; |
| 149 | |
| 150 | def memopv8i8 : PatFrag<(ops node:$ptr), (v8i8 (memop64 node:$ptr))>; |
Bill Wendling | 3b15d72 | 2007-08-11 09:52:53 +0000 | [diff] [blame] | 151 | def memopv4i16 : PatFrag<(ops node:$ptr), (v4i16 (memop64 node:$ptr))>; |
| 152 | def memopv8i16 : PatFrag<(ops node:$ptr), (v8i16 (memop64 node:$ptr))>; |
| 153 | def memopv2i32 : PatFrag<(ops node:$ptr), (v2i32 (memop64 node:$ptr))>; |
| 154 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 155 | def bc_v4f32 : PatFrag<(ops node:$in), (v4f32 (bitconvert node:$in))>; |
| 156 | def bc_v2f64 : PatFrag<(ops node:$in), (v2f64 (bitconvert node:$in))>; |
| 157 | def bc_v16i8 : PatFrag<(ops node:$in), (v16i8 (bitconvert node:$in))>; |
| 158 | def bc_v8i16 : PatFrag<(ops node:$in), (v8i16 (bitconvert node:$in))>; |
| 159 | def bc_v4i32 : PatFrag<(ops node:$in), (v4i32 (bitconvert node:$in))>; |
| 160 | def bc_v2i64 : PatFrag<(ops node:$in), (v2i64 (bitconvert node:$in))>; |
| 161 | |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 162 | def vzmovl_v2i64 : PatFrag<(ops node:$src), |
| 163 | (bitconvert (v2i64 (X86vzmovl |
| 164 | (v2i64 (scalar_to_vector (loadi64 node:$src))))))>; |
| 165 | def vzmovl_v4i32 : PatFrag<(ops node:$src), |
| 166 | (bitconvert (v4i32 (X86vzmovl |
| 167 | (v4i32 (scalar_to_vector (loadi32 node:$src))))))>; |
| 168 | |
| 169 | def vzload_v2i64 : PatFrag<(ops node:$src), |
| 170 | (bitconvert (v2i64 (X86vzload node:$src)))>; |
| 171 | |
| 172 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 173 | def fp32imm0 : PatLeaf<(f32 fpimm), [{ |
| 174 | return N->isExactlyValue(+0.0); |
| 175 | }]>; |
| 176 | |
| 177 | def PSxLDQ_imm : SDNodeXForm<imm, [{ |
| 178 | // Transformation function: imm >> 3 |
Dan Gohman | faeb4a3 | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 179 | return getI32Imm(N->getZExtValue() >> 3); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 180 | }]>; |
| 181 | |
| 182 | // SHUFFLE_get_shuf_imm xform function: convert vector_shuffle mask to PSHUF*, |
| 183 | // SHUFP* etc. imm. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 184 | def SHUFFLE_get_shuf_imm : SDNodeXForm<vector_shuffle, [{ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 185 | return getI8Imm(X86::getShuffleSHUFImmediate(N)); |
| 186 | }]>; |
| 187 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 188 | // SHUFFLE_get_pshufhw_imm xform function: convert vector_shuffle mask to |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 189 | // PSHUFHW imm. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 190 | def SHUFFLE_get_pshufhw_imm : SDNodeXForm<vector_shuffle, [{ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 191 | return getI8Imm(X86::getShufflePSHUFHWImmediate(N)); |
| 192 | }]>; |
| 193 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 194 | // SHUFFLE_get_pshuflw_imm xform function: convert vector_shuffle mask to |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 195 | // PSHUFLW imm. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 196 | def SHUFFLE_get_pshuflw_imm : SDNodeXForm<vector_shuffle, [{ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 197 | return getI8Imm(X86::getShufflePSHUFLWImmediate(N)); |
| 198 | }]>; |
| 199 | |
Nate Begeman | 080f8e2 | 2009-10-19 02:17:23 +0000 | [diff] [blame] | 200 | // SHUFFLE_get_palign_imm xform function: convert vector_shuffle mask to |
| 201 | // a PALIGNR imm. |
| 202 | def SHUFFLE_get_palign_imm : SDNodeXForm<vector_shuffle, [{ |
| 203 | return getI8Imm(X86::getShufflePALIGNRImmediate(N)); |
| 204 | }]>; |
| 205 | |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 206 | def splat_lo : PatFrag<(ops node:$lhs, node:$rhs), |
| 207 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 208 | ShuffleVectorSDNode *SVOp = cast<ShuffleVectorSDNode>(N); |
| 209 | return SVOp->isSplat() && SVOp->getSplatIndex() == 0; |
| 210 | }]>; |
| 211 | |
| 212 | def movddup : PatFrag<(ops node:$lhs, node:$rhs), |
| 213 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 214 | return X86::isMOVDDUPMask(cast<ShuffleVectorSDNode>(N)); |
| 215 | }]>; |
| 216 | |
| 217 | def movhlps : PatFrag<(ops node:$lhs, node:$rhs), |
| 218 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 219 | return X86::isMOVHLPSMask(cast<ShuffleVectorSDNode>(N)); |
| 220 | }]>; |
| 221 | |
| 222 | def movhlps_undef : PatFrag<(ops node:$lhs, node:$rhs), |
| 223 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 224 | return X86::isMOVHLPS_v_undef_Mask(cast<ShuffleVectorSDNode>(N)); |
| 225 | }]>; |
| 226 | |
| 227 | def movhp : PatFrag<(ops node:$lhs, node:$rhs), |
| 228 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 229 | return X86::isMOVHPMask(cast<ShuffleVectorSDNode>(N)); |
| 230 | }]>; |
| 231 | |
| 232 | def movlp : PatFrag<(ops node:$lhs, node:$rhs), |
| 233 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 234 | return X86::isMOVLPMask(cast<ShuffleVectorSDNode>(N)); |
| 235 | }]>; |
| 236 | |
| 237 | def movl : PatFrag<(ops node:$lhs, node:$rhs), |
| 238 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 239 | return X86::isMOVLMask(cast<ShuffleVectorSDNode>(N)); |
| 240 | }]>; |
| 241 | |
| 242 | def movshdup : PatFrag<(ops node:$lhs, node:$rhs), |
| 243 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 244 | return X86::isMOVSHDUPMask(cast<ShuffleVectorSDNode>(N)); |
| 245 | }]>; |
| 246 | |
| 247 | def movsldup : PatFrag<(ops node:$lhs, node:$rhs), |
| 248 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 249 | return X86::isMOVSLDUPMask(cast<ShuffleVectorSDNode>(N)); |
| 250 | }]>; |
| 251 | |
| 252 | def unpckl : PatFrag<(ops node:$lhs, node:$rhs), |
| 253 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 254 | return X86::isUNPCKLMask(cast<ShuffleVectorSDNode>(N)); |
| 255 | }]>; |
| 256 | |
| 257 | def unpckh : PatFrag<(ops node:$lhs, node:$rhs), |
| 258 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 259 | return X86::isUNPCKHMask(cast<ShuffleVectorSDNode>(N)); |
| 260 | }]>; |
| 261 | |
| 262 | def unpckl_undef : PatFrag<(ops node:$lhs, node:$rhs), |
| 263 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 264 | return X86::isUNPCKL_v_undef_Mask(cast<ShuffleVectorSDNode>(N)); |
| 265 | }]>; |
| 266 | |
| 267 | def unpckh_undef : PatFrag<(ops node:$lhs, node:$rhs), |
| 268 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 269 | return X86::isUNPCKH_v_undef_Mask(cast<ShuffleVectorSDNode>(N)); |
| 270 | }]>; |
| 271 | |
| 272 | def pshufd : PatFrag<(ops node:$lhs, node:$rhs), |
| 273 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 274 | return X86::isPSHUFDMask(cast<ShuffleVectorSDNode>(N)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 275 | }], SHUFFLE_get_shuf_imm>; |
| 276 | |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 277 | def shufp : PatFrag<(ops node:$lhs, node:$rhs), |
| 278 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 279 | return X86::isSHUFPMask(cast<ShuffleVectorSDNode>(N)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 280 | }], SHUFFLE_get_shuf_imm>; |
| 281 | |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 282 | def pshufhw : PatFrag<(ops node:$lhs, node:$rhs), |
| 283 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 284 | return X86::isPSHUFHWMask(cast<ShuffleVectorSDNode>(N)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 285 | }], SHUFFLE_get_pshufhw_imm>; |
| 286 | |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 287 | def pshuflw : PatFrag<(ops node:$lhs, node:$rhs), |
| 288 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 289 | return X86::isPSHUFLWMask(cast<ShuffleVectorSDNode>(N)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 290 | }], SHUFFLE_get_pshuflw_imm>; |
| 291 | |
Nate Begeman | 080f8e2 | 2009-10-19 02:17:23 +0000 | [diff] [blame] | 292 | def palign : PatFrag<(ops node:$lhs, node:$rhs), |
| 293 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 294 | return X86::isPALIGNRMask(cast<ShuffleVectorSDNode>(N)); |
| 295 | }], SHUFFLE_get_palign_imm>; |
| 296 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 297 | //===----------------------------------------------------------------------===// |
| 298 | // SSE scalar FP Instructions |
| 299 | //===----------------------------------------------------------------------===// |
| 300 | |
| 301 | // CMOV* - Used to implement the SSE SELECT DAG operation. Expanded by the |
| 302 | // scheduler into a branch sequence. |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 303 | // These are expanded by the scheduler. |
| 304 | let Uses = [EFLAGS], usesCustomDAGSchedInserter = 1 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 305 | def CMOV_FR32 : I<0, Pseudo, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 306 | (outs FR32:$dst), (ins FR32:$t, FR32:$f, i8imm:$cond), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 307 | "#CMOV_FR32 PSEUDO!", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 308 | [(set FR32:$dst, (X86cmov FR32:$t, FR32:$f, imm:$cond, |
| 309 | EFLAGS))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 310 | def CMOV_FR64 : I<0, Pseudo, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 311 | (outs FR64:$dst), (ins FR64:$t, FR64:$f, i8imm:$cond), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 312 | "#CMOV_FR64 PSEUDO!", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 313 | [(set FR64:$dst, (X86cmov FR64:$t, FR64:$f, imm:$cond, |
| 314 | EFLAGS))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 315 | def CMOV_V4F32 : I<0, Pseudo, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 316 | (outs VR128:$dst), (ins VR128:$t, VR128:$f, i8imm:$cond), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 317 | "#CMOV_V4F32 PSEUDO!", |
| 318 | [(set VR128:$dst, |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 319 | (v4f32 (X86cmov VR128:$t, VR128:$f, imm:$cond, |
| 320 | EFLAGS)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 321 | def CMOV_V2F64 : I<0, Pseudo, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 322 | (outs VR128:$dst), (ins VR128:$t, VR128:$f, i8imm:$cond), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 323 | "#CMOV_V2F64 PSEUDO!", |
| 324 | [(set VR128:$dst, |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 325 | (v2f64 (X86cmov VR128:$t, VR128:$f, imm:$cond, |
| 326 | EFLAGS)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 327 | def CMOV_V2I64 : I<0, Pseudo, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 328 | (outs VR128:$dst), (ins VR128:$t, VR128:$f, i8imm:$cond), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 329 | "#CMOV_V2I64 PSEUDO!", |
| 330 | [(set VR128:$dst, |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 331 | (v2i64 (X86cmov VR128:$t, VR128:$f, imm:$cond, |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 332 | EFLAGS)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 333 | } |
| 334 | |
| 335 | //===----------------------------------------------------------------------===// |
| 336 | // SSE1 Instructions |
| 337 | //===----------------------------------------------------------------------===// |
| 338 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 339 | // Move Instructions |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 340 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 341 | def MOVSSrr : SSI<0x10, MRMSrcReg, (outs FR32:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 342 | "movss\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 343 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 344 | def MOVSSrm : SSI<0x10, MRMSrcMem, (outs FR32:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 345 | "movss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 346 | [(set FR32:$dst, (loadf32 addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 347 | def MOVSSmr : SSI<0x11, MRMDestMem, (outs), (ins f32mem:$dst, FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 348 | "movss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 349 | [(store FR32:$src, addr:$dst)]>; |
| 350 | |
| 351 | // Conversion instructions |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 352 | def CVTTSS2SIrr : SSI<0x2C, MRMSrcReg, (outs GR32:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 353 | "cvttss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 354 | [(set GR32:$dst, (fp_to_sint FR32:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 355 | def CVTTSS2SIrm : SSI<0x2C, MRMSrcMem, (outs GR32:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 356 | "cvttss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 357 | [(set GR32:$dst, (fp_to_sint (loadf32 addr:$src)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 358 | def CVTSI2SSrr : SSI<0x2A, MRMSrcReg, (outs FR32:$dst), (ins GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 359 | "cvtsi2ss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 360 | [(set FR32:$dst, (sint_to_fp GR32:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 361 | def CVTSI2SSrm : SSI<0x2A, MRMSrcMem, (outs FR32:$dst), (ins i32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 362 | "cvtsi2ss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 363 | [(set FR32:$dst, (sint_to_fp (loadi32 addr:$src)))]>; |
| 364 | |
| 365 | // Match intrinsics which expect XMM operand(s). |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 366 | def Int_CVTSS2SIrr : SSI<0x2D, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 367 | "cvtss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 368 | [(set GR32:$dst, (int_x86_sse_cvtss2si VR128:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 369 | def Int_CVTSS2SIrm : SSI<0x2D, MRMSrcMem, (outs GR32:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 370 | "cvtss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 371 | [(set GR32:$dst, (int_x86_sse_cvtss2si |
| 372 | (load addr:$src)))]>; |
| 373 | |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 374 | // Match intrinisics which expect MM and XMM operand(s). |
| 375 | def Int_CVTPS2PIrr : PSI<0x2D, MRMSrcReg, (outs VR64:$dst), (ins VR128:$src), |
| 376 | "cvtps2pi\t{$src, $dst|$dst, $src}", |
| 377 | [(set VR64:$dst, (int_x86_sse_cvtps2pi VR128:$src))]>; |
| 378 | def Int_CVTPS2PIrm : PSI<0x2D, MRMSrcMem, (outs VR64:$dst), (ins f64mem:$src), |
| 379 | "cvtps2pi\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 380 | [(set VR64:$dst, (int_x86_sse_cvtps2pi |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 381 | (load addr:$src)))]>; |
| 382 | def Int_CVTTPS2PIrr: PSI<0x2C, MRMSrcReg, (outs VR64:$dst), (ins VR128:$src), |
| 383 | "cvttps2pi\t{$src, $dst|$dst, $src}", |
| 384 | [(set VR64:$dst, (int_x86_sse_cvttps2pi VR128:$src))]>; |
| 385 | def Int_CVTTPS2PIrm: PSI<0x2C, MRMSrcMem, (outs VR64:$dst), (ins f64mem:$src), |
| 386 | "cvttps2pi\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 387 | [(set VR64:$dst, (int_x86_sse_cvttps2pi |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 388 | (load addr:$src)))]>; |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 389 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 390 | def Int_CVTPI2PSrr : PSI<0x2A, MRMSrcReg, |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 391 | (outs VR128:$dst), (ins VR128:$src1, VR64:$src2), |
| 392 | "cvtpi2ps\t{$src2, $dst|$dst, $src2}", |
| 393 | [(set VR128:$dst, (int_x86_sse_cvtpi2ps VR128:$src1, |
| 394 | VR64:$src2))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 395 | def Int_CVTPI2PSrm : PSI<0x2A, MRMSrcMem, |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 396 | (outs VR128:$dst), (ins VR128:$src1, i64mem:$src2), |
| 397 | "cvtpi2ps\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 398 | [(set VR128:$dst, (int_x86_sse_cvtpi2ps VR128:$src1, |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 399 | (load addr:$src2)))]>; |
| 400 | } |
| 401 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 402 | // Aliases for intrinsics |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 403 | def Int_CVTTSS2SIrr : SSI<0x2C, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 404 | "cvttss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 405 | [(set GR32:$dst, |
| 406 | (int_x86_sse_cvttss2si VR128:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 407 | def Int_CVTTSS2SIrm : SSI<0x2C, MRMSrcMem, (outs GR32:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 408 | "cvttss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 409 | [(set GR32:$dst, |
| 410 | (int_x86_sse_cvttss2si(load addr:$src)))]>; |
| 411 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 412 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 413 | def Int_CVTSI2SSrr : SSI<0x2A, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 414 | (outs VR128:$dst), (ins VR128:$src1, GR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 415 | "cvtsi2ss\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 416 | [(set VR128:$dst, (int_x86_sse_cvtsi2ss VR128:$src1, |
| 417 | GR32:$src2))]>; |
| 418 | def Int_CVTSI2SSrm : SSI<0x2A, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 419 | (outs VR128:$dst), (ins VR128:$src1, i32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 420 | "cvtsi2ss\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 421 | [(set VR128:$dst, (int_x86_sse_cvtsi2ss VR128:$src1, |
| 422 | (loadi32 addr:$src2)))]>; |
| 423 | } |
| 424 | |
| 425 | // Comparison instructions |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 426 | let Constraints = "$src1 = $dst", neverHasSideEffects = 1 in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 427 | def CMPSSrr : SSIi8<0xC2, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 428 | (outs FR32:$dst), (ins FR32:$src1, FR32:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 429 | "cmp${cc}ss\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 430 | let mayLoad = 1 in |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 431 | def CMPSSrm : SSIi8<0xC2, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 432 | (outs FR32:$dst), (ins FR32:$src1, f32mem:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 433 | "cmp${cc}ss\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 434 | } |
| 435 | |
Evan Cheng | 5568707 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 436 | let Defs = [EFLAGS] in { |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 437 | def UCOMISSrr: PSI<0x2E, MRMSrcReg, (outs), (ins FR32:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 438 | "ucomiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 439 | [(X86cmp FR32:$src1, FR32:$src2), (implicit EFLAGS)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 440 | def UCOMISSrm: PSI<0x2E, MRMSrcMem, (outs), (ins FR32:$src1, f32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 441 | "ucomiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 442 | [(X86cmp FR32:$src1, (loadf32 addr:$src2)), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 443 | (implicit EFLAGS)]>; |
Evan Cheng | 5568707 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 444 | } // Defs = [EFLAGS] |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 445 | |
| 446 | // Aliases to match intrinsics which expect XMM operand(s). |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 447 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 448 | def Int_CMPSSrr : SSIi8<0xC2, MRMSrcReg, |
| 449 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src, |
| 450 | SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 451 | "cmp${cc}ss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 452 | [(set VR128:$dst, (int_x86_sse_cmp_ss VR128:$src1, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 453 | VR128:$src, imm:$cc))]>; |
| 454 | def Int_CMPSSrm : SSIi8<0xC2, MRMSrcMem, |
| 455 | (outs VR128:$dst), (ins VR128:$src1, f32mem:$src, |
| 456 | SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 457 | "cmp${cc}ss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 458 | [(set VR128:$dst, (int_x86_sse_cmp_ss VR128:$src1, |
| 459 | (load addr:$src), imm:$cc))]>; |
| 460 | } |
| 461 | |
Evan Cheng | 5568707 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 462 | let Defs = [EFLAGS] in { |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 463 | def Int_UCOMISSrr: PSI<0x2E, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 464 | "ucomiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 465 | [(X86ucomi (v4f32 VR128:$src1), VR128:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 466 | (implicit EFLAGS)]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 467 | def Int_UCOMISSrm: PSI<0x2E, MRMSrcMem, (outs),(ins VR128:$src1, f128mem:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 468 | "ucomiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 469 | [(X86ucomi (v4f32 VR128:$src1), (load addr:$src2)), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 470 | (implicit EFLAGS)]>; |
| 471 | |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 472 | def Int_COMISSrr: PSI<0x2F, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 473 | "comiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 474 | [(X86comi (v4f32 VR128:$src1), VR128:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 475 | (implicit EFLAGS)]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 476 | def Int_COMISSrm: PSI<0x2F, MRMSrcMem, (outs), (ins VR128:$src1, f128mem:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 477 | "comiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 478 | [(X86comi (v4f32 VR128:$src1), (load addr:$src2)), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 479 | (implicit EFLAGS)]>; |
Evan Cheng | 5568707 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 480 | } // Defs = [EFLAGS] |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 481 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 482 | // Aliases of packed SSE1 instructions for scalar use. These all have names |
| 483 | // that start with 'Fs'. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 484 | |
| 485 | // Alias instructions that map fld0 to pxor for sse. |
Dan Gohman | 51dbce6 | 2009-09-21 18:30:38 +0000 | [diff] [blame] | 486 | let isReMaterializable = 1, isAsCheapAsAMove = 1, isCodeGenOnly = 1, |
| 487 | canFoldAsLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 488 | def FsFLD0SS : I<0xEF, MRMInitReg, (outs FR32:$dst), (ins), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 489 | "pxor\t$dst, $dst", [(set FR32:$dst, fp32imm0)]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 490 | Requires<[HasSSE1]>, TB, OpSize; |
| 491 | |
| 492 | // Alias instruction to do FR32 reg-to-reg copy using movaps. Upper bits are |
| 493 | // disregarded. |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 494 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 495 | def FsMOVAPSrr : PSI<0x28, MRMSrcReg, (outs FR32:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 496 | "movaps\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 497 | |
| 498 | // Alias instruction to load FR32 from f128mem using movaps. Upper bits are |
| 499 | // disregarded. |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 500 | let canFoldAsLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 501 | def FsMOVAPSrm : PSI<0x28, MRMSrcMem, (outs FR32:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 502 | "movaps\t{$src, $dst|$dst, $src}", |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 503 | [(set FR32:$dst, (alignedloadfsf32 addr:$src))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 504 | |
| 505 | // Alias bitwise logical operations using SSE logical ops on packed FP values. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 506 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 507 | let isCommutable = 1 in { |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 508 | def FsANDPSrr : PSI<0x54, MRMSrcReg, (outs FR32:$dst), |
| 509 | (ins FR32:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 510 | "andps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 511 | [(set FR32:$dst, (X86fand FR32:$src1, FR32:$src2))]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 512 | def FsORPSrr : PSI<0x56, MRMSrcReg, (outs FR32:$dst), |
| 513 | (ins FR32:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 514 | "orps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 515 | [(set FR32:$dst, (X86for FR32:$src1, FR32:$src2))]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 516 | def FsXORPSrr : PSI<0x57, MRMSrcReg, (outs FR32:$dst), |
| 517 | (ins FR32:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 518 | "xorps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 519 | [(set FR32:$dst, (X86fxor FR32:$src1, FR32:$src2))]>; |
| 520 | } |
| 521 | |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 522 | def FsANDPSrm : PSI<0x54, MRMSrcMem, (outs FR32:$dst), |
| 523 | (ins FR32:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 524 | "andps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 525 | [(set FR32:$dst, (X86fand FR32:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 526 | (memopfsf32 addr:$src2)))]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 527 | def FsORPSrm : PSI<0x56, MRMSrcMem, (outs FR32:$dst), |
| 528 | (ins FR32:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 529 | "orps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 530 | [(set FR32:$dst, (X86for FR32:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 531 | (memopfsf32 addr:$src2)))]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 532 | def FsXORPSrm : PSI<0x57, MRMSrcMem, (outs FR32:$dst), |
| 533 | (ins FR32:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 534 | "xorps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 535 | [(set FR32:$dst, (X86fxor FR32:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 536 | (memopfsf32 addr:$src2)))]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 537 | |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 538 | let neverHasSideEffects = 1 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 539 | def FsANDNPSrr : PSI<0x55, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 540 | (outs FR32:$dst), (ins FR32:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 541 | "andnps\t{$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 542 | let mayLoad = 1 in |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 543 | def FsANDNPSrm : PSI<0x55, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 544 | (outs FR32:$dst), (ins FR32:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 545 | "andnps\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 546 | } |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 547 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 548 | |
| 549 | /// basic_sse1_fp_binop_rm - SSE1 binops come in both scalar and vector forms. |
| 550 | /// |
| 551 | /// In addition, we also have a special variant of the scalar form here to |
| 552 | /// represent the associated intrinsic operation. This form is unlike the |
| 553 | /// plain scalar form, in that it takes an entire vector (instead of a scalar) |
Evan Cheng | 5d5dbbc | 2009-02-26 03:12:02 +0000 | [diff] [blame] | 554 | /// and leaves the top elements unmodified (therefore these cannot be commuted). |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 555 | /// |
| 556 | /// These three forms can each be reg+reg or reg+mem, so there are a total of |
| 557 | /// six "instructions". |
| 558 | /// |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 559 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 560 | multiclass basic_sse1_fp_binop_rm<bits<8> opc, string OpcodeStr, |
| 561 | SDNode OpNode, Intrinsic F32Int, |
| 562 | bit Commutable = 0> { |
| 563 | // Scalar operation, reg+reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 564 | def SSrr : SSI<opc, MRMSrcReg, (outs FR32:$dst), (ins FR32:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 565 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 566 | [(set FR32:$dst, (OpNode FR32:$src1, FR32:$src2))]> { |
| 567 | let isCommutable = Commutable; |
| 568 | } |
| 569 | |
| 570 | // Scalar operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 571 | def SSrm : SSI<opc, MRMSrcMem, (outs FR32:$dst), |
| 572 | (ins FR32:$src1, f32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 573 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 574 | [(set FR32:$dst, (OpNode FR32:$src1, (load addr:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 575 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 576 | // Vector operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 577 | def PSrr : PSI<opc, MRMSrcReg, (outs VR128:$dst), |
| 578 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 579 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 580 | [(set VR128:$dst, (v4f32 (OpNode VR128:$src1, VR128:$src2)))]> { |
| 581 | let isCommutable = Commutable; |
| 582 | } |
| 583 | |
| 584 | // Vector operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 585 | def PSrm : PSI<opc, MRMSrcMem, (outs VR128:$dst), |
| 586 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 587 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 588 | [(set VR128:$dst, (OpNode VR128:$src1, (memopv4f32 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 589 | |
| 590 | // Intrinsic operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 591 | def SSrr_Int : SSI<opc, MRMSrcReg, (outs VR128:$dst), |
| 592 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 593 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 5d5dbbc | 2009-02-26 03:12:02 +0000 | [diff] [blame] | 594 | [(set VR128:$dst, (F32Int VR128:$src1, VR128:$src2))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 595 | |
| 596 | // Intrinsic operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 597 | def SSrm_Int : SSI<opc, MRMSrcMem, (outs VR128:$dst), |
| 598 | (ins VR128:$src1, ssmem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 599 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 600 | [(set VR128:$dst, (F32Int VR128:$src1, |
| 601 | sse_load_f32:$src2))]>; |
| 602 | } |
| 603 | } |
| 604 | |
| 605 | // Arithmetic instructions |
| 606 | defm ADD : basic_sse1_fp_binop_rm<0x58, "add", fadd, int_x86_sse_add_ss, 1>; |
| 607 | defm MUL : basic_sse1_fp_binop_rm<0x59, "mul", fmul, int_x86_sse_mul_ss, 1>; |
| 608 | defm SUB : basic_sse1_fp_binop_rm<0x5C, "sub", fsub, int_x86_sse_sub_ss>; |
| 609 | defm DIV : basic_sse1_fp_binop_rm<0x5E, "div", fdiv, int_x86_sse_div_ss>; |
| 610 | |
| 611 | /// sse1_fp_binop_rm - Other SSE1 binops |
| 612 | /// |
| 613 | /// This multiclass is like basic_sse1_fp_binop_rm, with the addition of |
| 614 | /// instructions for a full-vector intrinsic form. Operations that map |
| 615 | /// onto C operators don't use this form since they just use the plain |
| 616 | /// vector form instead of having a separate vector intrinsic form. |
| 617 | /// |
| 618 | /// This provides a total of eight "instructions". |
| 619 | /// |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 620 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 621 | multiclass sse1_fp_binop_rm<bits<8> opc, string OpcodeStr, |
| 622 | SDNode OpNode, |
| 623 | Intrinsic F32Int, |
| 624 | Intrinsic V4F32Int, |
| 625 | bit Commutable = 0> { |
| 626 | |
| 627 | // Scalar operation, reg+reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 628 | def SSrr : SSI<opc, MRMSrcReg, (outs FR32:$dst), (ins FR32:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 629 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 630 | [(set FR32:$dst, (OpNode FR32:$src1, FR32:$src2))]> { |
| 631 | let isCommutable = Commutable; |
| 632 | } |
| 633 | |
| 634 | // Scalar operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 635 | def SSrm : SSI<opc, MRMSrcMem, (outs FR32:$dst), |
| 636 | (ins FR32:$src1, f32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 637 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 638 | [(set FR32:$dst, (OpNode FR32:$src1, (load addr:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 639 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 640 | // Vector operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 641 | def PSrr : PSI<opc, MRMSrcReg, (outs VR128:$dst), |
| 642 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 643 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 644 | [(set VR128:$dst, (v4f32 (OpNode VR128:$src1, VR128:$src2)))]> { |
| 645 | let isCommutable = Commutable; |
| 646 | } |
| 647 | |
| 648 | // Vector operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 649 | def PSrm : PSI<opc, MRMSrcMem, (outs VR128:$dst), |
| 650 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 651 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 652 | [(set VR128:$dst, (OpNode VR128:$src1, (memopv4f32 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 653 | |
| 654 | // Intrinsic operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 655 | def SSrr_Int : SSI<opc, MRMSrcReg, (outs VR128:$dst), |
| 656 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 657 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 658 | [(set VR128:$dst, (F32Int VR128:$src1, VR128:$src2))]> { |
| 659 | let isCommutable = Commutable; |
| 660 | } |
| 661 | |
| 662 | // Intrinsic operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 663 | def SSrm_Int : SSI<opc, MRMSrcMem, (outs VR128:$dst), |
| 664 | (ins VR128:$src1, ssmem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 665 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 666 | [(set VR128:$dst, (F32Int VR128:$src1, |
| 667 | sse_load_f32:$src2))]>; |
| 668 | |
| 669 | // Vector intrinsic operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 670 | def PSrr_Int : PSI<opc, MRMSrcReg, (outs VR128:$dst), |
| 671 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 672 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 673 | [(set VR128:$dst, (V4F32Int VR128:$src1, VR128:$src2))]> { |
| 674 | let isCommutable = Commutable; |
| 675 | } |
| 676 | |
| 677 | // Vector intrinsic operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 678 | def PSrm_Int : PSI<opc, MRMSrcMem, (outs VR128:$dst), |
| 679 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 680 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 681 | [(set VR128:$dst, (V4F32Int VR128:$src1, (memopv4f32 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 682 | } |
| 683 | } |
| 684 | |
| 685 | defm MAX : sse1_fp_binop_rm<0x5F, "max", X86fmax, |
| 686 | int_x86_sse_max_ss, int_x86_sse_max_ps>; |
| 687 | defm MIN : sse1_fp_binop_rm<0x5D, "min", X86fmin, |
| 688 | int_x86_sse_min_ss, int_x86_sse_min_ps>; |
| 689 | |
| 690 | //===----------------------------------------------------------------------===// |
| 691 | // SSE packed FP Instructions |
| 692 | |
| 693 | // Move Instructions |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 694 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 695 | def MOVAPSrr : PSI<0x28, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 696 | "movaps\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 697 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 698 | def MOVAPSrm : PSI<0x28, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 699 | "movaps\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 700 | [(set VR128:$dst, (alignedloadv4f32 addr:$src))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 701 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 702 | def MOVAPSmr : PSI<0x29, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 703 | "movaps\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 704 | [(alignedstore (v4f32 VR128:$src), addr:$dst)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 705 | |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 706 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 707 | def MOVUPSrr : PSI<0x10, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 708 | "movups\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 709 | let canFoldAsLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 710 | def MOVUPSrm : PSI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 711 | "movups\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 712 | [(set VR128:$dst, (loadv4f32 addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 713 | def MOVUPSmr : PSI<0x11, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 714 | "movups\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 715 | [(store (v4f32 VR128:$src), addr:$dst)]>; |
| 716 | |
| 717 | // Intrinsic forms of MOVUPS load and store |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 718 | let canFoldAsLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 719 | def MOVUPSrm_Int : PSI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 720 | "movups\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 721 | [(set VR128:$dst, (int_x86_sse_loadu_ps addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 722 | def MOVUPSmr_Int : PSI<0x11, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 723 | "movups\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 724 | [(int_x86_sse_storeu_ps addr:$dst, VR128:$src)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 725 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 726 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 727 | let AddedComplexity = 20 in { |
| 728 | def MOVLPSrm : PSI<0x12, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 729 | (outs VR128:$dst), (ins VR128:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 730 | "movlps\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 731 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 732 | (movlp VR128:$src1, |
| 733 | (bc_v4f32 (v2f64 (scalar_to_vector (loadf64 addr:$src2))))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 734 | def MOVHPSrm : PSI<0x16, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 735 | (outs VR128:$dst), (ins VR128:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 736 | "movhps\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 737 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 738 | (movhp VR128:$src1, |
| 739 | (bc_v4f32 (v2f64 (scalar_to_vector (loadf64 addr:$src2))))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 740 | } // AddedComplexity |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 741 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 742 | |
Evan Cheng | d743a5f | 2008-05-10 00:59:18 +0000 | [diff] [blame] | 743 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 744 | def MOVLPSmr : PSI<0x13, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 745 | "movlps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 746 | [(store (f64 (vector_extract (bc_v2f64 (v4f32 VR128:$src)), |
| 747 | (iPTR 0))), addr:$dst)]>; |
| 748 | |
| 749 | // v2f64 extract element 1 is always custom lowered to unpack high to low |
| 750 | // and extract element 0 so the non-store version isn't too horrible. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 751 | def MOVHPSmr : PSI<0x17, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 752 | "movhps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 753 | [(store (f64 (vector_extract |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 754 | (unpckh (bc_v2f64 (v4f32 VR128:$src)), |
| 755 | (undef)), (iPTR 0))), addr:$dst)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 756 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 757 | let Constraints = "$src1 = $dst" in { |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 758 | let AddedComplexity = 20 in { |
Evan Cheng | 7581a82 | 2009-05-12 20:17:52 +0000 | [diff] [blame] | 759 | def MOVLHPSrr : PSI<0x16, MRMSrcReg, (outs VR128:$dst), |
| 760 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 761 | "movlhps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 762 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 763 | (v4f32 (movhp VR128:$src1, VR128:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 764 | |
Evan Cheng | 7581a82 | 2009-05-12 20:17:52 +0000 | [diff] [blame] | 765 | def MOVHLPSrr : PSI<0x12, MRMSrcReg, (outs VR128:$dst), |
| 766 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 767 | "movhlps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 768 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 769 | (v4f32 (movhlps VR128:$src1, VR128:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 770 | } // AddedComplexity |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 771 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 772 | |
Nate Begeman | b44aad7 | 2009-04-29 22:47:44 +0000 | [diff] [blame] | 773 | let AddedComplexity = 20 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 774 | def : Pat<(v4f32 (movddup VR128:$src, (undef))), |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 775 | (MOVLHPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>; |
Nate Begeman | b44aad7 | 2009-04-29 22:47:44 +0000 | [diff] [blame] | 776 | def : Pat<(v2i64 (movddup VR128:$src, (undef))), |
| 777 | (MOVLHPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>; |
| 778 | } |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 779 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 780 | |
| 781 | |
| 782 | // Arithmetic |
| 783 | |
| 784 | /// sse1_fp_unop_rm - SSE1 unops come in both scalar and vector forms. |
| 785 | /// |
| 786 | /// In addition, we also have a special variant of the scalar form here to |
| 787 | /// represent the associated intrinsic operation. This form is unlike the |
| 788 | /// plain scalar form, in that it takes an entire vector (instead of a |
| 789 | /// scalar) and leaves the top elements undefined. |
| 790 | /// |
| 791 | /// And, we have a special variant form for a full-vector intrinsic form. |
| 792 | /// |
| 793 | /// These four forms can each have a reg or a mem operand, so there are a |
| 794 | /// total of eight "instructions". |
| 795 | /// |
| 796 | multiclass sse1_fp_unop_rm<bits<8> opc, string OpcodeStr, |
| 797 | SDNode OpNode, |
| 798 | Intrinsic F32Int, |
| 799 | Intrinsic V4F32Int, |
| 800 | bit Commutable = 0> { |
| 801 | // Scalar operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 802 | def SSr : SSI<opc, MRMSrcReg, (outs FR32:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 803 | !strconcat(OpcodeStr, "ss\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 804 | [(set FR32:$dst, (OpNode FR32:$src))]> { |
| 805 | let isCommutable = Commutable; |
| 806 | } |
| 807 | |
| 808 | // Scalar operation, mem. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 809 | def SSm : SSI<opc, MRMSrcMem, (outs FR32:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 810 | !strconcat(OpcodeStr, "ss\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 811 | [(set FR32:$dst, (OpNode (load addr:$src)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 812 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 813 | // Vector operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 814 | def PSr : PSI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 815 | !strconcat(OpcodeStr, "ps\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 816 | [(set VR128:$dst, (v4f32 (OpNode VR128:$src)))]> { |
| 817 | let isCommutable = Commutable; |
| 818 | } |
| 819 | |
| 820 | // Vector operation, mem. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 821 | def PSm : PSI<opc, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 822 | !strconcat(OpcodeStr, "ps\t{$src, $dst|$dst, $src}"), |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 823 | [(set VR128:$dst, (OpNode (memopv4f32 addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 824 | |
| 825 | // Intrinsic operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 826 | def SSr_Int : SSI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 827 | !strconcat(OpcodeStr, "ss\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 828 | [(set VR128:$dst, (F32Int VR128:$src))]> { |
| 829 | let isCommutable = Commutable; |
| 830 | } |
| 831 | |
| 832 | // Intrinsic operation, mem. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 833 | def SSm_Int : SSI<opc, MRMSrcMem, (outs VR128:$dst), (ins ssmem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 834 | !strconcat(OpcodeStr, "ss\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 835 | [(set VR128:$dst, (F32Int sse_load_f32:$src))]>; |
| 836 | |
| 837 | // Vector intrinsic operation, reg |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 838 | def PSr_Int : PSI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 839 | !strconcat(OpcodeStr, "ps\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 840 | [(set VR128:$dst, (V4F32Int VR128:$src))]> { |
| 841 | let isCommutable = Commutable; |
| 842 | } |
| 843 | |
| 844 | // Vector intrinsic operation, mem |
Dan Gohman | c747be5 | 2007-08-02 21:06:40 +0000 | [diff] [blame] | 845 | def PSm_Int : PSI<opc, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 846 | !strconcat(OpcodeStr, "ps\t{$src, $dst|$dst, $src}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 847 | [(set VR128:$dst, (V4F32Int (memopv4f32 addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 848 | } |
| 849 | |
| 850 | // Square root. |
| 851 | defm SQRT : sse1_fp_unop_rm<0x51, "sqrt", fsqrt, |
| 852 | int_x86_sse_sqrt_ss, int_x86_sse_sqrt_ps>; |
| 853 | |
| 854 | // Reciprocal approximations. Note that these typically require refinement |
| 855 | // in order to obtain suitable precision. |
| 856 | defm RSQRT : sse1_fp_unop_rm<0x52, "rsqrt", X86frsqrt, |
| 857 | int_x86_sse_rsqrt_ss, int_x86_sse_rsqrt_ps>; |
| 858 | defm RCP : sse1_fp_unop_rm<0x53, "rcp", X86frcp, |
| 859 | int_x86_sse_rcp_ss, int_x86_sse_rcp_ps>; |
| 860 | |
| 861 | // Logical |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 862 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 863 | let isCommutable = 1 in { |
| 864 | def ANDPSrr : PSI<0x54, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 865 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 866 | "andps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 867 | [(set VR128:$dst, (v2i64 |
| 868 | (and VR128:$src1, VR128:$src2)))]>; |
| 869 | def ORPSrr : PSI<0x56, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 870 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 871 | "orps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 872 | [(set VR128:$dst, (v2i64 |
| 873 | (or VR128:$src1, VR128:$src2)))]>; |
| 874 | def XORPSrr : PSI<0x57, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 875 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 876 | "xorps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 877 | [(set VR128:$dst, (v2i64 |
| 878 | (xor VR128:$src1, VR128:$src2)))]>; |
| 879 | } |
| 880 | |
| 881 | def ANDPSrm : PSI<0x54, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 882 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 883 | "andps\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 884 | [(set VR128:$dst, (and (bc_v2i64 (v4f32 VR128:$src1)), |
| 885 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 886 | def ORPSrm : PSI<0x56, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 887 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 888 | "orps\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 889 | [(set VR128:$dst, (or (bc_v2i64 (v4f32 VR128:$src1)), |
| 890 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 891 | def XORPSrm : PSI<0x57, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 892 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 893 | "xorps\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 894 | [(set VR128:$dst, (xor (bc_v2i64 (v4f32 VR128:$src1)), |
| 895 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 896 | def ANDNPSrr : PSI<0x55, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 897 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 898 | "andnps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 899 | [(set VR128:$dst, |
| 900 | (v2i64 (and (xor VR128:$src1, |
| 901 | (bc_v2i64 (v4i32 immAllOnesV))), |
| 902 | VR128:$src2)))]>; |
| 903 | def ANDNPSrm : PSI<0x55, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 904 | (outs VR128:$dst), (ins VR128:$src1,f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 905 | "andnps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 906 | [(set VR128:$dst, |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 907 | (v2i64 (and (xor (bc_v2i64 (v4f32 VR128:$src1)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 908 | (bc_v2i64 (v4i32 immAllOnesV))), |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 909 | (memopv2i64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 910 | } |
| 911 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 912 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 913 | def CMPPSrri : PSIi8<0xC2, MRMSrcReg, |
Nate Begeman | 061db5f | 2008-05-12 20:34:32 +0000 | [diff] [blame] | 914 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src, SSECC:$cc), |
| 915 | "cmp${cc}ps\t{$src, $dst|$dst, $src}", |
| 916 | [(set VR128:$dst, (int_x86_sse_cmp_ps VR128:$src1, |
| 917 | VR128:$src, imm:$cc))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 918 | def CMPPSrmi : PSIi8<0xC2, MRMSrcMem, |
Nate Begeman | 061db5f | 2008-05-12 20:34:32 +0000 | [diff] [blame] | 919 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src, SSECC:$cc), |
| 920 | "cmp${cc}ps\t{$src, $dst|$dst, $src}", |
| 921 | [(set VR128:$dst, (int_x86_sse_cmp_ps VR128:$src1, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 922 | (memop addr:$src), imm:$cc))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 923 | } |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 924 | def : Pat<(v4i32 (X86cmpps (v4f32 VR128:$src1), VR128:$src2, imm:$cc)), |
| 925 | (CMPPSrri VR128:$src1, VR128:$src2, imm:$cc)>; |
| 926 | def : Pat<(v4i32 (X86cmpps (v4f32 VR128:$src1), (memop addr:$src2), imm:$cc)), |
| 927 | (CMPPSrmi VR128:$src1, addr:$src2, imm:$cc)>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 928 | |
| 929 | // Shuffle and unpack instructions |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 930 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 931 | let isConvertibleToThreeAddress = 1 in // Convert to pshufd |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 932 | def SHUFPSrri : PSIi8<0xC6, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 933 | (outs VR128:$dst), (ins VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 934 | VR128:$src2, i8imm:$src3), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 935 | "shufps\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 936 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 937 | (v4f32 (shufp:$src3 VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 938 | def SHUFPSrmi : PSIi8<0xC6, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 939 | (outs VR128:$dst), (ins VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 940 | f128mem:$src2, i8imm:$src3), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 941 | "shufps\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 942 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 943 | (v4f32 (shufp:$src3 |
| 944 | VR128:$src1, (memopv4f32 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 945 | |
| 946 | let AddedComplexity = 10 in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 947 | def UNPCKHPSrr : PSI<0x15, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 948 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 949 | "unpckhps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 950 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 951 | (v4f32 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 952 | def UNPCKHPSrm : PSI<0x15, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 953 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 954 | "unpckhps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 955 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 956 | (v4f32 (unpckh VR128:$src1, |
| 957 | (memopv4f32 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 958 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 959 | def UNPCKLPSrr : PSI<0x14, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 960 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 961 | "unpcklps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 962 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 963 | (v4f32 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 964 | def UNPCKLPSrm : PSI<0x14, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 965 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 966 | "unpcklps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 967 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 968 | (unpckl VR128:$src1, (memopv4f32 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 969 | } // AddedComplexity |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 970 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 971 | |
| 972 | // Mask creation |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 973 | def MOVMSKPSrr : PSI<0x50, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 974 | "movmskps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 975 | [(set GR32:$dst, (int_x86_sse_movmsk_ps VR128:$src))]>; |
Evan Cheng | d8296b8 | 2009-05-28 18:55:28 +0000 | [diff] [blame] | 976 | def MOVMSKPDrr : PDI<0x50, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 977 | "movmskpd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 978 | [(set GR32:$dst, (int_x86_sse2_movmsk_pd VR128:$src))]>; |
| 979 | |
Evan Cheng | d1d6807 | 2008-03-08 00:58:38 +0000 | [diff] [blame] | 980 | // Prefetch intrinsic. |
| 981 | def PREFETCHT0 : PSI<0x18, MRM1m, (outs), (ins i8mem:$src), |
| 982 | "prefetcht0\t$src", [(prefetch addr:$src, imm, (i32 3))]>; |
| 983 | def PREFETCHT1 : PSI<0x18, MRM2m, (outs), (ins i8mem:$src), |
| 984 | "prefetcht1\t$src", [(prefetch addr:$src, imm, (i32 2))]>; |
| 985 | def PREFETCHT2 : PSI<0x18, MRM3m, (outs), (ins i8mem:$src), |
| 986 | "prefetcht2\t$src", [(prefetch addr:$src, imm, (i32 1))]>; |
| 987 | def PREFETCHNTA : PSI<0x18, MRM0m, (outs), (ins i8mem:$src), |
| 988 | "prefetchnta\t$src", [(prefetch addr:$src, imm, (i32 0))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 989 | |
| 990 | // Non-temporal stores |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 991 | def MOVNTPSmr : PSI<0x2B, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 992 | "movntps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 993 | [(int_x86_sse_movnt_ps addr:$dst, VR128:$src)]>; |
| 994 | |
| 995 | // Load, store, and memory fence |
Evan Cheng | 68cca15 | 2009-05-27 18:38:01 +0000 | [diff] [blame] | 996 | def SFENCE : PSI<0xAE, MRM7r, (outs), (ins), "sfence", [(int_x86_sse_sfence)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 997 | |
| 998 | // MXCSR register |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 999 | def LDMXCSR : PSI<0xAE, MRM2m, (outs), (ins i32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1000 | "ldmxcsr\t$src", [(int_x86_sse_ldmxcsr addr:$src)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1001 | def STMXCSR : PSI<0xAE, MRM3m, (outs), (ins i32mem:$dst), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1002 | "stmxcsr\t$dst", [(int_x86_sse_stmxcsr addr:$dst)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1003 | |
| 1004 | // Alias instructions that map zero vector to pxor / xorp* for sse. |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1005 | // We set canFoldAsLoad because this can be converted to a constant-pool |
Dan Gohman | 37eb6c8 | 2008-12-03 05:21:24 +0000 | [diff] [blame] | 1006 | // load of an all-zeros value if folding it would be beneficial. |
Daniel Dunbar | a0e6200 | 2009-08-11 22:17:52 +0000 | [diff] [blame] | 1007 | let isReMaterializable = 1, isAsCheapAsAMove = 1, canFoldAsLoad = 1, |
| 1008 | isCodeGenOnly = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1009 | def V_SET0 : PSI<0x57, MRMInitReg, (outs VR128:$dst), (ins), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1010 | "xorps\t$dst, $dst", |
Chris Lattner | e6aa386 | 2007-11-25 00:24:49 +0000 | [diff] [blame] | 1011 | [(set VR128:$dst, (v4i32 immAllZerosV))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1012 | |
Evan Cheng | a15896e | 2008-03-12 07:02:50 +0000 | [diff] [blame] | 1013 | let Predicates = [HasSSE1] in { |
| 1014 | def : Pat<(v2i64 immAllZerosV), (V_SET0)>; |
| 1015 | def : Pat<(v8i16 immAllZerosV), (V_SET0)>; |
| 1016 | def : Pat<(v16i8 immAllZerosV), (V_SET0)>; |
| 1017 | def : Pat<(v2f64 immAllZerosV), (V_SET0)>; |
| 1018 | def : Pat<(v4f32 immAllZerosV), (V_SET0)>; |
| 1019 | } |
| 1020 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1021 | // FR32 to 128-bit vector conversion. |
Evan Cheng | bd0ca9c | 2009-02-05 08:42:55 +0000 | [diff] [blame] | 1022 | let isAsCheapAsAMove = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1023 | def MOVSS2PSrr : SSI<0x10, MRMSrcReg, (outs VR128:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1024 | "movss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1025 | [(set VR128:$dst, |
| 1026 | (v4f32 (scalar_to_vector FR32:$src)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1027 | def MOVSS2PSrm : SSI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1028 | "movss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1029 | [(set VR128:$dst, |
| 1030 | (v4f32 (scalar_to_vector (loadf32 addr:$src))))]>; |
| 1031 | |
| 1032 | // FIXME: may not be able to eliminate this movss with coalescing the src and |
| 1033 | // dest register classes are different. We really want to write this pattern |
| 1034 | // like this: |
| 1035 | // def : Pat<(f32 (vector_extract (v4f32 VR128:$src), (iPTR 0))), |
| 1036 | // (f32 FR32:$src)>; |
Evan Cheng | bd0ca9c | 2009-02-05 08:42:55 +0000 | [diff] [blame] | 1037 | let isAsCheapAsAMove = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1038 | def MOVPS2SSrr : SSI<0x10, MRMSrcReg, (outs FR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1039 | "movss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1040 | [(set FR32:$dst, (vector_extract (v4f32 VR128:$src), |
| 1041 | (iPTR 0)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1042 | def MOVPS2SSmr : SSI<0x11, MRMDestMem, (outs), (ins f32mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1043 | "movss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1044 | [(store (f32 (vector_extract (v4f32 VR128:$src), |
| 1045 | (iPTR 0))), addr:$dst)]>; |
| 1046 | |
| 1047 | |
| 1048 | // Move to lower bits of a VR128, leaving upper bits alone. |
| 1049 | // Three operand (but two address) aliases. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1050 | let Constraints = "$src1 = $dst" in { |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1051 | let neverHasSideEffects = 1 in |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1052 | def MOVLSS2PSrr : SSI<0x10, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1053 | (outs VR128:$dst), (ins VR128:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1054 | "movss\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1055 | |
| 1056 | let AddedComplexity = 15 in |
| 1057 | def MOVLPSrr : SSI<0x10, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1058 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1059 | "movss\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1060 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1061 | (v4f32 (movl VR128:$src1, VR128:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1062 | } |
| 1063 | |
| 1064 | // Move to lower bits of a VR128 and zeroing upper bits. |
| 1065 | // Loading from memory automatically zeroing upper bits. |
| 1066 | let AddedComplexity = 20 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1067 | def MOVZSS2PSrm : SSI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1068 | "movss\t{$src, $dst|$dst, $src}", |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 1069 | [(set VR128:$dst, (v4f32 (X86vzmovl (v4f32 (scalar_to_vector |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1070 | (loadf32 addr:$src))))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1071 | |
Evan Cheng | 056afe1 | 2008-05-20 18:24:47 +0000 | [diff] [blame] | 1072 | def : Pat<(v4f32 (X86vzmovl (loadv4f32 addr:$src))), |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 1073 | (MOVZSS2PSrm addr:$src)>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1074 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1075 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1076 | // SSE2 Instructions |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1077 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1078 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1079 | // Move Instructions |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1080 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1081 | def MOVSDrr : SDI<0x10, MRMSrcReg, (outs FR64:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1082 | "movsd\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1083 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1084 | def MOVSDrm : SDI<0x10, MRMSrcMem, (outs FR64:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1085 | "movsd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1086 | [(set FR64:$dst, (loadf64 addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1087 | def MOVSDmr : SDI<0x11, MRMDestMem, (outs), (ins f64mem:$dst, FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1088 | "movsd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1089 | [(store FR64:$src, addr:$dst)]>; |
| 1090 | |
| 1091 | // Conversion instructions |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1092 | def CVTTSD2SIrr : SDI<0x2C, MRMSrcReg, (outs GR32:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1093 | "cvttsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1094 | [(set GR32:$dst, (fp_to_sint FR64:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1095 | def CVTTSD2SIrm : SDI<0x2C, MRMSrcMem, (outs GR32:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1096 | "cvttsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1097 | [(set GR32:$dst, (fp_to_sint (loadf64 addr:$src)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1098 | def CVTSD2SSrr : SDI<0x5A, MRMSrcReg, (outs FR32:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1099 | "cvtsd2ss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1100 | [(set FR32:$dst, (fround FR64:$src))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1101 | def CVTSD2SSrm : SDI<0x5A, MRMSrcMem, (outs FR32:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1102 | "cvtsd2ss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1103 | [(set FR32:$dst, (fround (loadf64 addr:$src)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1104 | def CVTSI2SDrr : SDI<0x2A, MRMSrcReg, (outs FR64:$dst), (ins GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1105 | "cvtsi2sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1106 | [(set FR64:$dst, (sint_to_fp GR32:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1107 | def CVTSI2SDrm : SDI<0x2A, MRMSrcMem, (outs FR64:$dst), (ins i32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1108 | "cvtsi2sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1109 | [(set FR64:$dst, (sint_to_fp (loadi32 addr:$src)))]>; |
| 1110 | |
Sean Callanan | 3d5824c | 2009-09-16 01:13:52 +0000 | [diff] [blame] | 1111 | def CVTPD2DQrm : S3DI<0xE6, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
| 1112 | "cvtpd2dq\t{$src, $dst|$dst, $src}", []>; |
| 1113 | def CVTPD2DQrr : S3DI<0xE6, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1114 | "cvtpd2dq\t{$src, $dst|$dst, $src}", []>; |
| 1115 | def CVTDQ2PDrm : S3SI<0xE6, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
| 1116 | "cvtdq2pd\t{$src, $dst|$dst, $src}", []>; |
| 1117 | def CVTDQ2PDrr : S3SI<0xE6, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1118 | "cvtdq2pd\t{$src, $dst|$dst, $src}", []>; |
| 1119 | def CVTPS2DQrr : PDI<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1120 | "cvtps2dq\t{$src, $dst|$dst, $src}", []>; |
| 1121 | def CVTPS2DQrm : PDI<0x5B, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
| 1122 | "cvtps2dq\t{$src, $dst|$dst, $src}", []>; |
| 1123 | def CVTDQ2PSrr : PSI<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1124 | "cvtdq2ps\t{$src, $dst|$dst, $src}", []>; |
| 1125 | def CVTDQ2PSrm : PSI<0x5B, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
| 1126 | "cvtdq2ps\t{$src, $dst|$dst, $src}", []>; |
| 1127 | def COMISDrr: PDI<0x2F, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
| 1128 | "comisd\t{$src2, $src1|$src1, $src2}", []>; |
| 1129 | def COMISDrm: PDI<0x2F, MRMSrcMem, (outs), (ins VR128:$src1, f128mem:$src2), |
| 1130 | "comisd\t{$src2, $src1|$src1, $src2}", []>; |
| 1131 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1132 | // SSE2 instructions with XS prefix |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1133 | def CVTSS2SDrr : I<0x5A, MRMSrcReg, (outs FR64:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1134 | "cvtss2sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1135 | [(set FR64:$dst, (fextend FR32:$src))]>, XS, |
| 1136 | Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1137 | def CVTSS2SDrm : I<0x5A, MRMSrcMem, (outs FR64:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1138 | "cvtss2sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1139 | [(set FR64:$dst, (extloadf32 addr:$src))]>, XS, |
| 1140 | Requires<[HasSSE2]>; |
| 1141 | |
| 1142 | // Match intrinsics which expect XMM operand(s). |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1143 | def Int_CVTSD2SIrr : SDI<0x2D, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1144 | "cvtsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1145 | [(set GR32:$dst, (int_x86_sse2_cvtsd2si VR128:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1146 | def Int_CVTSD2SIrm : SDI<0x2D, MRMSrcMem, (outs GR32:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1147 | "cvtsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1148 | [(set GR32:$dst, (int_x86_sse2_cvtsd2si |
| 1149 | (load addr:$src)))]>; |
| 1150 | |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 1151 | // Match intrinisics which expect MM and XMM operand(s). |
| 1152 | def Int_CVTPD2PIrr : PDI<0x2D, MRMSrcReg, (outs VR64:$dst), (ins VR128:$src), |
| 1153 | "cvtpd2pi\t{$src, $dst|$dst, $src}", |
| 1154 | [(set VR64:$dst, (int_x86_sse_cvtpd2pi VR128:$src))]>; |
| 1155 | def Int_CVTPD2PIrm : PDI<0x2D, MRMSrcMem, (outs VR64:$dst), (ins f128mem:$src), |
| 1156 | "cvtpd2pi\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1157 | [(set VR64:$dst, (int_x86_sse_cvtpd2pi |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1158 | (memop addr:$src)))]>; |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 1159 | def Int_CVTTPD2PIrr: PDI<0x2C, MRMSrcReg, (outs VR64:$dst), (ins VR128:$src), |
| 1160 | "cvttpd2pi\t{$src, $dst|$dst, $src}", |
| 1161 | [(set VR64:$dst, (int_x86_sse_cvttpd2pi VR128:$src))]>; |
| 1162 | def Int_CVTTPD2PIrm: PDI<0x2C, MRMSrcMem, (outs VR64:$dst), (ins f128mem:$src), |
| 1163 | "cvttpd2pi\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1164 | [(set VR64:$dst, (int_x86_sse_cvttpd2pi |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1165 | (memop addr:$src)))]>; |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 1166 | def Int_CVTPI2PDrr : PDI<0x2A, MRMSrcReg, (outs VR128:$dst), (ins VR64:$src), |
| 1167 | "cvtpi2pd\t{$src, $dst|$dst, $src}", |
| 1168 | [(set VR128:$dst, (int_x86_sse_cvtpi2pd VR64:$src))]>; |
| 1169 | def Int_CVTPI2PDrm : PDI<0x2A, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), |
| 1170 | "cvtpi2pd\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1171 | [(set VR128:$dst, (int_x86_sse_cvtpi2pd |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 1172 | (load addr:$src)))]>; |
| 1173 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1174 | // Aliases for intrinsics |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1175 | def Int_CVTTSD2SIrr : SDI<0x2C, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1176 | "cvttsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1177 | [(set GR32:$dst, |
| 1178 | (int_x86_sse2_cvttsd2si VR128:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1179 | def Int_CVTTSD2SIrm : SDI<0x2C, MRMSrcMem, (outs GR32:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1180 | "cvttsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1181 | [(set GR32:$dst, (int_x86_sse2_cvttsd2si |
| 1182 | (load addr:$src)))]>; |
| 1183 | |
| 1184 | // Comparison instructions |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1185 | let Constraints = "$src1 = $dst", neverHasSideEffects = 1 in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1186 | def CMPSDrr : SDIi8<0xC2, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1187 | (outs FR64:$dst), (ins FR64:$src1, FR64:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1188 | "cmp${cc}sd\t{$src, $dst|$dst, $src}", []>; |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1189 | let mayLoad = 1 in |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1190 | def CMPSDrm : SDIi8<0xC2, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1191 | (outs FR64:$dst), (ins FR64:$src1, f64mem:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1192 | "cmp${cc}sd\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1193 | } |
| 1194 | |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1195 | let Defs = [EFLAGS] in { |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1196 | def UCOMISDrr: PDI<0x2E, MRMSrcReg, (outs), (ins FR64:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1197 | "ucomisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1198 | [(X86cmp FR64:$src1, FR64:$src2), (implicit EFLAGS)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1199 | def UCOMISDrm: PDI<0x2E, MRMSrcMem, (outs), (ins FR64:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1200 | "ucomisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1201 | [(X86cmp FR64:$src1, (loadf64 addr:$src2)), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1202 | (implicit EFLAGS)]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1203 | } // Defs = [EFLAGS] |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1204 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1205 | // Aliases to match intrinsics which expect XMM operand(s). |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1206 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1207 | def Int_CMPSDrr : SDIi8<0xC2, MRMSrcReg, |
| 1208 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src, |
| 1209 | SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1210 | "cmp${cc}sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1211 | [(set VR128:$dst, (int_x86_sse2_cmp_sd VR128:$src1, |
| 1212 | VR128:$src, imm:$cc))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1213 | def Int_CMPSDrm : SDIi8<0xC2, MRMSrcMem, |
| 1214 | (outs VR128:$dst), (ins VR128:$src1, f64mem:$src, |
| 1215 | SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1216 | "cmp${cc}sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1217 | [(set VR128:$dst, (int_x86_sse2_cmp_sd VR128:$src1, |
| 1218 | (load addr:$src), imm:$cc))]>; |
| 1219 | } |
| 1220 | |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1221 | let Defs = [EFLAGS] in { |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1222 | def Int_UCOMISDrr: PDI<0x2E, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1223 | "ucomisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1224 | [(X86ucomi (v2f64 VR128:$src1), (v2f64 VR128:$src2)), |
| 1225 | (implicit EFLAGS)]>; |
| 1226 | def Int_UCOMISDrm: PDI<0x2E, MRMSrcMem, (outs),(ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1227 | "ucomisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1228 | [(X86ucomi (v2f64 VR128:$src1), (load addr:$src2)), |
| 1229 | (implicit EFLAGS)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1230 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1231 | def Int_COMISDrr: PDI<0x2F, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1232 | "comisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1233 | [(X86comi (v2f64 VR128:$src1), (v2f64 VR128:$src2)), |
| 1234 | (implicit EFLAGS)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1235 | def Int_COMISDrm: PDI<0x2F, MRMSrcMem, (outs), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1236 | "comisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1237 | [(X86comi (v2f64 VR128:$src1), (load addr:$src2)), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1238 | (implicit EFLAGS)]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1239 | } // Defs = [EFLAGS] |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1240 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1241 | // Aliases of packed SSE2 instructions for scalar use. These all have names |
| 1242 | // that start with 'Fs'. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1243 | |
| 1244 | // Alias instructions that map fld0 to pxor for sse. |
Dan Gohman | 51dbce6 | 2009-09-21 18:30:38 +0000 | [diff] [blame] | 1245 | let isReMaterializable = 1, isAsCheapAsAMove = 1, isCodeGenOnly = 1, |
| 1246 | canFoldAsLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1247 | def FsFLD0SD : I<0xEF, MRMInitReg, (outs FR64:$dst), (ins), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1248 | "pxor\t$dst, $dst", [(set FR64:$dst, fpimm0)]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1249 | Requires<[HasSSE2]>, TB, OpSize; |
| 1250 | |
| 1251 | // Alias instruction to do FR64 reg-to-reg copy using movapd. Upper bits are |
| 1252 | // disregarded. |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1253 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1254 | def FsMOVAPDrr : PDI<0x28, MRMSrcReg, (outs FR64:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1255 | "movapd\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1256 | |
| 1257 | // Alias instruction to load FR64 from f128mem using movapd. Upper bits are |
| 1258 | // disregarded. |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1259 | let canFoldAsLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1260 | def FsMOVAPDrm : PDI<0x28, MRMSrcMem, (outs FR64:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1261 | "movapd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 1262 | [(set FR64:$dst, (alignedloadfsf64 addr:$src))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1263 | |
| 1264 | // Alias bitwise logical operations using SSE logical ops on packed FP values. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1265 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1266 | let isCommutable = 1 in { |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1267 | def FsANDPDrr : PDI<0x54, MRMSrcReg, (outs FR64:$dst), |
| 1268 | (ins FR64:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1269 | "andpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1270 | [(set FR64:$dst, (X86fand FR64:$src1, FR64:$src2))]>; |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1271 | def FsORPDrr : PDI<0x56, MRMSrcReg, (outs FR64:$dst), |
| 1272 | (ins FR64:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1273 | "orpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1274 | [(set FR64:$dst, (X86for FR64:$src1, FR64:$src2))]>; |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1275 | def FsXORPDrr : PDI<0x57, MRMSrcReg, (outs FR64:$dst), |
| 1276 | (ins FR64:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1277 | "xorpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1278 | [(set FR64:$dst, (X86fxor FR64:$src1, FR64:$src2))]>; |
| 1279 | } |
| 1280 | |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1281 | def FsANDPDrm : PDI<0x54, MRMSrcMem, (outs FR64:$dst), |
| 1282 | (ins FR64:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1283 | "andpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1284 | [(set FR64:$dst, (X86fand FR64:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 1285 | (memopfsf64 addr:$src2)))]>; |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1286 | def FsORPDrm : PDI<0x56, MRMSrcMem, (outs FR64:$dst), |
| 1287 | (ins FR64:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1288 | "orpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1289 | [(set FR64:$dst, (X86for FR64:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 1290 | (memopfsf64 addr:$src2)))]>; |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1291 | def FsXORPDrm : PDI<0x57, MRMSrcMem, (outs FR64:$dst), |
| 1292 | (ins FR64:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1293 | "xorpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1294 | [(set FR64:$dst, (X86fxor FR64:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 1295 | (memopfsf64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1296 | |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1297 | let neverHasSideEffects = 1 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1298 | def FsANDNPDrr : PDI<0x55, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1299 | (outs FR64:$dst), (ins FR64:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1300 | "andnpd\t{$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1301 | let mayLoad = 1 in |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1302 | def FsANDNPDrm : PDI<0x55, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1303 | (outs FR64:$dst), (ins FR64:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1304 | "andnpd\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1305 | } |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1306 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1307 | |
| 1308 | /// basic_sse2_fp_binop_rm - SSE2 binops come in both scalar and vector forms. |
| 1309 | /// |
| 1310 | /// In addition, we also have a special variant of the scalar form here to |
| 1311 | /// represent the associated intrinsic operation. This form is unlike the |
| 1312 | /// plain scalar form, in that it takes an entire vector (instead of a scalar) |
Evan Cheng | 5d5dbbc | 2009-02-26 03:12:02 +0000 | [diff] [blame] | 1313 | /// and leaves the top elements unmodified (therefore these cannot be commuted). |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1314 | /// |
| 1315 | /// These three forms can each be reg+reg or reg+mem, so there are a total of |
| 1316 | /// six "instructions". |
| 1317 | /// |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1318 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1319 | multiclass basic_sse2_fp_binop_rm<bits<8> opc, string OpcodeStr, |
| 1320 | SDNode OpNode, Intrinsic F64Int, |
| 1321 | bit Commutable = 0> { |
| 1322 | // Scalar operation, reg+reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1323 | def SDrr : SDI<opc, MRMSrcReg, (outs FR64:$dst), (ins FR64:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1324 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1325 | [(set FR64:$dst, (OpNode FR64:$src1, FR64:$src2))]> { |
| 1326 | let isCommutable = Commutable; |
| 1327 | } |
| 1328 | |
| 1329 | // Scalar operation, reg+mem. |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1330 | def SDrm : SDI<opc, MRMSrcMem, (outs FR64:$dst), |
| 1331 | (ins FR64:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1332 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1333 | [(set FR64:$dst, (OpNode FR64:$src1, (load addr:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1334 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1335 | // Vector operation, reg+reg. |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1336 | def PDrr : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1337 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1338 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1339 | [(set VR128:$dst, (v2f64 (OpNode VR128:$src1, VR128:$src2)))]> { |
| 1340 | let isCommutable = Commutable; |
| 1341 | } |
| 1342 | |
| 1343 | // Vector operation, reg+mem. |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1344 | def PDrm : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1345 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1346 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1347 | [(set VR128:$dst, (OpNode VR128:$src1, (memopv2f64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1348 | |
| 1349 | // Intrinsic operation, reg+reg. |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1350 | def SDrr_Int : SDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1351 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1352 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 5d5dbbc | 2009-02-26 03:12:02 +0000 | [diff] [blame] | 1353 | [(set VR128:$dst, (F64Int VR128:$src1, VR128:$src2))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1354 | |
| 1355 | // Intrinsic operation, reg+mem. |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1356 | def SDrm_Int : SDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1357 | (ins VR128:$src1, sdmem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1358 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1359 | [(set VR128:$dst, (F64Int VR128:$src1, |
| 1360 | sse_load_f64:$src2))]>; |
| 1361 | } |
| 1362 | } |
| 1363 | |
| 1364 | // Arithmetic instructions |
| 1365 | defm ADD : basic_sse2_fp_binop_rm<0x58, "add", fadd, int_x86_sse2_add_sd, 1>; |
| 1366 | defm MUL : basic_sse2_fp_binop_rm<0x59, "mul", fmul, int_x86_sse2_mul_sd, 1>; |
| 1367 | defm SUB : basic_sse2_fp_binop_rm<0x5C, "sub", fsub, int_x86_sse2_sub_sd>; |
| 1368 | defm DIV : basic_sse2_fp_binop_rm<0x5E, "div", fdiv, int_x86_sse2_div_sd>; |
| 1369 | |
| 1370 | /// sse2_fp_binop_rm - Other SSE2 binops |
| 1371 | /// |
| 1372 | /// This multiclass is like basic_sse2_fp_binop_rm, with the addition of |
| 1373 | /// instructions for a full-vector intrinsic form. Operations that map |
| 1374 | /// onto C operators don't use this form since they just use the plain |
| 1375 | /// vector form instead of having a separate vector intrinsic form. |
| 1376 | /// |
| 1377 | /// This provides a total of eight "instructions". |
| 1378 | /// |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1379 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1380 | multiclass sse2_fp_binop_rm<bits<8> opc, string OpcodeStr, |
| 1381 | SDNode OpNode, |
| 1382 | Intrinsic F64Int, |
| 1383 | Intrinsic V2F64Int, |
| 1384 | bit Commutable = 0> { |
| 1385 | |
| 1386 | // Scalar operation, reg+reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1387 | def SDrr : SDI<opc, MRMSrcReg, (outs FR64:$dst), (ins FR64:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1388 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1389 | [(set FR64:$dst, (OpNode FR64:$src1, FR64:$src2))]> { |
| 1390 | let isCommutable = Commutable; |
| 1391 | } |
| 1392 | |
| 1393 | // Scalar operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1394 | def SDrm : SDI<opc, MRMSrcMem, (outs FR64:$dst), |
| 1395 | (ins FR64:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1396 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1397 | [(set FR64:$dst, (OpNode FR64:$src1, (load addr:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1398 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1399 | // Vector operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1400 | def PDrr : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1401 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1402 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1403 | [(set VR128:$dst, (v2f64 (OpNode VR128:$src1, VR128:$src2)))]> { |
| 1404 | let isCommutable = Commutable; |
| 1405 | } |
| 1406 | |
| 1407 | // Vector operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1408 | def PDrm : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1409 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1410 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1411 | [(set VR128:$dst, (OpNode VR128:$src1, (memopv2f64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1412 | |
| 1413 | // Intrinsic operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1414 | def SDrr_Int : SDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1415 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1416 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1417 | [(set VR128:$dst, (F64Int VR128:$src1, VR128:$src2))]> { |
| 1418 | let isCommutable = Commutable; |
| 1419 | } |
| 1420 | |
| 1421 | // Intrinsic operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1422 | def SDrm_Int : SDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1423 | (ins VR128:$src1, sdmem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1424 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1425 | [(set VR128:$dst, (F64Int VR128:$src1, |
| 1426 | sse_load_f64:$src2))]>; |
| 1427 | |
| 1428 | // Vector intrinsic operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1429 | def PDrr_Int : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1430 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1431 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1432 | [(set VR128:$dst, (V2F64Int VR128:$src1, VR128:$src2))]> { |
| 1433 | let isCommutable = Commutable; |
| 1434 | } |
| 1435 | |
| 1436 | // Vector intrinsic operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1437 | def PDrm_Int : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1438 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1439 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1440 | [(set VR128:$dst, (V2F64Int VR128:$src1, |
| 1441 | (memopv2f64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1442 | } |
| 1443 | } |
| 1444 | |
| 1445 | defm MAX : sse2_fp_binop_rm<0x5F, "max", X86fmax, |
| 1446 | int_x86_sse2_max_sd, int_x86_sse2_max_pd>; |
| 1447 | defm MIN : sse2_fp_binop_rm<0x5D, "min", X86fmin, |
| 1448 | int_x86_sse2_min_sd, int_x86_sse2_min_pd>; |
| 1449 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1450 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1451 | // SSE packed FP Instructions |
| 1452 | |
| 1453 | // Move Instructions |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1454 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1455 | def MOVAPDrr : PDI<0x28, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1456 | "movapd\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1457 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1458 | def MOVAPDrm : PDI<0x28, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1459 | "movapd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1460 | [(set VR128:$dst, (alignedloadv2f64 addr:$src))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1461 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1462 | def MOVAPDmr : PDI<0x29, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1463 | "movapd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1464 | [(alignedstore (v2f64 VR128:$src), addr:$dst)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1465 | |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1466 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1467 | def MOVUPDrr : PDI<0x10, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1468 | "movupd\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1469 | let canFoldAsLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1470 | def MOVUPDrm : PDI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1471 | "movupd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1472 | [(set VR128:$dst, (loadv2f64 addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1473 | def MOVUPDmr : PDI<0x11, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1474 | "movupd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1475 | [(store (v2f64 VR128:$src), addr:$dst)]>; |
| 1476 | |
| 1477 | // Intrinsic forms of MOVUPD load and store |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1478 | def MOVUPDrm_Int : PDI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1479 | "movupd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1480 | [(set VR128:$dst, (int_x86_sse2_loadu_pd addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1481 | def MOVUPDmr_Int : PDI<0x11, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1482 | "movupd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1483 | [(int_x86_sse2_storeu_pd addr:$dst, VR128:$src)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1484 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1485 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1486 | let AddedComplexity = 20 in { |
| 1487 | def MOVLPDrm : PDI<0x12, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1488 | (outs VR128:$dst), (ins VR128:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1489 | "movlpd\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1490 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1491 | (v2f64 (movlp VR128:$src1, |
| 1492 | (scalar_to_vector (loadf64 addr:$src2)))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1493 | def MOVHPDrm : PDI<0x16, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1494 | (outs VR128:$dst), (ins VR128:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1495 | "movhpd\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1496 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1497 | (v2f64 (movhp VR128:$src1, |
| 1498 | (scalar_to_vector (loadf64 addr:$src2)))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1499 | } // AddedComplexity |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1500 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1501 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1502 | def MOVLPDmr : PDI<0x13, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1503 | "movlpd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1504 | [(store (f64 (vector_extract (v2f64 VR128:$src), |
| 1505 | (iPTR 0))), addr:$dst)]>; |
| 1506 | |
| 1507 | // v2f64 extract element 1 is always custom lowered to unpack high to low |
| 1508 | // and extract element 0 so the non-store version isn't too horrible. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1509 | def MOVHPDmr : PDI<0x17, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1510 | "movhpd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1511 | [(store (f64 (vector_extract |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1512 | (v2f64 (unpckh VR128:$src, (undef))), |
| 1513 | (iPTR 0))), addr:$dst)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1514 | |
| 1515 | // SSE2 instructions without OpSize prefix |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1516 | def Int_CVTDQ2PSrr : I<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1517 | "cvtdq2ps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1518 | [(set VR128:$dst, (int_x86_sse2_cvtdq2ps VR128:$src))]>, |
| 1519 | TB, Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1520 | def Int_CVTDQ2PSrm : I<0x5B, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1521 | "cvtdq2ps\t{$src, $dst|$dst, $src}", |
| 1522 | [(set VR128:$dst, (int_x86_sse2_cvtdq2ps |
| 1523 | (bitconvert (memopv2i64 addr:$src))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1524 | TB, Requires<[HasSSE2]>; |
| 1525 | |
| 1526 | // SSE2 instructions with XS prefix |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1527 | def Int_CVTDQ2PDrr : I<0xE6, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1528 | "cvtdq2pd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1529 | [(set VR128:$dst, (int_x86_sse2_cvtdq2pd VR128:$src))]>, |
| 1530 | XS, Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1531 | def Int_CVTDQ2PDrm : I<0xE6, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1532 | "cvtdq2pd\t{$src, $dst|$dst, $src}", |
| 1533 | [(set VR128:$dst, (int_x86_sse2_cvtdq2pd |
| 1534 | (bitconvert (memopv2i64 addr:$src))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1535 | XS, Requires<[HasSSE2]>; |
| 1536 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1537 | def Int_CVTPS2DQrr : PDI<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1538 | "cvtps2dq\t{$src, $dst|$dst, $src}", |
| 1539 | [(set VR128:$dst, (int_x86_sse2_cvtps2dq VR128:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1540 | def Int_CVTPS2DQrm : PDI<0x5B, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1541 | "cvtps2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1542 | [(set VR128:$dst, (int_x86_sse2_cvtps2dq |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1543 | (memop addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1544 | // SSE2 packed instructions with XS prefix |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1545 | def Int_CVTTPS2DQrr : I<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1546 | "cvttps2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1547 | [(set VR128:$dst, (int_x86_sse2_cvttps2dq VR128:$src))]>, |
| 1548 | XS, Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1549 | def Int_CVTTPS2DQrm : I<0x5B, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1550 | "cvttps2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1551 | [(set VR128:$dst, (int_x86_sse2_cvttps2dq |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1552 | (memop addr:$src)))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1553 | XS, Requires<[HasSSE2]>; |
| 1554 | |
| 1555 | // SSE2 packed instructions with XD prefix |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1556 | def Int_CVTPD2DQrr : I<0xE6, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1557 | "cvtpd2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1558 | [(set VR128:$dst, (int_x86_sse2_cvtpd2dq VR128:$src))]>, |
| 1559 | XD, Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1560 | def Int_CVTPD2DQrm : I<0xE6, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1561 | "cvtpd2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1562 | [(set VR128:$dst, (int_x86_sse2_cvtpd2dq |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1563 | (memop addr:$src)))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1564 | XD, Requires<[HasSSE2]>; |
| 1565 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1566 | def Int_CVTTPD2DQrr : PDI<0xE6, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1567 | "cvttpd2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1568 | [(set VR128:$dst, (int_x86_sse2_cvttpd2dq VR128:$src))]>; |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1569 | def Int_CVTTPD2DQrm : PDI<0xE6, MRMSrcMem, (outs VR128:$dst),(ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1570 | "cvttpd2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1571 | [(set VR128:$dst, (int_x86_sse2_cvttpd2dq |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1572 | (memop addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1573 | |
| 1574 | // SSE2 instructions without OpSize prefix |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1575 | def Int_CVTPS2PDrr : I<0x5A, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1576 | "cvtps2pd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1577 | [(set VR128:$dst, (int_x86_sse2_cvtps2pd VR128:$src))]>, |
| 1578 | TB, Requires<[HasSSE2]>; |
Mon P Wang | aa3f266 | 2008-05-28 00:42:27 +0000 | [diff] [blame] | 1579 | def Int_CVTPS2PDrm : I<0x5A, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1580 | "cvtps2pd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1581 | [(set VR128:$dst, (int_x86_sse2_cvtps2pd |
| 1582 | (load addr:$src)))]>, |
| 1583 | TB, Requires<[HasSSE2]>; |
| 1584 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1585 | def Int_CVTPD2PSrr : PDI<0x5A, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1586 | "cvtpd2ps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1587 | [(set VR128:$dst, (int_x86_sse2_cvtpd2ps VR128:$src))]>; |
Mon P Wang | aa3f266 | 2008-05-28 00:42:27 +0000 | [diff] [blame] | 1588 | def Int_CVTPD2PSrm : PDI<0x5A, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1589 | "cvtpd2ps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1590 | [(set VR128:$dst, (int_x86_sse2_cvtpd2ps |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1591 | (memop addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1592 | |
| 1593 | // Match intrinsics which expect XMM operand(s). |
| 1594 | // Aliases for intrinsics |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1595 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1596 | def Int_CVTSI2SDrr: SDI<0x2A, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1597 | (outs VR128:$dst), (ins VR128:$src1, GR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1598 | "cvtsi2sd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1599 | [(set VR128:$dst, (int_x86_sse2_cvtsi2sd VR128:$src1, |
| 1600 | GR32:$src2))]>; |
| 1601 | def Int_CVTSI2SDrm: SDI<0x2A, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1602 | (outs VR128:$dst), (ins VR128:$src1, i32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1603 | "cvtsi2sd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1604 | [(set VR128:$dst, (int_x86_sse2_cvtsi2sd VR128:$src1, |
| 1605 | (loadi32 addr:$src2)))]>; |
| 1606 | def Int_CVTSD2SSrr: SDI<0x5A, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1607 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1608 | "cvtsd2ss\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1609 | [(set VR128:$dst, (int_x86_sse2_cvtsd2ss VR128:$src1, |
| 1610 | VR128:$src2))]>; |
| 1611 | def Int_CVTSD2SSrm: SDI<0x5A, MRMSrcMem, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1612 | (outs VR128:$dst), (ins VR128:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1613 | "cvtsd2ss\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1614 | [(set VR128:$dst, (int_x86_sse2_cvtsd2ss VR128:$src1, |
| 1615 | (load addr:$src2)))]>; |
| 1616 | def Int_CVTSS2SDrr: I<0x5A, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1617 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1618 | "cvtss2sd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1619 | [(set VR128:$dst, (int_x86_sse2_cvtss2sd VR128:$src1, |
| 1620 | VR128:$src2))]>, XS, |
| 1621 | Requires<[HasSSE2]>; |
| 1622 | def Int_CVTSS2SDrm: I<0x5A, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1623 | (outs VR128:$dst), (ins VR128:$src1, f32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1624 | "cvtss2sd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1625 | [(set VR128:$dst, (int_x86_sse2_cvtss2sd VR128:$src1, |
| 1626 | (load addr:$src2)))]>, XS, |
| 1627 | Requires<[HasSSE2]>; |
| 1628 | } |
| 1629 | |
| 1630 | // Arithmetic |
| 1631 | |
| 1632 | /// sse2_fp_unop_rm - SSE2 unops come in both scalar and vector forms. |
| 1633 | /// |
| 1634 | /// In addition, we also have a special variant of the scalar form here to |
| 1635 | /// represent the associated intrinsic operation. This form is unlike the |
| 1636 | /// plain scalar form, in that it takes an entire vector (instead of a |
| 1637 | /// scalar) and leaves the top elements undefined. |
| 1638 | /// |
| 1639 | /// And, we have a special variant form for a full-vector intrinsic form. |
| 1640 | /// |
| 1641 | /// These four forms can each have a reg or a mem operand, so there are a |
| 1642 | /// total of eight "instructions". |
| 1643 | /// |
| 1644 | multiclass sse2_fp_unop_rm<bits<8> opc, string OpcodeStr, |
| 1645 | SDNode OpNode, |
| 1646 | Intrinsic F64Int, |
| 1647 | Intrinsic V2F64Int, |
| 1648 | bit Commutable = 0> { |
| 1649 | // Scalar operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1650 | def SDr : SDI<opc, MRMSrcReg, (outs FR64:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1651 | !strconcat(OpcodeStr, "sd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1652 | [(set FR64:$dst, (OpNode FR64:$src))]> { |
| 1653 | let isCommutable = Commutable; |
| 1654 | } |
| 1655 | |
| 1656 | // Scalar operation, mem. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1657 | def SDm : SDI<opc, MRMSrcMem, (outs FR64:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1658 | !strconcat(OpcodeStr, "sd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1659 | [(set FR64:$dst, (OpNode (load addr:$src)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1660 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1661 | // Vector operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1662 | def PDr : PDI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1663 | !strconcat(OpcodeStr, "pd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1664 | [(set VR128:$dst, (v2f64 (OpNode VR128:$src)))]> { |
| 1665 | let isCommutable = Commutable; |
| 1666 | } |
| 1667 | |
| 1668 | // Vector operation, mem. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1669 | def PDm : PDI<opc, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1670 | !strconcat(OpcodeStr, "pd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1671 | [(set VR128:$dst, (OpNode (memopv2f64 addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1672 | |
| 1673 | // Intrinsic operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1674 | def SDr_Int : SDI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1675 | !strconcat(OpcodeStr, "sd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1676 | [(set VR128:$dst, (F64Int VR128:$src))]> { |
| 1677 | let isCommutable = Commutable; |
| 1678 | } |
| 1679 | |
| 1680 | // Intrinsic operation, mem. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1681 | def SDm_Int : SDI<opc, MRMSrcMem, (outs VR128:$dst), (ins sdmem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1682 | !strconcat(OpcodeStr, "sd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1683 | [(set VR128:$dst, (F64Int sse_load_f64:$src))]>; |
| 1684 | |
| 1685 | // Vector intrinsic operation, reg |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1686 | def PDr_Int : PDI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1687 | !strconcat(OpcodeStr, "pd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1688 | [(set VR128:$dst, (V2F64Int VR128:$src))]> { |
| 1689 | let isCommutable = Commutable; |
| 1690 | } |
| 1691 | |
| 1692 | // Vector intrinsic operation, mem |
Dan Gohman | c747be5 | 2007-08-02 21:06:40 +0000 | [diff] [blame] | 1693 | def PDm_Int : PDI<opc, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1694 | !strconcat(OpcodeStr, "pd\t{$src, $dst|$dst, $src}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1695 | [(set VR128:$dst, (V2F64Int (memopv2f64 addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1696 | } |
| 1697 | |
| 1698 | // Square root. |
| 1699 | defm SQRT : sse2_fp_unop_rm<0x51, "sqrt", fsqrt, |
| 1700 | int_x86_sse2_sqrt_sd, int_x86_sse2_sqrt_pd>; |
| 1701 | |
| 1702 | // There is no f64 version of the reciprocal approximation instructions. |
| 1703 | |
| 1704 | // Logical |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1705 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1706 | let isCommutable = 1 in { |
| 1707 | def ANDPDrr : PDI<0x54, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1708 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1709 | "andpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1710 | [(set VR128:$dst, |
| 1711 | (and (bc_v2i64 (v2f64 VR128:$src1)), |
| 1712 | (bc_v2i64 (v2f64 VR128:$src2))))]>; |
| 1713 | def ORPDrr : PDI<0x56, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1714 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1715 | "orpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1716 | [(set VR128:$dst, |
| 1717 | (or (bc_v2i64 (v2f64 VR128:$src1)), |
| 1718 | (bc_v2i64 (v2f64 VR128:$src2))))]>; |
| 1719 | def XORPDrr : PDI<0x57, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1720 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1721 | "xorpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1722 | [(set VR128:$dst, |
| 1723 | (xor (bc_v2i64 (v2f64 VR128:$src1)), |
| 1724 | (bc_v2i64 (v2f64 VR128:$src2))))]>; |
| 1725 | } |
| 1726 | |
| 1727 | def ANDPDrm : PDI<0x54, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1728 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1729 | "andpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1730 | [(set VR128:$dst, |
| 1731 | (and (bc_v2i64 (v2f64 VR128:$src1)), |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 1732 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1733 | def ORPDrm : PDI<0x56, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1734 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1735 | "orpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1736 | [(set VR128:$dst, |
| 1737 | (or (bc_v2i64 (v2f64 VR128:$src1)), |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 1738 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1739 | def XORPDrm : PDI<0x57, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1740 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1741 | "xorpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1742 | [(set VR128:$dst, |
| 1743 | (xor (bc_v2i64 (v2f64 VR128:$src1)), |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 1744 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1745 | def ANDNPDrr : PDI<0x55, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1746 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1747 | "andnpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1748 | [(set VR128:$dst, |
| 1749 | (and (vnot (bc_v2i64 (v2f64 VR128:$src1))), |
| 1750 | (bc_v2i64 (v2f64 VR128:$src2))))]>; |
| 1751 | def ANDNPDrm : PDI<0x55, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1752 | (outs VR128:$dst), (ins VR128:$src1,f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1753 | "andnpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1754 | [(set VR128:$dst, |
| 1755 | (and (vnot (bc_v2i64 (v2f64 VR128:$src1))), |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 1756 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1757 | } |
| 1758 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1759 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1760 | def CMPPDrri : PDIi8<0xC2, MRMSrcReg, |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1761 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src, SSECC:$cc), |
| 1762 | "cmp${cc}pd\t{$src, $dst|$dst, $src}", |
| 1763 | [(set VR128:$dst, (int_x86_sse2_cmp_pd VR128:$src1, |
Nate Begeman | 061db5f | 2008-05-12 20:34:32 +0000 | [diff] [blame] | 1764 | VR128:$src, imm:$cc))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1765 | def CMPPDrmi : PDIi8<0xC2, MRMSrcMem, |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1766 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src, SSECC:$cc), |
| 1767 | "cmp${cc}pd\t{$src, $dst|$dst, $src}", |
| 1768 | [(set VR128:$dst, (int_x86_sse2_cmp_pd VR128:$src1, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1769 | (memop addr:$src), imm:$cc))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1770 | } |
Evan Cheng | 3375409 | 2008-08-05 22:19:15 +0000 | [diff] [blame] | 1771 | def : Pat<(v2i64 (X86cmppd (v2f64 VR128:$src1), VR128:$src2, imm:$cc)), |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 1772 | (CMPPDrri VR128:$src1, VR128:$src2, imm:$cc)>; |
Evan Cheng | 3375409 | 2008-08-05 22:19:15 +0000 | [diff] [blame] | 1773 | def : Pat<(v2i64 (X86cmppd (v2f64 VR128:$src1), (memop addr:$src2), imm:$cc)), |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 1774 | (CMPPDrmi VR128:$src1, addr:$src2, imm:$cc)>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1775 | |
| 1776 | // Shuffle and unpack instructions |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1777 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1778 | def SHUFPDrri : PDIi8<0xC6, MRMSrcReg, |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1779 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2, i8imm:$src3), |
| 1780 | "shufpd\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1781 | [(set VR128:$dst, |
| 1782 | (v2f64 (shufp:$src3 VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1783 | def SHUFPDrmi : PDIi8<0xC6, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1784 | (outs VR128:$dst), (ins VR128:$src1, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1785 | f128mem:$src2, i8imm:$src3), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1786 | "shufpd\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1787 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1788 | (v2f64 (shufp:$src3 |
| 1789 | VR128:$src1, (memopv2f64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1790 | |
| 1791 | let AddedComplexity = 10 in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1792 | def UNPCKHPDrr : PDI<0x15, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1793 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1794 | "unpckhpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1795 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1796 | (v2f64 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1797 | def UNPCKHPDrm : PDI<0x15, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1798 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1799 | "unpckhpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1800 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1801 | (v2f64 (unpckh VR128:$src1, |
| 1802 | (memopv2f64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1803 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1804 | def UNPCKLPDrr : PDI<0x14, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1805 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1806 | "unpcklpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1807 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1808 | (v2f64 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1809 | def UNPCKLPDrm : PDI<0x14, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1810 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1811 | "unpcklpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1812 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1813 | (unpckl VR128:$src1, (memopv2f64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1814 | } // AddedComplexity |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1815 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1816 | |
| 1817 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1818 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1819 | // SSE integer instructions |
| 1820 | |
| 1821 | // Move Instructions |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1822 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1823 | def MOVDQArr : PDI<0x6F, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1824 | "movdqa\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1825 | let canFoldAsLoad = 1, mayLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1826 | def MOVDQArm : PDI<0x6F, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1827 | "movdqa\t{$src, $dst|$dst, $src}", |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 1828 | [/*(set VR128:$dst, (alignedloadv2i64 addr:$src))*/]>; |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1829 | let mayStore = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1830 | def MOVDQAmr : PDI<0x7F, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1831 | "movdqa\t{$src, $dst|$dst, $src}", |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 1832 | [/*(alignedstore (v2i64 VR128:$src), addr:$dst)*/]>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1833 | let canFoldAsLoad = 1, mayLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1834 | def MOVDQUrm : I<0x6F, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1835 | "movdqu\t{$src, $dst|$dst, $src}", |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 1836 | [/*(set VR128:$dst, (loadv2i64 addr:$src))*/]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1837 | XS, Requires<[HasSSE2]>; |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1838 | let mayStore = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1839 | def MOVDQUmr : I<0x7F, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1840 | "movdqu\t{$src, $dst|$dst, $src}", |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 1841 | [/*(store (v2i64 VR128:$src), addr:$dst)*/]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1842 | XS, Requires<[HasSSE2]>; |
| 1843 | |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1844 | // Intrinsic forms of MOVDQU load and store |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1845 | let canFoldAsLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1846 | def MOVDQUrm_Int : I<0x6F, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1847 | "movdqu\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1848 | [(set VR128:$dst, (int_x86_sse2_loadu_dq addr:$src))]>, |
| 1849 | XS, Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1850 | def MOVDQUmr_Int : I<0x7F, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1851 | "movdqu\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1852 | [(int_x86_sse2_storeu_dq addr:$dst, VR128:$src)]>, |
| 1853 | XS, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1854 | |
Evan Cheng | 8800475 | 2008-03-05 08:11:27 +0000 | [diff] [blame] | 1855 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1856 | |
| 1857 | multiclass PDI_binop_rm_int<bits<8> opc, string OpcodeStr, Intrinsic IntId, |
| 1858 | bit Commutable = 0> { |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1859 | def rr : PDI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1860 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1861 | [(set VR128:$dst, (IntId VR128:$src1, VR128:$src2))]> { |
| 1862 | let isCommutable = Commutable; |
| 1863 | } |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1864 | def rm : PDI<opc, MRMSrcMem, (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1865 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1866 | [(set VR128:$dst, (IntId VR128:$src1, |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1867 | (bitconvert (memopv2i64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1868 | } |
| 1869 | |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 1870 | multiclass PDI_binop_rmi_int<bits<8> opc, bits<8> opc2, Format ImmForm, |
| 1871 | string OpcodeStr, |
| 1872 | Intrinsic IntId, Intrinsic IntId2> { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1873 | def rr : PDI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src1, |
| 1874 | VR128:$src2), |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 1875 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 1876 | [(set VR128:$dst, (IntId VR128:$src1, VR128:$src2))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1877 | def rm : PDI<opc, MRMSrcMem, (outs VR128:$dst), (ins VR128:$src1, |
| 1878 | i128mem:$src2), |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 1879 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 1880 | [(set VR128:$dst, (IntId VR128:$src1, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1881 | (bitconvert (memopv2i64 addr:$src2))))]>; |
| 1882 | def ri : PDIi8<opc2, ImmForm, (outs VR128:$dst), (ins VR128:$src1, |
| 1883 | i32i8imm:$src2), |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 1884 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 1885 | [(set VR128:$dst, (IntId2 VR128:$src1, (i32 imm:$src2)))]>; |
| 1886 | } |
| 1887 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1888 | /// PDI_binop_rm - Simple SSE2 binary operator. |
| 1889 | multiclass PDI_binop_rm<bits<8> opc, string OpcodeStr, SDNode OpNode, |
| 1890 | ValueType OpVT, bit Commutable = 0> { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1891 | def rr : PDI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src1, |
| 1892 | VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1893 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1894 | [(set VR128:$dst, (OpVT (OpNode VR128:$src1, VR128:$src2)))]> { |
| 1895 | let isCommutable = Commutable; |
| 1896 | } |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1897 | def rm : PDI<opc, MRMSrcMem, (outs VR128:$dst), (ins VR128:$src1, |
| 1898 | i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1899 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1900 | [(set VR128:$dst, (OpVT (OpNode VR128:$src1, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1901 | (bitconvert (memopv2i64 addr:$src2)))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1902 | } |
| 1903 | |
| 1904 | /// PDI_binop_rm_v2i64 - Simple SSE2 binary operator whose type is v2i64. |
| 1905 | /// |
| 1906 | /// FIXME: we could eliminate this and use PDI_binop_rm instead if tblgen knew |
| 1907 | /// to collapse (bitconvert VT to VT) into its operand. |
| 1908 | /// |
| 1909 | multiclass PDI_binop_rm_v2i64<bits<8> opc, string OpcodeStr, SDNode OpNode, |
| 1910 | bit Commutable = 0> { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1911 | def rr : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1912 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1913 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1914 | [(set VR128:$dst, (v2i64 (OpNode VR128:$src1, VR128:$src2)))]> { |
| 1915 | let isCommutable = Commutable; |
| 1916 | } |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1917 | def rm : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1918 | (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1919 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1920 | [(set VR128:$dst, (OpNode VR128:$src1, |
| 1921 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1922 | } |
| 1923 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1924 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1925 | |
| 1926 | // 128-bit Integer Arithmetic |
| 1927 | |
| 1928 | defm PADDB : PDI_binop_rm<0xFC, "paddb", add, v16i8, 1>; |
| 1929 | defm PADDW : PDI_binop_rm<0xFD, "paddw", add, v8i16, 1>; |
| 1930 | defm PADDD : PDI_binop_rm<0xFE, "paddd", add, v4i32, 1>; |
| 1931 | defm PADDQ : PDI_binop_rm_v2i64<0xD4, "paddq", add, 1>; |
| 1932 | |
| 1933 | defm PADDSB : PDI_binop_rm_int<0xEC, "paddsb" , int_x86_sse2_padds_b, 1>; |
| 1934 | defm PADDSW : PDI_binop_rm_int<0xED, "paddsw" , int_x86_sse2_padds_w, 1>; |
| 1935 | defm PADDUSB : PDI_binop_rm_int<0xDC, "paddusb", int_x86_sse2_paddus_b, 1>; |
| 1936 | defm PADDUSW : PDI_binop_rm_int<0xDD, "paddusw", int_x86_sse2_paddus_w, 1>; |
| 1937 | |
| 1938 | defm PSUBB : PDI_binop_rm<0xF8, "psubb", sub, v16i8>; |
| 1939 | defm PSUBW : PDI_binop_rm<0xF9, "psubw", sub, v8i16>; |
| 1940 | defm PSUBD : PDI_binop_rm<0xFA, "psubd", sub, v4i32>; |
| 1941 | defm PSUBQ : PDI_binop_rm_v2i64<0xFB, "psubq", sub>; |
| 1942 | |
| 1943 | defm PSUBSB : PDI_binop_rm_int<0xE8, "psubsb" , int_x86_sse2_psubs_b>; |
| 1944 | defm PSUBSW : PDI_binop_rm_int<0xE9, "psubsw" , int_x86_sse2_psubs_w>; |
| 1945 | defm PSUBUSB : PDI_binop_rm_int<0xD8, "psubusb", int_x86_sse2_psubus_b>; |
| 1946 | defm PSUBUSW : PDI_binop_rm_int<0xD9, "psubusw", int_x86_sse2_psubus_w>; |
| 1947 | |
| 1948 | defm PMULLW : PDI_binop_rm<0xD5, "pmullw", mul, v8i16, 1>; |
| 1949 | |
| 1950 | defm PMULHUW : PDI_binop_rm_int<0xE4, "pmulhuw", int_x86_sse2_pmulhu_w, 1>; |
| 1951 | defm PMULHW : PDI_binop_rm_int<0xE5, "pmulhw" , int_x86_sse2_pmulh_w , 1>; |
| 1952 | defm PMULUDQ : PDI_binop_rm_int<0xF4, "pmuludq", int_x86_sse2_pmulu_dq, 1>; |
| 1953 | |
| 1954 | defm PMADDWD : PDI_binop_rm_int<0xF5, "pmaddwd", int_x86_sse2_pmadd_wd, 1>; |
| 1955 | |
| 1956 | defm PAVGB : PDI_binop_rm_int<0xE0, "pavgb", int_x86_sse2_pavg_b, 1>; |
| 1957 | defm PAVGW : PDI_binop_rm_int<0xE3, "pavgw", int_x86_sse2_pavg_w, 1>; |
| 1958 | |
| 1959 | |
| 1960 | defm PMINUB : PDI_binop_rm_int<0xDA, "pminub", int_x86_sse2_pminu_b, 1>; |
| 1961 | defm PMINSW : PDI_binop_rm_int<0xEA, "pminsw", int_x86_sse2_pmins_w, 1>; |
| 1962 | defm PMAXUB : PDI_binop_rm_int<0xDE, "pmaxub", int_x86_sse2_pmaxu_b, 1>; |
| 1963 | defm PMAXSW : PDI_binop_rm_int<0xEE, "pmaxsw", int_x86_sse2_pmaxs_w, 1>; |
Bill Wendling | 953ad2e | 2009-05-28 02:04:00 +0000 | [diff] [blame] | 1964 | defm PSADBW : PDI_binop_rm_int<0xF6, "psadbw", int_x86_sse2_psad_bw, 1>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1965 | |
| 1966 | |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 1967 | defm PSLLW : PDI_binop_rmi_int<0xF1, 0x71, MRM6r, "psllw", |
| 1968 | int_x86_sse2_psll_w, int_x86_sse2_pslli_w>; |
| 1969 | defm PSLLD : PDI_binop_rmi_int<0xF2, 0x72, MRM6r, "pslld", |
| 1970 | int_x86_sse2_psll_d, int_x86_sse2_pslli_d>; |
| 1971 | defm PSLLQ : PDI_binop_rmi_int<0xF3, 0x73, MRM6r, "psllq", |
| 1972 | int_x86_sse2_psll_q, int_x86_sse2_pslli_q>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1973 | |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 1974 | defm PSRLW : PDI_binop_rmi_int<0xD1, 0x71, MRM2r, "psrlw", |
| 1975 | int_x86_sse2_psrl_w, int_x86_sse2_psrli_w>; |
| 1976 | defm PSRLD : PDI_binop_rmi_int<0xD2, 0x72, MRM2r, "psrld", |
| 1977 | int_x86_sse2_psrl_d, int_x86_sse2_psrli_d>; |
Nate Begeman | c2ca5f6 | 2008-05-13 17:52:09 +0000 | [diff] [blame] | 1978 | defm PSRLQ : PDI_binop_rmi_int<0xD3, 0x73, MRM2r, "psrlq", |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 1979 | int_x86_sse2_psrl_q, int_x86_sse2_psrli_q>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1980 | |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 1981 | defm PSRAW : PDI_binop_rmi_int<0xE1, 0x71, MRM4r, "psraw", |
| 1982 | int_x86_sse2_psra_w, int_x86_sse2_psrai_w>; |
Nate Begeman | d66fc34 | 2008-05-13 01:47:52 +0000 | [diff] [blame] | 1983 | defm PSRAD : PDI_binop_rmi_int<0xE2, 0x72, MRM4r, "psrad", |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 1984 | int_x86_sse2_psra_d, int_x86_sse2_psrai_d>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1985 | |
| 1986 | // 128-bit logical shifts. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1987 | let Constraints = "$src1 = $dst", neverHasSideEffects = 1 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1988 | def PSLLDQri : PDIi8<0x73, MRM7r, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1989 | (outs VR128:$dst), (ins VR128:$src1, i32i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1990 | "pslldq\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1991 | def PSRLDQri : PDIi8<0x73, MRM3r, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1992 | (outs VR128:$dst), (ins VR128:$src1, i32i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1993 | "psrldq\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1994 | // PSRADQri doesn't exist in SSE[1-3]. |
| 1995 | } |
| 1996 | |
| 1997 | let Predicates = [HasSSE2] in { |
| 1998 | def : Pat<(int_x86_sse2_psll_dq VR128:$src1, imm:$src2), |
| 1999 | (v2i64 (PSLLDQri VR128:$src1, (PSxLDQ_imm imm:$src2)))>; |
| 2000 | def : Pat<(int_x86_sse2_psrl_dq VR128:$src1, imm:$src2), |
| 2001 | (v2i64 (PSRLDQri VR128:$src1, (PSxLDQ_imm imm:$src2)))>; |
Bill Wendling | 314ee05 | 2008-10-02 05:56:52 +0000 | [diff] [blame] | 2002 | def : Pat<(int_x86_sse2_psll_dq_bs VR128:$src1, imm:$src2), |
| 2003 | (v2i64 (PSLLDQri VR128:$src1, imm:$src2))>; |
| 2004 | def : Pat<(int_x86_sse2_psrl_dq_bs VR128:$src1, imm:$src2), |
| 2005 | (v2i64 (PSRLDQri VR128:$src1, imm:$src2))>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2006 | def : Pat<(v2f64 (X86fsrl VR128:$src1, i32immSExt8:$src2)), |
| 2007 | (v2f64 (PSRLDQri VR128:$src1, (PSxLDQ_imm imm:$src2)))>; |
Evan Cheng | dea9936 | 2008-05-29 08:22:04 +0000 | [diff] [blame] | 2008 | |
| 2009 | // Shift up / down and insert zero's. |
| 2010 | def : Pat<(v2i64 (X86vshl VR128:$src, (i8 imm:$amt))), |
| 2011 | (v2i64 (PSLLDQri VR128:$src, (PSxLDQ_imm imm:$amt)))>; |
| 2012 | def : Pat<(v2i64 (X86vshr VR128:$src, (i8 imm:$amt))), |
| 2013 | (v2i64 (PSRLDQri VR128:$src, (PSxLDQ_imm imm:$amt)))>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2014 | } |
| 2015 | |
| 2016 | // Logical |
| 2017 | defm PAND : PDI_binop_rm_v2i64<0xDB, "pand", and, 1>; |
| 2018 | defm POR : PDI_binop_rm_v2i64<0xEB, "por" , or , 1>; |
| 2019 | defm PXOR : PDI_binop_rm_v2i64<0xEF, "pxor", xor, 1>; |
| 2020 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2021 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2022 | def PANDNrr : PDI<0xDF, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2023 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2024 | "pandn\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2025 | [(set VR128:$dst, (v2i64 (and (vnot VR128:$src1), |
| 2026 | VR128:$src2)))]>; |
| 2027 | |
| 2028 | def PANDNrm : PDI<0xDF, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2029 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2030 | "pandn\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2031 | [(set VR128:$dst, (v2i64 (and (vnot VR128:$src1), |
Dan Gohman | 7dc1901 | 2007-08-02 21:17:01 +0000 | [diff] [blame] | 2032 | (memopv2i64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2033 | } |
| 2034 | |
| 2035 | // SSE2 Integer comparison |
| 2036 | defm PCMPEQB : PDI_binop_rm_int<0x74, "pcmpeqb", int_x86_sse2_pcmpeq_b>; |
| 2037 | defm PCMPEQW : PDI_binop_rm_int<0x75, "pcmpeqw", int_x86_sse2_pcmpeq_w>; |
| 2038 | defm PCMPEQD : PDI_binop_rm_int<0x76, "pcmpeqd", int_x86_sse2_pcmpeq_d>; |
| 2039 | defm PCMPGTB : PDI_binop_rm_int<0x64, "pcmpgtb", int_x86_sse2_pcmpgt_b>; |
| 2040 | defm PCMPGTW : PDI_binop_rm_int<0x65, "pcmpgtw", int_x86_sse2_pcmpgt_w>; |
| 2041 | defm PCMPGTD : PDI_binop_rm_int<0x66, "pcmpgtd", int_x86_sse2_pcmpgt_d>; |
| 2042 | |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2043 | def : Pat<(v16i8 (X86pcmpeqb VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2044 | (PCMPEQBrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2045 | def : Pat<(v16i8 (X86pcmpeqb VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2046 | (PCMPEQBrm VR128:$src1, addr:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2047 | def : Pat<(v8i16 (X86pcmpeqw VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2048 | (PCMPEQWrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2049 | def : Pat<(v8i16 (X86pcmpeqw VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2050 | (PCMPEQWrm VR128:$src1, addr:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2051 | def : Pat<(v4i32 (X86pcmpeqd VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2052 | (PCMPEQDrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2053 | def : Pat<(v4i32 (X86pcmpeqd VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2054 | (PCMPEQDrm VR128:$src1, addr:$src2)>; |
| 2055 | |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2056 | def : Pat<(v16i8 (X86pcmpgtb VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2057 | (PCMPGTBrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2058 | def : Pat<(v16i8 (X86pcmpgtb VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2059 | (PCMPGTBrm VR128:$src1, addr:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2060 | def : Pat<(v8i16 (X86pcmpgtw VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2061 | (PCMPGTWrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2062 | def : Pat<(v8i16 (X86pcmpgtw VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2063 | (PCMPGTWrm VR128:$src1, addr:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2064 | def : Pat<(v4i32 (X86pcmpgtd VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2065 | (PCMPGTDrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2066 | def : Pat<(v4i32 (X86pcmpgtd VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2067 | (PCMPGTDrm VR128:$src1, addr:$src2)>; |
| 2068 | |
| 2069 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2070 | // Pack instructions |
| 2071 | defm PACKSSWB : PDI_binop_rm_int<0x63, "packsswb", int_x86_sse2_packsswb_128>; |
| 2072 | defm PACKSSDW : PDI_binop_rm_int<0x6B, "packssdw", int_x86_sse2_packssdw_128>; |
| 2073 | defm PACKUSWB : PDI_binop_rm_int<0x67, "packuswb", int_x86_sse2_packuswb_128>; |
| 2074 | |
| 2075 | // Shuffle and unpack instructions |
Nate Begeman | 080f8e2 | 2009-10-19 02:17:23 +0000 | [diff] [blame] | 2076 | let AddedComplexity = 5 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2077 | def PSHUFDri : PDIi8<0x70, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2078 | (outs VR128:$dst), (ins VR128:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2079 | "pshufd\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2080 | [(set VR128:$dst, (v4i32 (pshufd:$src2 |
| 2081 | VR128:$src1, (undef))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2082 | def PSHUFDmi : PDIi8<0x70, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2083 | (outs VR128:$dst), (ins i128mem:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2084 | "pshufd\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2085 | [(set VR128:$dst, (v4i32 (pshufd:$src2 |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2086 | (bc_v4i32(memopv2i64 addr:$src1)), |
| 2087 | (undef))))]>; |
Nate Begeman | 080f8e2 | 2009-10-19 02:17:23 +0000 | [diff] [blame] | 2088 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2089 | |
| 2090 | // SSE2 with ImmT == Imm8 and XS prefix. |
| 2091 | def PSHUFHWri : Ii8<0x70, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2092 | (outs VR128:$dst), (ins VR128:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2093 | "pshufhw\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2094 | [(set VR128:$dst, (v8i16 (pshufhw:$src2 VR128:$src1, |
| 2095 | (undef))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2096 | XS, Requires<[HasSSE2]>; |
| 2097 | def PSHUFHWmi : Ii8<0x70, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2098 | (outs VR128:$dst), (ins i128mem:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2099 | "pshufhw\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2100 | [(set VR128:$dst, (v8i16 (pshufhw:$src2 |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2101 | (bc_v8i16 (memopv2i64 addr:$src1)), |
| 2102 | (undef))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2103 | XS, Requires<[HasSSE2]>; |
| 2104 | |
| 2105 | // SSE2 with ImmT == Imm8 and XD prefix. |
| 2106 | def PSHUFLWri : Ii8<0x70, MRMSrcReg, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2107 | (outs VR128:$dst), (ins VR128:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2108 | "pshuflw\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2109 | [(set VR128:$dst, (v8i16 (pshuflw:$src2 VR128:$src1, |
| 2110 | (undef))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2111 | XD, Requires<[HasSSE2]>; |
| 2112 | def PSHUFLWmi : Ii8<0x70, MRMSrcMem, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2113 | (outs VR128:$dst), (ins i128mem:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2114 | "pshuflw\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2115 | [(set VR128:$dst, (v8i16 (pshuflw:$src2 |
| 2116 | (bc_v8i16 (memopv2i64 addr:$src1)), |
| 2117 | (undef))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2118 | XD, Requires<[HasSSE2]>; |
| 2119 | |
| 2120 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2121 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2122 | def PUNPCKLBWrr : PDI<0x60, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2123 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2124 | "punpcklbw\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2125 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2126 | (v16i8 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2127 | def PUNPCKLBWrm : PDI<0x60, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2128 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2129 | "punpcklbw\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2130 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2131 | (unpckl VR128:$src1, |
| 2132 | (bc_v16i8 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2133 | def PUNPCKLWDrr : PDI<0x61, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2134 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2135 | "punpcklwd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2136 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2137 | (v8i16 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2138 | def PUNPCKLWDrm : PDI<0x61, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2139 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2140 | "punpcklwd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2141 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2142 | (unpckl VR128:$src1, |
| 2143 | (bc_v8i16 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2144 | def PUNPCKLDQrr : PDI<0x62, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2145 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2146 | "punpckldq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2147 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2148 | (v4i32 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2149 | def PUNPCKLDQrm : PDI<0x62, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2150 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2151 | "punpckldq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2152 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2153 | (unpckl VR128:$src1, |
| 2154 | (bc_v4i32 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2155 | def PUNPCKLQDQrr : PDI<0x6C, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2156 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2157 | "punpcklqdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2158 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2159 | (v2i64 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2160 | def PUNPCKLQDQrm : PDI<0x6C, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2161 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2162 | "punpcklqdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2163 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2164 | (v2i64 (unpckl VR128:$src1, |
| 2165 | (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2166 | |
| 2167 | def PUNPCKHBWrr : PDI<0x68, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2168 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2169 | "punpckhbw\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2170 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2171 | (v16i8 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2172 | def PUNPCKHBWrm : PDI<0x68, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2173 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2174 | "punpckhbw\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2175 | [(set VR128:$dst, |
| 2176 | (unpckh VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2177 | (bc_v16i8 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2178 | def PUNPCKHWDrr : PDI<0x69, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2179 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2180 | "punpckhwd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2181 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2182 | (v8i16 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2183 | def PUNPCKHWDrm : PDI<0x69, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2184 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2185 | "punpckhwd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2186 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2187 | (unpckh VR128:$src1, |
| 2188 | (bc_v8i16 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2189 | def PUNPCKHDQrr : PDI<0x6A, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2190 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2191 | "punpckhdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2192 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2193 | (v4i32 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2194 | def PUNPCKHDQrm : PDI<0x6A, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2195 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2196 | "punpckhdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2197 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2198 | (unpckh VR128:$src1, |
| 2199 | (bc_v4i32 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2200 | def PUNPCKHQDQrr : PDI<0x6D, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2201 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2202 | "punpckhqdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2203 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2204 | (v2i64 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2205 | def PUNPCKHQDQrm : PDI<0x6D, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2206 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2207 | "punpckhqdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2208 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2209 | (v2i64 (unpckh VR128:$src1, |
| 2210 | (memopv2i64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2211 | } |
| 2212 | |
| 2213 | // Extract / Insert |
| 2214 | def PEXTRWri : PDIi8<0xC5, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2215 | (outs GR32:$dst), (ins VR128:$src1, i32i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2216 | "pextrw\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2217 | [(set GR32:$dst, (X86pextrw (v8i16 VR128:$src1), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 2218 | imm:$src2))]>; |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2219 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2220 | def PINSRWrri : PDIi8<0xC4, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2221 | (outs VR128:$dst), (ins VR128:$src1, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2222 | GR32:$src2, i32i8imm:$src3), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2223 | "pinsrw\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2224 | [(set VR128:$dst, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 2225 | (X86pinsrw VR128:$src1, GR32:$src2, imm:$src3))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2226 | def PINSRWrmi : PDIi8<0xC4, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2227 | (outs VR128:$dst), (ins VR128:$src1, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2228 | i16mem:$src2, i32i8imm:$src3), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2229 | "pinsrw\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2230 | [(set VR128:$dst, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 2231 | (X86pinsrw VR128:$src1, (extloadi16 addr:$src2), |
| 2232 | imm:$src3))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2233 | } |
| 2234 | |
| 2235 | // Mask creation |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2236 | def PMOVMSKBrr : PDI<0xD7, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2237 | "pmovmskb\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2238 | [(set GR32:$dst, (int_x86_sse2_pmovmskb_128 VR128:$src))]>; |
| 2239 | |
| 2240 | // Conditional store |
Evan Cheng | 6e4d1d9 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2241 | let Uses = [EDI] in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2242 | def MASKMOVDQU : PDI<0xF7, MRMSrcReg, (outs), (ins VR128:$src, VR128:$mask), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2243 | "maskmovdqu\t{$mask, $src|$src, $mask}", |
Evan Cheng | 6e4d1d9 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2244 | [(int_x86_sse2_maskmov_dqu VR128:$src, VR128:$mask, EDI)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2245 | |
Evan Cheng | 430de08 | 2009-02-10 22:06:28 +0000 | [diff] [blame] | 2246 | let Uses = [RDI] in |
| 2247 | def MASKMOVDQU64 : PDI<0xF7, MRMSrcReg, (outs), (ins VR128:$src, VR128:$mask), |
| 2248 | "maskmovdqu\t{$mask, $src|$src, $mask}", |
| 2249 | [(int_x86_sse2_maskmov_dqu VR128:$src, VR128:$mask, RDI)]>; |
| 2250 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2251 | // Non-temporal stores |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2252 | def MOVNTPDmr : PDI<0x2B, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2253 | "movntpd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2254 | [(int_x86_sse2_movnt_pd addr:$dst, VR128:$src)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2255 | def MOVNTDQmr : PDI<0xE7, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2256 | "movntdq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2257 | [(int_x86_sse2_movnt_dq addr:$dst, VR128:$src)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2258 | def MOVNTImr : I<0xC3, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2259 | "movnti\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2260 | [(int_x86_sse2_movnt_i addr:$dst, GR32:$src)]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2261 | TB, Requires<[HasSSE2]>; |
| 2262 | |
| 2263 | // Flush cache |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2264 | def CLFLUSH : I<0xAE, MRM7m, (outs), (ins i8mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2265 | "clflush\t$src", [(int_x86_sse2_clflush addr:$src)]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2266 | TB, Requires<[HasSSE2]>; |
| 2267 | |
| 2268 | // Load, store, and memory fence |
Evan Cheng | 5d0d34e | 2008-10-17 17:14:20 +0000 | [diff] [blame] | 2269 | def LFENCE : I<0xAE, MRM5r, (outs), (ins), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2270 | "lfence", [(int_x86_sse2_lfence)]>, TB, Requires<[HasSSE2]>; |
Evan Cheng | 5d0d34e | 2008-10-17 17:14:20 +0000 | [diff] [blame] | 2271 | def MFENCE : I<0xAE, MRM6r, (outs), (ins), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2272 | "mfence", [(int_x86_sse2_mfence)]>, TB, Requires<[HasSSE2]>; |
| 2273 | |
Andrew Lenharth | 785610d | 2008-02-16 01:24:58 +0000 | [diff] [blame] | 2274 | //TODO: custom lower this so as to never even generate the noop |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2275 | def : Pat<(membarrier (i8 imm:$ll), (i8 imm:$ls), (i8 imm:$sl), (i8 imm:$ss), |
Andrew Lenharth | 785610d | 2008-02-16 01:24:58 +0000 | [diff] [blame] | 2276 | (i8 0)), (NOOP)>; |
| 2277 | def : Pat<(membarrier (i8 0), (i8 0), (i8 0), (i8 1), (i8 1)), (SFENCE)>; |
| 2278 | def : Pat<(membarrier (i8 1), (i8 0), (i8 0), (i8 0), (i8 1)), (LFENCE)>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2279 | def : Pat<(membarrier (i8 imm:$ll), (i8 imm:$ls), (i8 imm:$sl), (i8 imm:$ss), |
Andrew Lenharth | 785610d | 2008-02-16 01:24:58 +0000 | [diff] [blame] | 2280 | (i8 1)), (MFENCE)>; |
| 2281 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2282 | // Alias instructions that map zero vector to pxor / xorp* for sse. |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 2283 | // We set canFoldAsLoad because this can be converted to a constant-pool |
Dan Gohman | 37eb6c8 | 2008-12-03 05:21:24 +0000 | [diff] [blame] | 2284 | // load of an all-ones value if folding it would be beneficial. |
Daniel Dunbar | a0e6200 | 2009-08-11 22:17:52 +0000 | [diff] [blame] | 2285 | let isReMaterializable = 1, isAsCheapAsAMove = 1, canFoldAsLoad = 1, |
| 2286 | isCodeGenOnly = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2287 | def V_SETALLONES : PDI<0x76, MRMInitReg, (outs VR128:$dst), (ins), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2288 | "pcmpeqd\t$dst, $dst", |
Chris Lattner | e6aa386 | 2007-11-25 00:24:49 +0000 | [diff] [blame] | 2289 | [(set VR128:$dst, (v4i32 immAllOnesV))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2290 | |
| 2291 | // FR64 to 128-bit vector conversion. |
Evan Cheng | bd0ca9c | 2009-02-05 08:42:55 +0000 | [diff] [blame] | 2292 | let isAsCheapAsAMove = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2293 | def MOVSD2PDrr : SDI<0x10, MRMSrcReg, (outs VR128:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2294 | "movsd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2295 | [(set VR128:$dst, |
| 2296 | (v2f64 (scalar_to_vector FR64:$src)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2297 | def MOVSD2PDrm : SDI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2298 | "movsd\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2299 | [(set VR128:$dst, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2300 | (v2f64 (scalar_to_vector (loadf64 addr:$src))))]>; |
| 2301 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2302 | def MOVDI2PDIrr : PDI<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2303 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2304 | [(set VR128:$dst, |
| 2305 | (v4i32 (scalar_to_vector GR32:$src)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2306 | def MOVDI2PDIrm : PDI<0x6E, MRMSrcMem, (outs VR128:$dst), (ins i32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2307 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2308 | [(set VR128:$dst, |
| 2309 | (v4i32 (scalar_to_vector (loadi32 addr:$src))))]>; |
| 2310 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2311 | def MOVDI2SSrr : PDI<0x6E, MRMSrcReg, (outs FR32:$dst), (ins GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2312 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2313 | [(set FR32:$dst, (bitconvert GR32:$src))]>; |
| 2314 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2315 | def MOVDI2SSrm : PDI<0x6E, MRMSrcMem, (outs FR32:$dst), (ins i32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2316 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2317 | [(set FR32:$dst, (bitconvert (loadi32 addr:$src)))]>; |
| 2318 | |
| 2319 | // SSE2 instructions with XS prefix |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2320 | def MOVQI2PQIrm : I<0x7E, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2321 | "movq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2322 | [(set VR128:$dst, |
| 2323 | (v2i64 (scalar_to_vector (loadi64 addr:$src))))]>, XS, |
| 2324 | Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2325 | def MOVPQI2QImr : PDI<0xD6, MRMDestMem, (outs), (ins i64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2326 | "movq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2327 | [(store (i64 (vector_extract (v2i64 VR128:$src), |
| 2328 | (iPTR 0))), addr:$dst)]>; |
| 2329 | |
| 2330 | // FIXME: may not be able to eliminate this movss with coalescing the src and |
| 2331 | // dest register classes are different. We really want to write this pattern |
| 2332 | // like this: |
| 2333 | // def : Pat<(f32 (vector_extract (v4f32 VR128:$src), (iPTR 0))), |
| 2334 | // (f32 FR32:$src)>; |
Evan Cheng | bd0ca9c | 2009-02-05 08:42:55 +0000 | [diff] [blame] | 2335 | let isAsCheapAsAMove = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2336 | def MOVPD2SDrr : SDI<0x10, MRMSrcReg, (outs FR64:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2337 | "movsd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2338 | [(set FR64:$dst, (vector_extract (v2f64 VR128:$src), |
| 2339 | (iPTR 0)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2340 | def MOVPD2SDmr : SDI<0x11, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2341 | "movsd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2342 | [(store (f64 (vector_extract (v2f64 VR128:$src), |
| 2343 | (iPTR 0))), addr:$dst)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2344 | def MOVPDI2DIrr : PDI<0x7E, MRMDestReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2345 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2346 | [(set GR32:$dst, (vector_extract (v4i32 VR128:$src), |
| 2347 | (iPTR 0)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2348 | def MOVPDI2DImr : PDI<0x7E, MRMDestMem, (outs), (ins i32mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2349 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2350 | [(store (i32 (vector_extract (v4i32 VR128:$src), |
| 2351 | (iPTR 0))), addr:$dst)]>; |
| 2352 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2353 | def MOVSS2DIrr : PDI<0x7E, MRMDestReg, (outs GR32:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2354 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2355 | [(set GR32:$dst, (bitconvert FR32:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2356 | def MOVSS2DImr : PDI<0x7E, MRMDestMem, (outs), (ins i32mem:$dst, FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2357 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2358 | [(store (i32 (bitconvert FR32:$src)), addr:$dst)]>; |
| 2359 | |
| 2360 | |
| 2361 | // Move to lower bits of a VR128, leaving upper bits alone. |
| 2362 | // Three operand (but two address) aliases. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2363 | let Constraints = "$src1 = $dst" in { |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 2364 | let neverHasSideEffects = 1 in |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2365 | def MOVLSD2PDrr : SDI<0x10, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2366 | (outs VR128:$dst), (ins VR128:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2367 | "movsd\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2368 | |
| 2369 | let AddedComplexity = 15 in |
| 2370 | def MOVLPDrr : SDI<0x10, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2371 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2372 | "movsd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2373 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2374 | (v2f64 (movl VR128:$src1, VR128:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2375 | } |
| 2376 | |
| 2377 | // Store / copy lower 64-bits of a XMM register. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2378 | def MOVLQ128mr : PDI<0xD6, MRMDestMem, (outs), (ins i64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2379 | "movq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2380 | [(int_x86_sse2_storel_dq addr:$dst, VR128:$src)]>; |
| 2381 | |
| 2382 | // Move to lower bits of a VR128 and zeroing upper bits. |
| 2383 | // Loading from memory automatically zeroing upper bits. |
Evan Cheng | d743a5f | 2008-05-10 00:59:18 +0000 | [diff] [blame] | 2384 | let AddedComplexity = 20 in { |
| 2385 | def MOVZSD2PDrm : SDI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src), |
| 2386 | "movsd\t{$src, $dst|$dst, $src}", |
| 2387 | [(set VR128:$dst, |
| 2388 | (v2f64 (X86vzmovl (v2f64 (scalar_to_vector |
| 2389 | (loadf64 addr:$src))))))]>; |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 2390 | |
Evan Cheng | 056afe1 | 2008-05-20 18:24:47 +0000 | [diff] [blame] | 2391 | def : Pat<(v2f64 (X86vzmovl (loadv2f64 addr:$src))), |
| 2392 | (MOVZSD2PDrm addr:$src)>; |
| 2393 | def : Pat<(v2f64 (X86vzmovl (bc_v2f64 (loadv4f32 addr:$src)))), |
Evan Cheng | d743a5f | 2008-05-10 00:59:18 +0000 | [diff] [blame] | 2394 | (MOVZSD2PDrm addr:$src)>; |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2395 | def : Pat<(v2f64 (X86vzload addr:$src)), (MOVZSD2PDrm addr:$src)>; |
Evan Cheng | d743a5f | 2008-05-10 00:59:18 +0000 | [diff] [blame] | 2396 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2397 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2398 | // movd / movq to XMM register zero-extends |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2399 | let AddedComplexity = 15 in { |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2400 | def MOVZDI2PDIrr : PDI<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2401 | "movd\t{$src, $dst|$dst, $src}", |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2402 | [(set VR128:$dst, (v4i32 (X86vzmovl |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 2403 | (v4i32 (scalar_to_vector GR32:$src)))))]>; |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2404 | // This is X86-64 only. |
| 2405 | def MOVZQI2PQIrr : RPDI<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR64:$src), |
| 2406 | "mov{d|q}\t{$src, $dst|$dst, $src}", |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2407 | [(set VR128:$dst, (v2i64 (X86vzmovl |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 2408 | (v2i64 (scalar_to_vector GR64:$src)))))]>; |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2409 | } |
| 2410 | |
| 2411 | let AddedComplexity = 20 in { |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2412 | def MOVZDI2PDIrm : PDI<0x6E, MRMSrcMem, (outs VR128:$dst), (ins i32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2413 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2414 | [(set VR128:$dst, |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2415 | (v4i32 (X86vzmovl (v4i32 (scalar_to_vector |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 2416 | (loadi32 addr:$src))))))]>; |
Evan Cheng | 3ad16c4 | 2008-05-22 18:56:56 +0000 | [diff] [blame] | 2417 | |
| 2418 | def : Pat<(v4i32 (X86vzmovl (loadv4i32 addr:$src))), |
| 2419 | (MOVZDI2PDIrm addr:$src)>; |
| 2420 | def : Pat<(v4i32 (X86vzmovl (bc_v4i32 (loadv4f32 addr:$src)))), |
| 2421 | (MOVZDI2PDIrm addr:$src)>; |
Duncan Sands | 2418bec | 2008-06-13 19:07:40 +0000 | [diff] [blame] | 2422 | def : Pat<(v4i32 (X86vzmovl (bc_v4i32 (loadv2i64 addr:$src)))), |
| 2423 | (MOVZDI2PDIrm addr:$src)>; |
Evan Cheng | 3ad16c4 | 2008-05-22 18:56:56 +0000 | [diff] [blame] | 2424 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2425 | def MOVZQI2PQIrm : I<0x7E, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2426 | "movq\t{$src, $dst|$dst, $src}", |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2427 | [(set VR128:$dst, |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2428 | (v2i64 (X86vzmovl (v2i64 (scalar_to_vector |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 2429 | (loadi64 addr:$src))))))]>, XS, |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2430 | Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2431 | |
Evan Cheng | 3ad16c4 | 2008-05-22 18:56:56 +0000 | [diff] [blame] | 2432 | def : Pat<(v2i64 (X86vzmovl (loadv2i64 addr:$src))), |
| 2433 | (MOVZQI2PQIrm addr:$src)>; |
| 2434 | def : Pat<(v2i64 (X86vzmovl (bc_v2i64 (loadv4f32 addr:$src)))), |
| 2435 | (MOVZQI2PQIrm addr:$src)>; |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2436 | def : Pat<(v2i64 (X86vzload addr:$src)), (MOVZQI2PQIrm addr:$src)>; |
Evan Cheng | d743a5f | 2008-05-10 00:59:18 +0000 | [diff] [blame] | 2437 | } |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2438 | |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2439 | // Moving from XMM to XMM and clear upper 64 bits. Note, there is a bug in |
| 2440 | // IA32 document. movq xmm1, xmm2 does clear the high bits. |
| 2441 | let AddedComplexity = 15 in |
| 2442 | def MOVZPQILo2PQIrr : I<0x7E, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 2443 | "movq\t{$src, $dst|$dst, $src}", |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2444 | [(set VR128:$dst, (v2i64 (X86vzmovl (v2i64 VR128:$src))))]>, |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2445 | XS, Requires<[HasSSE2]>; |
| 2446 | |
Evan Cheng | 056afe1 | 2008-05-20 18:24:47 +0000 | [diff] [blame] | 2447 | let AddedComplexity = 20 in { |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2448 | def MOVZPQILo2PQIrm : I<0x7E, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
| 2449 | "movq\t{$src, $dst|$dst, $src}", |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2450 | [(set VR128:$dst, (v2i64 (X86vzmovl |
Evan Cheng | 056afe1 | 2008-05-20 18:24:47 +0000 | [diff] [blame] | 2451 | (loadv2i64 addr:$src))))]>, |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2452 | XS, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2453 | |
Evan Cheng | 056afe1 | 2008-05-20 18:24:47 +0000 | [diff] [blame] | 2454 | def : Pat<(v2i64 (X86vzmovl (bc_v2i64 (loadv4i32 addr:$src)))), |
| 2455 | (MOVZPQILo2PQIrm addr:$src)>; |
| 2456 | } |
| 2457 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2458 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2459 | // SSE3 Instructions |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2460 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2461 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2462 | // Move Instructions |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2463 | def MOVSHDUPrr : S3SI<0x16, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2464 | "movshdup\t{$src, $dst|$dst, $src}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2465 | [(set VR128:$dst, (v4f32 (movshdup |
| 2466 | VR128:$src, (undef))))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2467 | def MOVSHDUPrm : S3SI<0x16, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2468 | "movshdup\t{$src, $dst|$dst, $src}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2469 | [(set VR128:$dst, (movshdup |
| 2470 | (memopv4f32 addr:$src), (undef)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2471 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2472 | def MOVSLDUPrr : S3SI<0x12, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2473 | "movsldup\t{$src, $dst|$dst, $src}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2474 | [(set VR128:$dst, (v4f32 (movsldup |
| 2475 | VR128:$src, (undef))))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2476 | def MOVSLDUPrm : S3SI<0x12, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2477 | "movsldup\t{$src, $dst|$dst, $src}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2478 | [(set VR128:$dst, (movsldup |
| 2479 | (memopv4f32 addr:$src), (undef)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2480 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2481 | def MOVDDUPrr : S3DI<0x12, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2482 | "movddup\t{$src, $dst|$dst, $src}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2483 | [(set VR128:$dst,(v2f64 (movddup VR128:$src, (undef))))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2484 | def MOVDDUPrm : S3DI<0x12, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2485 | "movddup\t{$src, $dst|$dst, $src}", |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 2486 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2487 | (v2f64 (movddup (scalar_to_vector (loadf64 addr:$src)), |
| 2488 | (undef))))]>; |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 2489 | |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2490 | def : Pat<(movddup (bc_v2f64 (v2i64 (scalar_to_vector (loadi64 addr:$src)))), |
| 2491 | (undef)), |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 2492 | (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; |
Nate Begeman | b44aad7 | 2009-04-29 22:47:44 +0000 | [diff] [blame] | 2493 | |
| 2494 | let AddedComplexity = 5 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2495 | def : Pat<(movddup (memopv2f64 addr:$src), (undef)), |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 2496 | (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; |
Nate Begeman | b44aad7 | 2009-04-29 22:47:44 +0000 | [diff] [blame] | 2497 | def : Pat<(movddup (bc_v4f32 (memopv2f64 addr:$src)), (undef)), |
| 2498 | (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; |
| 2499 | def : Pat<(movddup (memopv2i64 addr:$src), (undef)), |
| 2500 | (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; |
| 2501 | def : Pat<(movddup (bc_v4i32 (memopv2i64 addr:$src)), (undef)), |
| 2502 | (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; |
| 2503 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2504 | |
| 2505 | // Arithmetic |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2506 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2507 | def ADDSUBPSrr : S3DI<0xD0, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2508 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2509 | "addsubps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2510 | [(set VR128:$dst, (int_x86_sse3_addsub_ps VR128:$src1, |
| 2511 | VR128:$src2))]>; |
| 2512 | def ADDSUBPSrm : S3DI<0xD0, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2513 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2514 | "addsubps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2515 | [(set VR128:$dst, (int_x86_sse3_addsub_ps VR128:$src1, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 2516 | (memop addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2517 | def ADDSUBPDrr : S3I<0xD0, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2518 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2519 | "addsubpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2520 | [(set VR128:$dst, (int_x86_sse3_addsub_pd VR128:$src1, |
| 2521 | VR128:$src2))]>; |
| 2522 | def ADDSUBPDrm : S3I<0xD0, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2523 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2524 | "addsubpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2525 | [(set VR128:$dst, (int_x86_sse3_addsub_pd VR128:$src1, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 2526 | (memop addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2527 | } |
| 2528 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2529 | def LDDQUrm : S3DI<0xF0, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2530 | "lddqu\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2531 | [(set VR128:$dst, (int_x86_sse3_ldu_dq addr:$src))]>; |
| 2532 | |
| 2533 | // Horizontal ops |
| 2534 | class S3D_Intrr<bits<8> o, string OpcodeStr, Intrinsic IntId> |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2535 | : S3DI<o, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2536 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2537 | [(set VR128:$dst, (v4f32 (IntId VR128:$src1, VR128:$src2)))]>; |
| 2538 | class S3D_Intrm<bits<8> o, string OpcodeStr, Intrinsic IntId> |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2539 | : S3DI<o, MRMSrcMem, (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2540 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 2541 | [(set VR128:$dst, (v4f32 (IntId VR128:$src1, (memop addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2542 | class S3_Intrr<bits<8> o, string OpcodeStr, Intrinsic IntId> |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2543 | : S3I<o, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2544 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2545 | [(set VR128:$dst, (v2f64 (IntId VR128:$src1, VR128:$src2)))]>; |
| 2546 | class S3_Intrm<bits<8> o, string OpcodeStr, Intrinsic IntId> |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2547 | : S3I<o, MRMSrcMem, (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2548 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 2549 | [(set VR128:$dst, (v2f64 (IntId VR128:$src1, (memopv2f64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2550 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2551 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2552 | def HADDPSrr : S3D_Intrr<0x7C, "haddps", int_x86_sse3_hadd_ps>; |
| 2553 | def HADDPSrm : S3D_Intrm<0x7C, "haddps", int_x86_sse3_hadd_ps>; |
| 2554 | def HADDPDrr : S3_Intrr <0x7C, "haddpd", int_x86_sse3_hadd_pd>; |
| 2555 | def HADDPDrm : S3_Intrm <0x7C, "haddpd", int_x86_sse3_hadd_pd>; |
| 2556 | def HSUBPSrr : S3D_Intrr<0x7D, "hsubps", int_x86_sse3_hsub_ps>; |
| 2557 | def HSUBPSrm : S3D_Intrm<0x7D, "hsubps", int_x86_sse3_hsub_ps>; |
| 2558 | def HSUBPDrr : S3_Intrr <0x7D, "hsubpd", int_x86_sse3_hsub_pd>; |
| 2559 | def HSUBPDrm : S3_Intrm <0x7D, "hsubpd", int_x86_sse3_hsub_pd>; |
| 2560 | } |
| 2561 | |
| 2562 | // Thread synchronization |
Bill Wendling | 6ee7655 | 2009-05-28 23:40:46 +0000 | [diff] [blame] | 2563 | def MONITOR : I<0x01, MRM1r, (outs), (ins), "monitor", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2564 | [(int_x86_sse3_monitor EAX, ECX, EDX)]>,TB, Requires<[HasSSE3]>; |
Bill Wendling | 6ee7655 | 2009-05-28 23:40:46 +0000 | [diff] [blame] | 2565 | def MWAIT : I<0x01, MRM1r, (outs), (ins), "mwait", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2566 | [(int_x86_sse3_mwait ECX, EAX)]>, TB, Requires<[HasSSE3]>; |
| 2567 | |
| 2568 | // vector_shuffle v1, <undef> <1, 1, 3, 3> |
| 2569 | let AddedComplexity = 15 in |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2570 | def : Pat<(v4i32 (movshdup VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2571 | (MOVSHDUPrr VR128:$src)>, Requires<[HasSSE3]>; |
| 2572 | let AddedComplexity = 20 in |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2573 | def : Pat<(v4i32 (movshdup (bc_v4i32 (memopv2i64 addr:$src)), (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2574 | (MOVSHDUPrm addr:$src)>, Requires<[HasSSE3]>; |
| 2575 | |
| 2576 | // vector_shuffle v1, <undef> <0, 0, 2, 2> |
| 2577 | let AddedComplexity = 15 in |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2578 | def : Pat<(v4i32 (movsldup VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2579 | (MOVSLDUPrr VR128:$src)>, Requires<[HasSSE3]>; |
| 2580 | let AddedComplexity = 20 in |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2581 | def : Pat<(v4i32 (movsldup (bc_v4i32 (memopv2i64 addr:$src)), (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2582 | (MOVSLDUPrm addr:$src)>, Requires<[HasSSE3]>; |
| 2583 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2584 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2585 | // SSSE3 Instructions |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2586 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2587 | |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2588 | /// SS3I_unop_rm_int_8 - Simple SSSE3 unary operator whose type is v*i8. |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 2589 | multiclass SS3I_unop_rm_int_8<bits<8> opc, string OpcodeStr, |
| 2590 | Intrinsic IntId64, Intrinsic IntId128> { |
| 2591 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), (ins VR64:$src), |
| 2592 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2593 | [(set VR64:$dst, (IntId64 VR64:$src))]>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2594 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 2595 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), (ins i64mem:$src), |
| 2596 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2597 | [(set VR64:$dst, |
| 2598 | (IntId64 (bitconvert (memopv8i8 addr:$src))))]>; |
| 2599 | |
| 2600 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2601 | (ins VR128:$src), |
| 2602 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2603 | [(set VR128:$dst, (IntId128 VR128:$src))]>, |
| 2604 | OpSize; |
| 2605 | |
| 2606 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2607 | (ins i128mem:$src), |
| 2608 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2609 | [(set VR128:$dst, |
| 2610 | (IntId128 |
| 2611 | (bitconvert (memopv16i8 addr:$src))))]>, OpSize; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2612 | } |
| 2613 | |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2614 | /// SS3I_unop_rm_int_16 - Simple SSSE3 unary operator whose type is v*i16. |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 2615 | multiclass SS3I_unop_rm_int_16<bits<8> opc, string OpcodeStr, |
| 2616 | Intrinsic IntId64, Intrinsic IntId128> { |
| 2617 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), |
| 2618 | (ins VR64:$src), |
| 2619 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2620 | [(set VR64:$dst, (IntId64 VR64:$src))]>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2621 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 2622 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), |
| 2623 | (ins i64mem:$src), |
| 2624 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2625 | [(set VR64:$dst, |
| 2626 | (IntId64 |
| 2627 | (bitconvert (memopv4i16 addr:$src))))]>; |
| 2628 | |
| 2629 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2630 | (ins VR128:$src), |
| 2631 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2632 | [(set VR128:$dst, (IntId128 VR128:$src))]>, |
| 2633 | OpSize; |
| 2634 | |
| 2635 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2636 | (ins i128mem:$src), |
| 2637 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2638 | [(set VR128:$dst, |
| 2639 | (IntId128 |
| 2640 | (bitconvert (memopv8i16 addr:$src))))]>, OpSize; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2641 | } |
| 2642 | |
| 2643 | /// SS3I_unop_rm_int_32 - Simple SSSE3 unary operator whose type is v*i32. |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 2644 | multiclass SS3I_unop_rm_int_32<bits<8> opc, string OpcodeStr, |
| 2645 | Intrinsic IntId64, Intrinsic IntId128> { |
| 2646 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), |
| 2647 | (ins VR64:$src), |
| 2648 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2649 | [(set VR64:$dst, (IntId64 VR64:$src))]>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2650 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 2651 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), |
| 2652 | (ins i64mem:$src), |
| 2653 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2654 | [(set VR64:$dst, |
| 2655 | (IntId64 |
| 2656 | (bitconvert (memopv2i32 addr:$src))))]>; |
| 2657 | |
| 2658 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2659 | (ins VR128:$src), |
| 2660 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2661 | [(set VR128:$dst, (IntId128 VR128:$src))]>, |
| 2662 | OpSize; |
| 2663 | |
| 2664 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2665 | (ins i128mem:$src), |
| 2666 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2667 | [(set VR128:$dst, |
| 2668 | (IntId128 |
| 2669 | (bitconvert (memopv4i32 addr:$src))))]>, OpSize; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2670 | } |
| 2671 | |
| 2672 | defm PABSB : SS3I_unop_rm_int_8 <0x1C, "pabsb", |
| 2673 | int_x86_ssse3_pabs_b, |
| 2674 | int_x86_ssse3_pabs_b_128>; |
| 2675 | defm PABSW : SS3I_unop_rm_int_16<0x1D, "pabsw", |
| 2676 | int_x86_ssse3_pabs_w, |
| 2677 | int_x86_ssse3_pabs_w_128>; |
| 2678 | defm PABSD : SS3I_unop_rm_int_32<0x1E, "pabsd", |
| 2679 | int_x86_ssse3_pabs_d, |
| 2680 | int_x86_ssse3_pabs_d_128>; |
| 2681 | |
| 2682 | /// SS3I_binop_rm_int_8 - Simple SSSE3 binary operator whose type is v*i8. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2683 | let Constraints = "$src1 = $dst" in { |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2684 | multiclass SS3I_binop_rm_int_8<bits<8> opc, string OpcodeStr, |
| 2685 | Intrinsic IntId64, Intrinsic IntId128, |
| 2686 | bit Commutable = 0> { |
| 2687 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), |
| 2688 | (ins VR64:$src1, VR64:$src2), |
| 2689 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2690 | [(set VR64:$dst, (IntId64 VR64:$src1, VR64:$src2))]> { |
| 2691 | let isCommutable = Commutable; |
| 2692 | } |
| 2693 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), |
| 2694 | (ins VR64:$src1, i64mem:$src2), |
| 2695 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2696 | [(set VR64:$dst, |
| 2697 | (IntId64 VR64:$src1, |
| 2698 | (bitconvert (memopv8i8 addr:$src2))))]>; |
| 2699 | |
| 2700 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2701 | (ins VR128:$src1, VR128:$src2), |
| 2702 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2703 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 2704 | OpSize { |
| 2705 | let isCommutable = Commutable; |
| 2706 | } |
| 2707 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2708 | (ins VR128:$src1, i128mem:$src2), |
| 2709 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2710 | [(set VR128:$dst, |
| 2711 | (IntId128 VR128:$src1, |
| 2712 | (bitconvert (memopv16i8 addr:$src2))))]>, OpSize; |
| 2713 | } |
| 2714 | } |
| 2715 | |
| 2716 | /// SS3I_binop_rm_int_16 - Simple SSSE3 binary operator whose type is v*i16. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2717 | let Constraints = "$src1 = $dst" in { |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2718 | multiclass SS3I_binop_rm_int_16<bits<8> opc, string OpcodeStr, |
| 2719 | Intrinsic IntId64, Intrinsic IntId128, |
| 2720 | bit Commutable = 0> { |
| 2721 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), |
| 2722 | (ins VR64:$src1, VR64:$src2), |
| 2723 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2724 | [(set VR64:$dst, (IntId64 VR64:$src1, VR64:$src2))]> { |
| 2725 | let isCommutable = Commutable; |
| 2726 | } |
| 2727 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), |
| 2728 | (ins VR64:$src1, i64mem:$src2), |
| 2729 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2730 | [(set VR64:$dst, |
| 2731 | (IntId64 VR64:$src1, |
| 2732 | (bitconvert (memopv4i16 addr:$src2))))]>; |
| 2733 | |
| 2734 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2735 | (ins VR128:$src1, VR128:$src2), |
| 2736 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2737 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 2738 | OpSize { |
| 2739 | let isCommutable = Commutable; |
| 2740 | } |
| 2741 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2742 | (ins VR128:$src1, i128mem:$src2), |
| 2743 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2744 | [(set VR128:$dst, |
| 2745 | (IntId128 VR128:$src1, |
| 2746 | (bitconvert (memopv8i16 addr:$src2))))]>, OpSize; |
| 2747 | } |
| 2748 | } |
| 2749 | |
| 2750 | /// SS3I_binop_rm_int_32 - Simple SSSE3 binary operator whose type is v*i32. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2751 | let Constraints = "$src1 = $dst" in { |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2752 | multiclass SS3I_binop_rm_int_32<bits<8> opc, string OpcodeStr, |
| 2753 | Intrinsic IntId64, Intrinsic IntId128, |
| 2754 | bit Commutable = 0> { |
| 2755 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), |
| 2756 | (ins VR64:$src1, VR64:$src2), |
| 2757 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2758 | [(set VR64:$dst, (IntId64 VR64:$src1, VR64:$src2))]> { |
| 2759 | let isCommutable = Commutable; |
| 2760 | } |
| 2761 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), |
| 2762 | (ins VR64:$src1, i64mem:$src2), |
| 2763 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2764 | [(set VR64:$dst, |
| 2765 | (IntId64 VR64:$src1, |
| 2766 | (bitconvert (memopv2i32 addr:$src2))))]>; |
| 2767 | |
| 2768 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2769 | (ins VR128:$src1, VR128:$src2), |
| 2770 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2771 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 2772 | OpSize { |
| 2773 | let isCommutable = Commutable; |
| 2774 | } |
| 2775 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2776 | (ins VR128:$src1, i128mem:$src2), |
| 2777 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2778 | [(set VR128:$dst, |
| 2779 | (IntId128 VR128:$src1, |
| 2780 | (bitconvert (memopv4i32 addr:$src2))))]>, OpSize; |
| 2781 | } |
| 2782 | } |
| 2783 | |
| 2784 | defm PHADDW : SS3I_binop_rm_int_16<0x01, "phaddw", |
| 2785 | int_x86_ssse3_phadd_w, |
Evan Cheng | 944e441 | 2008-06-16 21:16:24 +0000 | [diff] [blame] | 2786 | int_x86_ssse3_phadd_w_128>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2787 | defm PHADDD : SS3I_binop_rm_int_32<0x02, "phaddd", |
| 2788 | int_x86_ssse3_phadd_d, |
Evan Cheng | 944e441 | 2008-06-16 21:16:24 +0000 | [diff] [blame] | 2789 | int_x86_ssse3_phadd_d_128>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2790 | defm PHADDSW : SS3I_binop_rm_int_16<0x03, "phaddsw", |
| 2791 | int_x86_ssse3_phadd_sw, |
Evan Cheng | 944e441 | 2008-06-16 21:16:24 +0000 | [diff] [blame] | 2792 | int_x86_ssse3_phadd_sw_128>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2793 | defm PHSUBW : SS3I_binop_rm_int_16<0x05, "phsubw", |
| 2794 | int_x86_ssse3_phsub_w, |
| 2795 | int_x86_ssse3_phsub_w_128>; |
| 2796 | defm PHSUBD : SS3I_binop_rm_int_32<0x06, "phsubd", |
| 2797 | int_x86_ssse3_phsub_d, |
| 2798 | int_x86_ssse3_phsub_d_128>; |
| 2799 | defm PHSUBSW : SS3I_binop_rm_int_16<0x07, "phsubsw", |
| 2800 | int_x86_ssse3_phsub_sw, |
| 2801 | int_x86_ssse3_phsub_sw_128>; |
| 2802 | defm PMADDUBSW : SS3I_binop_rm_int_8 <0x04, "pmaddubsw", |
| 2803 | int_x86_ssse3_pmadd_ub_sw, |
Evan Cheng | 944e441 | 2008-06-16 21:16:24 +0000 | [diff] [blame] | 2804 | int_x86_ssse3_pmadd_ub_sw_128>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2805 | defm PMULHRSW : SS3I_binop_rm_int_16<0x0B, "pmulhrsw", |
| 2806 | int_x86_ssse3_pmul_hr_sw, |
| 2807 | int_x86_ssse3_pmul_hr_sw_128, 1>; |
| 2808 | defm PSHUFB : SS3I_binop_rm_int_8 <0x00, "pshufb", |
| 2809 | int_x86_ssse3_pshuf_b, |
| 2810 | int_x86_ssse3_pshuf_b_128>; |
| 2811 | defm PSIGNB : SS3I_binop_rm_int_8 <0x08, "psignb", |
| 2812 | int_x86_ssse3_psign_b, |
| 2813 | int_x86_ssse3_psign_b_128>; |
| 2814 | defm PSIGNW : SS3I_binop_rm_int_16<0x09, "psignw", |
| 2815 | int_x86_ssse3_psign_w, |
| 2816 | int_x86_ssse3_psign_w_128>; |
Evan Cheng | abfed47 | 2009-05-28 18:48:53 +0000 | [diff] [blame] | 2817 | defm PSIGND : SS3I_binop_rm_int_32<0x0A, "psignd", |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2818 | int_x86_ssse3_psign_d, |
| 2819 | int_x86_ssse3_psign_d_128>; |
| 2820 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2821 | let Constraints = "$src1 = $dst" in { |
Bill Wendling | 1dc817c | 2007-08-10 09:00:17 +0000 | [diff] [blame] | 2822 | def PALIGNR64rr : SS3AI<0x0F, MRMSrcReg, (outs VR64:$dst), |
| 2823 | (ins VR64:$src1, VR64:$src2, i16imm:$src3), |
Dale Johannesen | 576b27e | 2007-10-11 20:58:37 +0000 | [diff] [blame] | 2824 | "palignr\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Bill Wendling | 1dc817c | 2007-08-10 09:00:17 +0000 | [diff] [blame] | 2825 | [(set VR64:$dst, |
| 2826 | (int_x86_ssse3_palign_r |
| 2827 | VR64:$src1, VR64:$src2, |
| 2828 | imm:$src3))]>; |
Dan Gohman | bcb9d46 | 2008-05-28 01:50:19 +0000 | [diff] [blame] | 2829 | def PALIGNR64rm : SS3AI<0x0F, MRMSrcMem, (outs VR64:$dst), |
Bill Wendling | 1dc817c | 2007-08-10 09:00:17 +0000 | [diff] [blame] | 2830 | (ins VR64:$src1, i64mem:$src2, i16imm:$src3), |
Dale Johannesen | 576b27e | 2007-10-11 20:58:37 +0000 | [diff] [blame] | 2831 | "palignr\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Bill Wendling | 1dc817c | 2007-08-10 09:00:17 +0000 | [diff] [blame] | 2832 | [(set VR64:$dst, |
| 2833 | (int_x86_ssse3_palign_r |
| 2834 | VR64:$src1, |
| 2835 | (bitconvert (memopv2i32 addr:$src2)), |
| 2836 | imm:$src3))]>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2837 | |
Bill Wendling | 1dc817c | 2007-08-10 09:00:17 +0000 | [diff] [blame] | 2838 | def PALIGNR128rr : SS3AI<0x0F, MRMSrcReg, (outs VR128:$dst), |
| 2839 | (ins VR128:$src1, VR128:$src2, i32imm:$src3), |
Dale Johannesen | 576b27e | 2007-10-11 20:58:37 +0000 | [diff] [blame] | 2840 | "palignr\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Bill Wendling | 1dc817c | 2007-08-10 09:00:17 +0000 | [diff] [blame] | 2841 | [(set VR128:$dst, |
| 2842 | (int_x86_ssse3_palign_r_128 |
| 2843 | VR128:$src1, VR128:$src2, |
| 2844 | imm:$src3))]>, OpSize; |
Dan Gohman | bcb9d46 | 2008-05-28 01:50:19 +0000 | [diff] [blame] | 2845 | def PALIGNR128rm : SS3AI<0x0F, MRMSrcMem, (outs VR128:$dst), |
Bill Wendling | 1dc817c | 2007-08-10 09:00:17 +0000 | [diff] [blame] | 2846 | (ins VR128:$src1, i128mem:$src2, i32imm:$src3), |
Dale Johannesen | 576b27e | 2007-10-11 20:58:37 +0000 | [diff] [blame] | 2847 | "palignr\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Bill Wendling | 1dc817c | 2007-08-10 09:00:17 +0000 | [diff] [blame] | 2848 | [(set VR128:$dst, |
| 2849 | (int_x86_ssse3_palign_r_128 |
| 2850 | VR128:$src1, |
| 2851 | (bitconvert (memopv4i32 addr:$src2)), |
| 2852 | imm:$src3))]>, OpSize; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2853 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2854 | |
Nate Begeman | 080f8e2 | 2009-10-19 02:17:23 +0000 | [diff] [blame] | 2855 | // palignr patterns. |
| 2856 | let AddedComplexity = 5 in { |
| 2857 | def : Pat<(v4i32 (palign:$src3 VR128:$src1, VR128:$src2)), |
| 2858 | (PALIGNR128rr VR128:$src2, VR128:$src1, |
| 2859 | (SHUFFLE_get_palign_imm VR128:$src3))>, |
| 2860 | Requires<[HasSSSE3]>; |
| 2861 | def : Pat<(v4f32 (palign:$src3 VR128:$src1, VR128:$src2)), |
| 2862 | (PALIGNR128rr VR128:$src2, VR128:$src1, |
| 2863 | (SHUFFLE_get_palign_imm VR128:$src3))>, |
| 2864 | Requires<[HasSSSE3]>; |
| 2865 | def : Pat<(v8i16 (palign:$src3 VR128:$src1, VR128:$src2)), |
| 2866 | (PALIGNR128rr VR128:$src2, VR128:$src1, |
| 2867 | (SHUFFLE_get_palign_imm VR128:$src3))>, |
| 2868 | Requires<[HasSSSE3]>; |
| 2869 | def : Pat<(v16i8 (palign:$src3 VR128:$src1, VR128:$src2)), |
| 2870 | (PALIGNR128rr VR128:$src2, VR128:$src1, |
| 2871 | (SHUFFLE_get_palign_imm VR128:$src3))>, |
| 2872 | Requires<[HasSSSE3]>; |
| 2873 | } |
| 2874 | |
Nate Begeman | 2c87c42 | 2009-02-23 08:49:38 +0000 | [diff] [blame] | 2875 | def : Pat<(X86pshufb VR128:$src, VR128:$mask), |
| 2876 | (PSHUFBrr128 VR128:$src, VR128:$mask)>, Requires<[HasSSSE3]>; |
| 2877 | def : Pat<(X86pshufb VR128:$src, (bc_v16i8 (memopv2i64 addr:$mask))), |
| 2878 | (PSHUFBrm128 VR128:$src, addr:$mask)>, Requires<[HasSSSE3]>; |
| 2879 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2880 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2881 | // Non-Instruction Patterns |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2882 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2883 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2884 | // extload f32 -> f64. This matches load+fextend because we have a hack in |
| 2885 | // the isel (PreprocessForFPConvert) that can introduce loads after dag |
| 2886 | // combine. |
Chris Lattner | dec9cb5 | 2008-01-24 08:07:48 +0000 | [diff] [blame] | 2887 | // Since these loads aren't folded into the fextend, we have to match it |
| 2888 | // explicitly here. |
| 2889 | let Predicates = [HasSSE2] in |
| 2890 | def : Pat<(fextend (loadf32 addr:$src)), |
| 2891 | (CVTSS2SDrm addr:$src)>; |
| 2892 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2893 | // bit_convert |
| 2894 | let Predicates = [HasSSE2] in { |
| 2895 | def : Pat<(v2i64 (bitconvert (v4i32 VR128:$src))), (v2i64 VR128:$src)>; |
| 2896 | def : Pat<(v2i64 (bitconvert (v8i16 VR128:$src))), (v2i64 VR128:$src)>; |
| 2897 | def : Pat<(v2i64 (bitconvert (v16i8 VR128:$src))), (v2i64 VR128:$src)>; |
| 2898 | def : Pat<(v2i64 (bitconvert (v2f64 VR128:$src))), (v2i64 VR128:$src)>; |
| 2899 | def : Pat<(v2i64 (bitconvert (v4f32 VR128:$src))), (v2i64 VR128:$src)>; |
| 2900 | def : Pat<(v4i32 (bitconvert (v2i64 VR128:$src))), (v4i32 VR128:$src)>; |
| 2901 | def : Pat<(v4i32 (bitconvert (v8i16 VR128:$src))), (v4i32 VR128:$src)>; |
| 2902 | def : Pat<(v4i32 (bitconvert (v16i8 VR128:$src))), (v4i32 VR128:$src)>; |
| 2903 | def : Pat<(v4i32 (bitconvert (v2f64 VR128:$src))), (v4i32 VR128:$src)>; |
| 2904 | def : Pat<(v4i32 (bitconvert (v4f32 VR128:$src))), (v4i32 VR128:$src)>; |
| 2905 | def : Pat<(v8i16 (bitconvert (v2i64 VR128:$src))), (v8i16 VR128:$src)>; |
| 2906 | def : Pat<(v8i16 (bitconvert (v4i32 VR128:$src))), (v8i16 VR128:$src)>; |
| 2907 | def : Pat<(v8i16 (bitconvert (v16i8 VR128:$src))), (v8i16 VR128:$src)>; |
| 2908 | def : Pat<(v8i16 (bitconvert (v2f64 VR128:$src))), (v8i16 VR128:$src)>; |
| 2909 | def : Pat<(v8i16 (bitconvert (v4f32 VR128:$src))), (v8i16 VR128:$src)>; |
| 2910 | def : Pat<(v16i8 (bitconvert (v2i64 VR128:$src))), (v16i8 VR128:$src)>; |
| 2911 | def : Pat<(v16i8 (bitconvert (v4i32 VR128:$src))), (v16i8 VR128:$src)>; |
| 2912 | def : Pat<(v16i8 (bitconvert (v8i16 VR128:$src))), (v16i8 VR128:$src)>; |
| 2913 | def : Pat<(v16i8 (bitconvert (v2f64 VR128:$src))), (v16i8 VR128:$src)>; |
| 2914 | def : Pat<(v16i8 (bitconvert (v4f32 VR128:$src))), (v16i8 VR128:$src)>; |
| 2915 | def : Pat<(v4f32 (bitconvert (v2i64 VR128:$src))), (v4f32 VR128:$src)>; |
| 2916 | def : Pat<(v4f32 (bitconvert (v4i32 VR128:$src))), (v4f32 VR128:$src)>; |
| 2917 | def : Pat<(v4f32 (bitconvert (v8i16 VR128:$src))), (v4f32 VR128:$src)>; |
| 2918 | def : Pat<(v4f32 (bitconvert (v16i8 VR128:$src))), (v4f32 VR128:$src)>; |
| 2919 | def : Pat<(v4f32 (bitconvert (v2f64 VR128:$src))), (v4f32 VR128:$src)>; |
| 2920 | def : Pat<(v2f64 (bitconvert (v2i64 VR128:$src))), (v2f64 VR128:$src)>; |
| 2921 | def : Pat<(v2f64 (bitconvert (v4i32 VR128:$src))), (v2f64 VR128:$src)>; |
| 2922 | def : Pat<(v2f64 (bitconvert (v8i16 VR128:$src))), (v2f64 VR128:$src)>; |
| 2923 | def : Pat<(v2f64 (bitconvert (v16i8 VR128:$src))), (v2f64 VR128:$src)>; |
| 2924 | def : Pat<(v2f64 (bitconvert (v4f32 VR128:$src))), (v2f64 VR128:$src)>; |
| 2925 | } |
| 2926 | |
| 2927 | // Move scalar to XMM zero-extended |
| 2928 | // movd to XMM register zero-extends |
| 2929 | let AddedComplexity = 15 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2930 | // Zeroing a VR128 then do a MOVS{S|D} to the lower bits. |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2931 | def : Pat<(v2f64 (X86vzmovl (v2f64 (scalar_to_vector FR64:$src)))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2932 | (MOVLSD2PDrr (V_SET0), FR64:$src)>, Requires<[HasSSE2]>; |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2933 | def : Pat<(v4f32 (X86vzmovl (v4f32 (scalar_to_vector FR32:$src)))), |
Anders Carlsson | fd7e450 | 2008-10-07 16:14:11 +0000 | [diff] [blame] | 2934 | (MOVLSS2PSrr (V_SET0), FR32:$src)>, Requires<[HasSSE1]>; |
Evan Cheng | e259e87 | 2008-05-09 23:37:55 +0000 | [diff] [blame] | 2935 | def : Pat<(v4f32 (X86vzmovl (v4f32 VR128:$src))), |
Anders Carlsson | fd7e450 | 2008-10-07 16:14:11 +0000 | [diff] [blame] | 2936 | (MOVLPSrr (V_SET0), VR128:$src)>, Requires<[HasSSE1]>; |
Evan Cheng | 7fe0ff0 | 2008-07-10 01:08:23 +0000 | [diff] [blame] | 2937 | def : Pat<(v4i32 (X86vzmovl (v4i32 VR128:$src))), |
Anders Carlsson | fd7e450 | 2008-10-07 16:14:11 +0000 | [diff] [blame] | 2938 | (MOVLPSrr (V_SET0), VR128:$src)>, Requires<[HasSSE1]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2939 | } |
| 2940 | |
| 2941 | // Splat v2f64 / v2i64 |
| 2942 | let AddedComplexity = 10 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2943 | def : Pat<(splat_lo (v2f64 VR128:$src), (undef)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2944 | (UNPCKLPDrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2945 | def : Pat<(unpckh (v2f64 VR128:$src), (undef)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2946 | (UNPCKHPDrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2947 | def : Pat<(splat_lo (v2i64 VR128:$src), (undef)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2948 | (PUNPCKLQDQrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2949 | def : Pat<(unpckh (v2i64 VR128:$src), (undef)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2950 | (PUNPCKHQDQrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
| 2951 | } |
| 2952 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2953 | // Special unary SHUFPSrri case. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2954 | def : Pat<(v4f32 (pshufd:$src3 VR128:$src1, (undef))), |
| 2955 | (SHUFPSrri VR128:$src1, VR128:$src1, |
| 2956 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2957 | Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2958 | let AddedComplexity = 5 in |
| 2959 | def : Pat<(v4f32 (pshufd:$src2 VR128:$src1, (undef))), |
| 2960 | (PSHUFDri VR128:$src1, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
| 2961 | Requires<[HasSSE2]>; |
Dan Gohman | 7dc1901 | 2007-08-02 21:17:01 +0000 | [diff] [blame] | 2962 | // Special unary SHUFPDrri case. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2963 | def : Pat<(v2i64 (pshufd:$src3 VR128:$src1, (undef))), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2964 | (SHUFPDrri VR128:$src1, VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2965 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
| 2966 | Requires<[HasSSE2]>; |
| 2967 | // Special unary SHUFPDrri case. |
| 2968 | def : Pat<(v2f64 (pshufd:$src3 VR128:$src1, (undef))), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2969 | (SHUFPDrri VR128:$src1, VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2970 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
Dan Gohman | 7dc1901 | 2007-08-02 21:17:01 +0000 | [diff] [blame] | 2971 | Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2972 | // Unary v4f32 shuffle with PSHUF* in order to fold a load. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2973 | def : Pat<(pshufd:$src2 (bc_v4i32 (memopv4f32 addr:$src1)), (undef)), |
| 2974 | (PSHUFDmi addr:$src1, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2975 | Requires<[HasSSE2]>; |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 2976 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2977 | // Special binary v4i32 shuffle cases with SHUFPS. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2978 | def : Pat<(v4i32 (shufp:$src3 VR128:$src1, (v4i32 VR128:$src2))), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2979 | (SHUFPSrri VR128:$src1, VR128:$src2, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2980 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2981 | Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2982 | def : Pat<(v4i32 (shufp:$src3 VR128:$src1, (bc_v4i32 (memopv2i64 addr:$src2)))), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2983 | (SHUFPSrmi VR128:$src1, addr:$src2, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2984 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2985 | Requires<[HasSSE2]>; |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2986 | // Special binary v2i64 shuffle cases using SHUFPDrri. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2987 | def : Pat<(v2i64 (shufp:$src3 VR128:$src1, VR128:$src2)), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2988 | (SHUFPDrri VR128:$src1, VR128:$src2, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2989 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2990 | Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2991 | |
| 2992 | // vector_shuffle v1, <undef>, <0, 0, 1, 1, ...> |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 2993 | let AddedComplexity = 15 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2994 | def : Pat<(v4i32 (unpckl_undef:$src2 VR128:$src, (undef))), |
| 2995 | (PSHUFDri VR128:$src, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 2996 | Requires<[OptForSpeed, HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2997 | def : Pat<(v4f32 (unpckl_undef:$src2 VR128:$src, (undef))), |
| 2998 | (PSHUFDri VR128:$src, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 2999 | Requires<[OptForSpeed, HasSSE2]>; |
| 3000 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3001 | let AddedComplexity = 10 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3002 | def : Pat<(v4f32 (unpckl_undef VR128:$src, (undef))), |
Evan Cheng | 09d4507 | 2008-09-26 21:26:30 +0000 | [diff] [blame] | 3003 | (UNPCKLPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3004 | def : Pat<(v16i8 (unpckl_undef VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3005 | (PUNPCKLBWrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3006 | def : Pat<(v8i16 (unpckl_undef VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3007 | (PUNPCKLWDrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3008 | def : Pat<(v4i32 (unpckl_undef VR128:$src, (undef))), |
Evan Cheng | 09d4507 | 2008-09-26 21:26:30 +0000 | [diff] [blame] | 3009 | (PUNPCKLDQrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3010 | } |
| 3011 | |
| 3012 | // vector_shuffle v1, <undef>, <2, 2, 3, 3, ...> |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3013 | let AddedComplexity = 15 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3014 | def : Pat<(v4i32 (unpckh_undef:$src2 VR128:$src, (undef))), |
| 3015 | (PSHUFDri VR128:$src, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3016 | Requires<[OptForSpeed, HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3017 | def : Pat<(v4f32 (unpckh_undef:$src2 VR128:$src, (undef))), |
| 3018 | (PSHUFDri VR128:$src, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3019 | Requires<[OptForSpeed, HasSSE2]>; |
| 3020 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3021 | let AddedComplexity = 10 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3022 | def : Pat<(v4f32 (unpckh_undef VR128:$src, (undef))), |
Evan Cheng | 09d4507 | 2008-09-26 21:26:30 +0000 | [diff] [blame] | 3023 | (UNPCKHPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3024 | def : Pat<(v16i8 (unpckh_undef VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3025 | (PUNPCKHBWrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3026 | def : Pat<(v8i16 (unpckh_undef VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3027 | (PUNPCKHWDrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3028 | def : Pat<(v4i32 (unpckh_undef VR128:$src, (undef))), |
Evan Cheng | 09d4507 | 2008-09-26 21:26:30 +0000 | [diff] [blame] | 3029 | (PUNPCKHDQrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3030 | } |
| 3031 | |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3032 | let AddedComplexity = 20 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3033 | // vector_shuffle v1, v2 <0, 1, 4, 5> using MOVLHPS |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3034 | def : Pat<(v4i32 (movhp VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3035 | (MOVLHPSrr VR128:$src1, VR128:$src2)>; |
| 3036 | |
| 3037 | // vector_shuffle v1, v2 <6, 7, 2, 3> using MOVHLPS |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3038 | def : Pat<(v4i32 (movhlps VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3039 | (MOVHLPSrr VR128:$src1, VR128:$src2)>; |
| 3040 | |
| 3041 | // vector_shuffle v1, undef <2, ?, ?, ?> using MOVHLPS |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3042 | def : Pat<(v4f32 (movhlps_undef VR128:$src1, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3043 | (MOVHLPSrr VR128:$src1, VR128:$src1)>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3044 | def : Pat<(v4i32 (movhlps_undef VR128:$src1, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3045 | (MOVHLPSrr VR128:$src1, VR128:$src1)>; |
| 3046 | } |
| 3047 | |
| 3048 | let AddedComplexity = 20 in { |
| 3049 | // vector_shuffle v1, (load v2) <4, 5, 2, 3> using MOVLPS |
| 3050 | // vector_shuffle v1, (load v2) <0, 1, 4, 5> using MOVHPS |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3051 | def : Pat<(v4f32 (movlp VR128:$src1, (load addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3052 | (MOVLPSrm VR128:$src1, addr:$src2)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3053 | def : Pat<(v2f64 (movlp VR128:$src1, (load addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3054 | (MOVLPDrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3055 | def : Pat<(v4f32 (movhp VR128:$src1, (load addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3056 | (MOVHPSrm VR128:$src1, addr:$src2)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3057 | def : Pat<(v2f64 (movhp VR128:$src1, (load addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3058 | (MOVHPDrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
| 3059 | |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3060 | def : Pat<(v4i32 (movlp VR128:$src1, (load addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3061 | (MOVLPSrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3062 | def : Pat<(v2i64 (movlp VR128:$src1, (load addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3063 | (MOVLPDrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3064 | def : Pat<(v4i32 (movhp VR128:$src1, (load addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3065 | (MOVHPSrm VR128:$src1, addr:$src2)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3066 | def : Pat<(v2i64 (movhp VR128:$src1, (load addr:$src2))), |
Evan Cheng | 1ff2ea5 | 2008-05-23 18:00:18 +0000 | [diff] [blame] | 3067 | (MOVHPDrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3068 | } |
| 3069 | |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3070 | // (store (vector_shuffle (load addr), v2, <4, 5, 2, 3>), addr) using MOVLPS |
| 3071 | // (store (vector_shuffle (load addr), v2, <0, 1, 4, 5>), addr) using MOVHPS |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3072 | def : Pat<(store (v4f32 (movlp (load addr:$src1), VR128:$src2)), addr:$src1), |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3073 | (MOVLPSmr addr:$src1, VR128:$src2)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3074 | def : Pat<(store (v2f64 (movlp (load addr:$src1), VR128:$src2)), addr:$src1), |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3075 | (MOVLPDmr addr:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3076 | def : Pat<(store (v4f32 (movhp (load addr:$src1), VR128:$src2)), addr:$src1), |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3077 | (MOVHPSmr addr:$src1, VR128:$src2)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3078 | def : Pat<(store (v2f64 (movhp (load addr:$src1), VR128:$src2)), addr:$src1), |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3079 | (MOVHPDmr addr:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
| 3080 | |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3081 | def : Pat<(store (v4i32 (movlp (bc_v4i32 (loadv2i64 addr:$src1)), VR128:$src2)), |
| 3082 | addr:$src1), |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3083 | (MOVLPSmr addr:$src1, VR128:$src2)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3084 | def : Pat<(store (v2i64 (movlp (load addr:$src1), VR128:$src2)), addr:$src1), |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3085 | (MOVLPDmr addr:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3086 | def : Pat<(store (v4i32 (movhp (bc_v4i32 (loadv2i64 addr:$src1)), VR128:$src2)), |
| 3087 | addr:$src1), |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3088 | (MOVHPSmr addr:$src1, VR128:$src2)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3089 | def : Pat<(store (v2i64 (movhp (load addr:$src1), VR128:$src2)), addr:$src1), |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3090 | (MOVHPDmr addr:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
| 3091 | |
| 3092 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3093 | let AddedComplexity = 15 in { |
| 3094 | // Setting the lowest element in the vector. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3095 | def : Pat<(v4i32 (movl VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3096 | (MOVLPSrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3097 | def : Pat<(v2i64 (movl VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3098 | (MOVLPDrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
| 3099 | |
| 3100 | // vector_shuffle v1, v2 <4, 5, 2, 3> using MOVLPDrr (movsd) |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3101 | def : Pat<(v4f32 (movlp VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3102 | (MOVLPDrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3103 | def : Pat<(v4i32 (movlp VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3104 | (MOVLPDrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
| 3105 | } |
| 3106 | |
Eli Friedman | 27d1974 | 2009-06-19 07:00:55 +0000 | [diff] [blame] | 3107 | // vector_shuffle v1, v2 <4, 5, 2, 3> using SHUFPSrri (we prefer movsd, but |
| 3108 | // fall back to this for SSE1) |
| 3109 | def : Pat<(v4f32 (movlp:$src3 VR128:$src1, (v4f32 VR128:$src2))), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3110 | (SHUFPSrri VR128:$src2, VR128:$src1, |
Eli Friedman | 27d1974 | 2009-06-19 07:00:55 +0000 | [diff] [blame] | 3111 | (SHUFFLE_get_shuf_imm VR128:$src3))>, Requires<[HasSSE1]>; |
| 3112 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3113 | // Set lowest element and zero upper elements. |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 3114 | let AddedComplexity = 15 in |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3115 | def : Pat<(v2f64 (movl immAllZerosV_bc, VR128:$src)), |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 3116 | (MOVZPQILo2PQIrr VR128:$src)>, Requires<[HasSSE2]>; |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 3117 | def : Pat<(v2f64 (X86vzmovl (v2f64 VR128:$src))), |
Evan Cheng | d09a8a0 | 2008-05-08 22:35:02 +0000 | [diff] [blame] | 3118 | (MOVZPQILo2PQIrr VR128:$src)>, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3119 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3120 | // Some special case pandn patterns. |
| 3121 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v4i32 immAllOnesV))), |
| 3122 | VR128:$src2)), |
| 3123 | (PANDNrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
| 3124 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v8i16 immAllOnesV))), |
| 3125 | VR128:$src2)), |
| 3126 | (PANDNrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
| 3127 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v16i8 immAllOnesV))), |
| 3128 | VR128:$src2)), |
| 3129 | (PANDNrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
| 3130 | |
| 3131 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v4i32 immAllOnesV))), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3132 | (memop addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3133 | (PANDNrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
| 3134 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v8i16 immAllOnesV))), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3135 | (memop addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3136 | (PANDNrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
| 3137 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v16i8 immAllOnesV))), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3138 | (memop addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3139 | (PANDNrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
| 3140 | |
Nate Begeman | 78246ca | 2007-11-17 03:58:34 +0000 | [diff] [blame] | 3141 | // vector -> vector casts |
| 3142 | def : Pat<(v4f32 (sint_to_fp (v4i32 VR128:$src))), |
| 3143 | (Int_CVTDQ2PSrr VR128:$src)>, Requires<[HasSSE2]>; |
| 3144 | def : Pat<(v4i32 (fp_to_sint (v4f32 VR128:$src))), |
| 3145 | (Int_CVTTPS2DQrr VR128:$src)>, Requires<[HasSSE2]>; |
Eli Friedman | 7fa52ca | 2008-09-05 23:07:03 +0000 | [diff] [blame] | 3146 | def : Pat<(v2f64 (sint_to_fp (v2i32 VR64:$src))), |
| 3147 | (Int_CVTPI2PDrr VR64:$src)>, Requires<[HasSSE2]>; |
| 3148 | def : Pat<(v2i32 (fp_to_sint (v2f64 VR128:$src))), |
| 3149 | (Int_CVTTPD2PIrr VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 78246ca | 2007-11-17 03:58:34 +0000 | [diff] [blame] | 3150 | |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 3151 | // Use movaps / movups for SSE integer load / store (one byte shorter). |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 3152 | def : Pat<(alignedloadv4i32 addr:$src), |
| 3153 | (MOVAPSrm addr:$src)>, Requires<[HasSSE1]>; |
| 3154 | def : Pat<(loadv4i32 addr:$src), |
| 3155 | (MOVUPSrm addr:$src)>, Requires<[HasSSE1]>; |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 3156 | def : Pat<(alignedloadv2i64 addr:$src), |
| 3157 | (MOVAPSrm addr:$src)>, Requires<[HasSSE2]>; |
| 3158 | def : Pat<(loadv2i64 addr:$src), |
| 3159 | (MOVUPSrm addr:$src)>, Requires<[HasSSE2]>; |
| 3160 | |
| 3161 | def : Pat<(alignedstore (v2i64 VR128:$src), addr:$dst), |
| 3162 | (MOVAPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3163 | def : Pat<(alignedstore (v4i32 VR128:$src), addr:$dst), |
| 3164 | (MOVAPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3165 | def : Pat<(alignedstore (v8i16 VR128:$src), addr:$dst), |
| 3166 | (MOVAPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3167 | def : Pat<(alignedstore (v16i8 VR128:$src), addr:$dst), |
| 3168 | (MOVAPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3169 | def : Pat<(store (v2i64 VR128:$src), addr:$dst), |
| 3170 | (MOVUPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3171 | def : Pat<(store (v4i32 VR128:$src), addr:$dst), |
| 3172 | (MOVUPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3173 | def : Pat<(store (v8i16 VR128:$src), addr:$dst), |
| 3174 | (MOVUPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3175 | def : Pat<(store (v16i8 VR128:$src), addr:$dst), |
| 3176 | (MOVUPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3177 | |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3178 | //===----------------------------------------------------------------------===// |
| 3179 | // SSE4.1 Instructions |
| 3180 | //===----------------------------------------------------------------------===// |
| 3181 | |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3182 | multiclass sse41_fp_unop_rm<bits<8> opcps, bits<8> opcpd, |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3183 | string OpcodeStr, |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3184 | Intrinsic V4F32Int, |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3185 | Intrinsic V2F64Int> { |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3186 | // Intrinsic operation, reg. |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3187 | // Vector intrinsic operation, reg |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3188 | def PSr_Int : SS4AIi8<opcps, MRMSrcReg, |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3189 | (outs VR128:$dst), (ins VR128:$src1, i32i8imm:$src2), |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3190 | !strconcat(OpcodeStr, |
| 3191 | "ps\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3192 | [(set VR128:$dst, (V4F32Int VR128:$src1, imm:$src2))]>, |
| 3193 | OpSize; |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3194 | |
| 3195 | // Vector intrinsic operation, mem |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3196 | def PSm_Int : SS4AIi8<opcps, MRMSrcMem, |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3197 | (outs VR128:$dst), (ins f128mem:$src1, i32i8imm:$src2), |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3198 | !strconcat(OpcodeStr, |
| 3199 | "ps\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3200 | [(set VR128:$dst, |
| 3201 | (V4F32Int (memopv4f32 addr:$src1),imm:$src2))]>, |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3202 | OpSize; |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3203 | |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3204 | // Vector intrinsic operation, reg |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3205 | def PDr_Int : SS4AIi8<opcpd, MRMSrcReg, |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3206 | (outs VR128:$dst), (ins VR128:$src1, i32i8imm:$src2), |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3207 | !strconcat(OpcodeStr, |
| 3208 | "pd\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3209 | [(set VR128:$dst, (V2F64Int VR128:$src1, imm:$src2))]>, |
| 3210 | OpSize; |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3211 | |
| 3212 | // Vector intrinsic operation, mem |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3213 | def PDm_Int : SS4AIi8<opcpd, MRMSrcMem, |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3214 | (outs VR128:$dst), (ins f128mem:$src1, i32i8imm:$src2), |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3215 | !strconcat(OpcodeStr, |
| 3216 | "pd\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3217 | [(set VR128:$dst, |
| 3218 | (V2F64Int (memopv2f64 addr:$src1),imm:$src2))]>, |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3219 | OpSize; |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3220 | } |
| 3221 | |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3222 | let Constraints = "$src1 = $dst" in { |
| 3223 | multiclass sse41_fp_binop_rm<bits<8> opcss, bits<8> opcsd, |
| 3224 | string OpcodeStr, |
| 3225 | Intrinsic F32Int, |
| 3226 | Intrinsic F64Int> { |
| 3227 | // Intrinsic operation, reg. |
| 3228 | def SSr_Int : SS4AIi8<opcss, MRMSrcReg, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3229 | (outs VR128:$dst), |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3230 | (ins VR128:$src1, VR128:$src2, i32i8imm:$src3), |
| 3231 | !strconcat(OpcodeStr, |
| 3232 | "ss\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3233 | [(set VR128:$dst, |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3234 | (F32Int VR128:$src1, VR128:$src2, imm:$src3))]>, |
| 3235 | OpSize; |
| 3236 | |
| 3237 | // Intrinsic operation, mem. |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3238 | def SSm_Int : SS4AIi8<opcss, MRMSrcMem, |
| 3239 | (outs VR128:$dst), |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3240 | (ins VR128:$src1, ssmem:$src2, i32i8imm:$src3), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3241 | !strconcat(OpcodeStr, |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3242 | "ss\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3243 | [(set VR128:$dst, |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3244 | (F32Int VR128:$src1, sse_load_f32:$src2, imm:$src3))]>, |
| 3245 | OpSize; |
| 3246 | |
| 3247 | // Intrinsic operation, reg. |
| 3248 | def SDr_Int : SS4AIi8<opcsd, MRMSrcReg, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3249 | (outs VR128:$dst), |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3250 | (ins VR128:$src1, VR128:$src2, i32i8imm:$src3), |
| 3251 | !strconcat(OpcodeStr, |
| 3252 | "sd\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3253 | [(set VR128:$dst, |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3254 | (F64Int VR128:$src1, VR128:$src2, imm:$src3))]>, |
| 3255 | OpSize; |
| 3256 | |
| 3257 | // Intrinsic operation, mem. |
| 3258 | def SDm_Int : SS4AIi8<opcsd, MRMSrcMem, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3259 | (outs VR128:$dst), |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3260 | (ins VR128:$src1, sdmem:$src2, i32i8imm:$src3), |
| 3261 | !strconcat(OpcodeStr, |
| 3262 | "sd\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3263 | [(set VR128:$dst, |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3264 | (F64Int VR128:$src1, sse_load_f64:$src2, imm:$src3))]>, |
| 3265 | OpSize; |
| 3266 | } |
| 3267 | } |
| 3268 | |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3269 | // FP round - roundss, roundps, roundsd, roundpd |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3270 | defm ROUND : sse41_fp_unop_rm<0x08, 0x09, "round", |
| 3271 | int_x86_sse41_round_ps, int_x86_sse41_round_pd>; |
| 3272 | defm ROUND : sse41_fp_binop_rm<0x0A, 0x0B, "round", |
| 3273 | int_x86_sse41_round_ss, int_x86_sse41_round_sd>; |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3274 | |
| 3275 | // SS41I_unop_rm_int_v16 - SSE 4.1 unary operator whose type is v8i16. |
| 3276 | multiclass SS41I_unop_rm_int_v16<bits<8> opc, string OpcodeStr, |
| 3277 | Intrinsic IntId128> { |
| 3278 | def rr128 : SS48I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3279 | (ins VR128:$src), |
| 3280 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 3281 | [(set VR128:$dst, (IntId128 VR128:$src))]>, OpSize; |
| 3282 | def rm128 : SS48I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3283 | (ins i128mem:$src), |
| 3284 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 3285 | [(set VR128:$dst, |
| 3286 | (IntId128 |
| 3287 | (bitconvert (memopv8i16 addr:$src))))]>, OpSize; |
| 3288 | } |
| 3289 | |
| 3290 | defm PHMINPOSUW : SS41I_unop_rm_int_v16 <0x41, "phminposuw", |
| 3291 | int_x86_sse41_phminposuw>; |
| 3292 | |
| 3293 | /// SS41I_binop_rm_int - Simple SSE 4.1 binary operator |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3294 | let Constraints = "$src1 = $dst" in { |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3295 | multiclass SS41I_binop_rm_int<bits<8> opc, string OpcodeStr, |
| 3296 | Intrinsic IntId128, bit Commutable = 0> { |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3297 | def rr : SS48I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3298 | (ins VR128:$src1, VR128:$src2), |
| 3299 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3300 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 3301 | OpSize { |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3302 | let isCommutable = Commutable; |
| 3303 | } |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3304 | def rm : SS48I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3305 | (ins VR128:$src1, i128mem:$src2), |
| 3306 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3307 | [(set VR128:$dst, |
| 3308 | (IntId128 VR128:$src1, |
| 3309 | (bitconvert (memopv16i8 addr:$src2))))]>, OpSize; |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3310 | } |
| 3311 | } |
| 3312 | |
| 3313 | defm PCMPEQQ : SS41I_binop_rm_int<0x29, "pcmpeqq", |
| 3314 | int_x86_sse41_pcmpeqq, 1>; |
| 3315 | defm PACKUSDW : SS41I_binop_rm_int<0x2B, "packusdw", |
| 3316 | int_x86_sse41_packusdw, 0>; |
| 3317 | defm PMINSB : SS41I_binop_rm_int<0x38, "pminsb", |
| 3318 | int_x86_sse41_pminsb, 1>; |
| 3319 | defm PMINSD : SS41I_binop_rm_int<0x39, "pminsd", |
| 3320 | int_x86_sse41_pminsd, 1>; |
| 3321 | defm PMINUD : SS41I_binop_rm_int<0x3B, "pminud", |
| 3322 | int_x86_sse41_pminud, 1>; |
| 3323 | defm PMINUW : SS41I_binop_rm_int<0x3A, "pminuw", |
| 3324 | int_x86_sse41_pminuw, 1>; |
| 3325 | defm PMAXSB : SS41I_binop_rm_int<0x3C, "pmaxsb", |
| 3326 | int_x86_sse41_pmaxsb, 1>; |
| 3327 | defm PMAXSD : SS41I_binop_rm_int<0x3D, "pmaxsd", |
| 3328 | int_x86_sse41_pmaxsd, 1>; |
| 3329 | defm PMAXUD : SS41I_binop_rm_int<0x3F, "pmaxud", |
| 3330 | int_x86_sse41_pmaxud, 1>; |
| 3331 | defm PMAXUW : SS41I_binop_rm_int<0x3E, "pmaxuw", |
| 3332 | int_x86_sse41_pmaxuw, 1>; |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3333 | |
Mon P Wang | 14edb09 | 2008-12-18 21:42:19 +0000 | [diff] [blame] | 3334 | defm PMULDQ : SS41I_binop_rm_int<0x28, "pmuldq", int_x86_sse41_pmuldq, 1>; |
| 3335 | |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 3336 | def : Pat<(v2i64 (X86pcmpeqq VR128:$src1, VR128:$src2)), |
| 3337 | (PCMPEQQrr VR128:$src1, VR128:$src2)>; |
| 3338 | def : Pat<(v2i64 (X86pcmpeqq VR128:$src1, (memop addr:$src2))), |
| 3339 | (PCMPEQQrm VR128:$src1, addr:$src2)>; |
| 3340 | |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3341 | /// SS41I_binop_rm_int - Simple SSE 4.1 binary operator |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3342 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | e3731f5 | 2008-05-23 17:49:40 +0000 | [diff] [blame] | 3343 | multiclass SS41I_binop_patint<bits<8> opc, string OpcodeStr, ValueType OpVT, |
| 3344 | SDNode OpNode, Intrinsic IntId128, |
| 3345 | bit Commutable = 0> { |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3346 | def rr : SS48I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3347 | (ins VR128:$src1, VR128:$src2), |
| 3348 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | e3731f5 | 2008-05-23 17:49:40 +0000 | [diff] [blame] | 3349 | [(set VR128:$dst, (OpNode (OpVT VR128:$src1), |
| 3350 | VR128:$src2))]>, OpSize { |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3351 | let isCommutable = Commutable; |
| 3352 | } |
| 3353 | def rr_int : SS48I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3354 | (ins VR128:$src1, VR128:$src2), |
| 3355 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3356 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 3357 | OpSize { |
| 3358 | let isCommutable = Commutable; |
| 3359 | } |
| 3360 | def rm : SS48I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3361 | (ins VR128:$src1, i128mem:$src2), |
| 3362 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3363 | [(set VR128:$dst, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3364 | (OpNode VR128:$src1, (memop addr:$src2)))]>, OpSize; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3365 | def rm_int : SS48I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3366 | (ins VR128:$src1, i128mem:$src2), |
| 3367 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3368 | [(set VR128:$dst, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3369 | (IntId128 VR128:$src1, (memop addr:$src2)))]>, |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3370 | OpSize; |
| 3371 | } |
| 3372 | } |
Dan Gohman | e3731f5 | 2008-05-23 17:49:40 +0000 | [diff] [blame] | 3373 | defm PMULLD : SS41I_binop_patint<0x40, "pmulld", v4i32, mul, |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3374 | int_x86_sse41_pmulld, 1>; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3375 | |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3376 | /// SS41I_binop_rmi_int - SSE 4.1 binary operator with 8-bit immediate |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3377 | let Constraints = "$src1 = $dst" in { |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3378 | multiclass SS41I_binop_rmi_int<bits<8> opc, string OpcodeStr, |
| 3379 | Intrinsic IntId128, bit Commutable = 0> { |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3380 | def rri : SS4AIi8<opc, MRMSrcReg, (outs VR128:$dst), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3381 | (ins VR128:$src1, VR128:$src2, i32i8imm:$src3), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3382 | !strconcat(OpcodeStr, |
Nate Begeman | b4e9a04 | 2008-02-10 18:47:57 +0000 | [diff] [blame] | 3383 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3384 | [(set VR128:$dst, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3385 | (IntId128 VR128:$src1, VR128:$src2, imm:$src3))]>, |
| 3386 | OpSize { |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3387 | let isCommutable = Commutable; |
| 3388 | } |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3389 | def rmi : SS4AIi8<opc, MRMSrcMem, (outs VR128:$dst), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3390 | (ins VR128:$src1, i128mem:$src2, i32i8imm:$src3), |
| 3391 | !strconcat(OpcodeStr, |
Nate Begeman | b4e9a04 | 2008-02-10 18:47:57 +0000 | [diff] [blame] | 3392 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3393 | [(set VR128:$dst, |
| 3394 | (IntId128 VR128:$src1, |
| 3395 | (bitconvert (memopv16i8 addr:$src2)), imm:$src3))]>, |
| 3396 | OpSize; |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3397 | } |
| 3398 | } |
| 3399 | |
| 3400 | defm BLENDPS : SS41I_binop_rmi_int<0x0C, "blendps", |
| 3401 | int_x86_sse41_blendps, 0>; |
| 3402 | defm BLENDPD : SS41I_binop_rmi_int<0x0D, "blendpd", |
| 3403 | int_x86_sse41_blendpd, 0>; |
| 3404 | defm PBLENDW : SS41I_binop_rmi_int<0x0E, "pblendw", |
| 3405 | int_x86_sse41_pblendw, 0>; |
| 3406 | defm DPPS : SS41I_binop_rmi_int<0x40, "dpps", |
| 3407 | int_x86_sse41_dpps, 1>; |
| 3408 | defm DPPD : SS41I_binop_rmi_int<0x41, "dppd", |
| 3409 | int_x86_sse41_dppd, 1>; |
| 3410 | defm MPSADBW : SS41I_binop_rmi_int<0x42, "mpsadbw", |
Evan Cheng | 81ed985 | 2008-06-16 20:25:59 +0000 | [diff] [blame] | 3411 | int_x86_sse41_mpsadbw, 1>; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3412 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3413 | |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3414 | /// SS41I_ternary_int - SSE 4.1 ternary operator |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3415 | let Uses = [XMM0], Constraints = "$src1 = $dst" in { |
Nate Begeman | b4e9a04 | 2008-02-10 18:47:57 +0000 | [diff] [blame] | 3416 | multiclass SS41I_ternary_int<bits<8> opc, string OpcodeStr, Intrinsic IntId> { |
| 3417 | def rr0 : SS48I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3418 | (ins VR128:$src1, VR128:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3419 | !strconcat(OpcodeStr, |
Nate Begeman | b4e9a04 | 2008-02-10 18:47:57 +0000 | [diff] [blame] | 3420 | "\t{%xmm0, $src2, $dst|$dst, $src2, %xmm0}"), |
| 3421 | [(set VR128:$dst, (IntId VR128:$src1, VR128:$src2, XMM0))]>, |
| 3422 | OpSize; |
| 3423 | |
| 3424 | def rm0 : SS48I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3425 | (ins VR128:$src1, i128mem:$src2), |
| 3426 | !strconcat(OpcodeStr, |
| 3427 | "\t{%xmm0, $src2, $dst|$dst, $src2, %xmm0}"), |
| 3428 | [(set VR128:$dst, |
| 3429 | (IntId VR128:$src1, |
| 3430 | (bitconvert (memopv16i8 addr:$src2)), XMM0))]>, OpSize; |
| 3431 | } |
| 3432 | } |
| 3433 | |
| 3434 | defm BLENDVPD : SS41I_ternary_int<0x15, "blendvpd", int_x86_sse41_blendvpd>; |
| 3435 | defm BLENDVPS : SS41I_ternary_int<0x14, "blendvps", int_x86_sse41_blendvps>; |
| 3436 | defm PBLENDVB : SS41I_ternary_int<0x10, "pblendvb", int_x86_sse41_pblendvb>; |
| 3437 | |
| 3438 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3439 | multiclass SS41I_binop_rm_int8<bits<8> opc, string OpcodeStr, Intrinsic IntId> { |
| 3440 | def rr : SS48I<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 3441 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 3442 | [(set VR128:$dst, (IntId VR128:$src))]>, OpSize; |
| 3443 | |
| 3444 | def rm : SS48I<opc, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), |
| 3445 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3446 | [(set VR128:$dst, |
| 3447 | (IntId (bitconvert (v2i64 (scalar_to_vector (loadi64 addr:$src))))))]>, |
| 3448 | OpSize; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3449 | } |
| 3450 | |
| 3451 | defm PMOVSXBW : SS41I_binop_rm_int8<0x20, "pmovsxbw", int_x86_sse41_pmovsxbw>; |
| 3452 | defm PMOVSXWD : SS41I_binop_rm_int8<0x23, "pmovsxwd", int_x86_sse41_pmovsxwd>; |
| 3453 | defm PMOVSXDQ : SS41I_binop_rm_int8<0x25, "pmovsxdq", int_x86_sse41_pmovsxdq>; |
| 3454 | defm PMOVZXBW : SS41I_binop_rm_int8<0x30, "pmovzxbw", int_x86_sse41_pmovzxbw>; |
| 3455 | defm PMOVZXWD : SS41I_binop_rm_int8<0x33, "pmovzxwd", int_x86_sse41_pmovzxwd>; |
| 3456 | defm PMOVZXDQ : SS41I_binop_rm_int8<0x35, "pmovzxdq", int_x86_sse41_pmovzxdq>; |
| 3457 | |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3458 | // Common patterns involving scalar load. |
| 3459 | def : Pat<(int_x86_sse41_pmovsxbw (vzmovl_v2i64 addr:$src)), |
| 3460 | (PMOVSXBWrm addr:$src)>, Requires<[HasSSE41]>; |
| 3461 | def : Pat<(int_x86_sse41_pmovsxbw (vzload_v2i64 addr:$src)), |
| 3462 | (PMOVSXBWrm addr:$src)>, Requires<[HasSSE41]>; |
| 3463 | |
| 3464 | def : Pat<(int_x86_sse41_pmovsxwd (vzmovl_v2i64 addr:$src)), |
| 3465 | (PMOVSXWDrm addr:$src)>, Requires<[HasSSE41]>; |
| 3466 | def : Pat<(int_x86_sse41_pmovsxwd (vzload_v2i64 addr:$src)), |
| 3467 | (PMOVSXWDrm addr:$src)>, Requires<[HasSSE41]>; |
| 3468 | |
| 3469 | def : Pat<(int_x86_sse41_pmovsxdq (vzmovl_v2i64 addr:$src)), |
| 3470 | (PMOVSXDQrm addr:$src)>, Requires<[HasSSE41]>; |
| 3471 | def : Pat<(int_x86_sse41_pmovsxdq (vzload_v2i64 addr:$src)), |
| 3472 | (PMOVSXDQrm addr:$src)>, Requires<[HasSSE41]>; |
| 3473 | |
| 3474 | def : Pat<(int_x86_sse41_pmovzxbw (vzmovl_v2i64 addr:$src)), |
| 3475 | (PMOVZXBWrm addr:$src)>, Requires<[HasSSE41]>; |
| 3476 | def : Pat<(int_x86_sse41_pmovzxbw (vzload_v2i64 addr:$src)), |
| 3477 | (PMOVZXBWrm addr:$src)>, Requires<[HasSSE41]>; |
| 3478 | |
| 3479 | def : Pat<(int_x86_sse41_pmovzxwd (vzmovl_v2i64 addr:$src)), |
| 3480 | (PMOVZXWDrm addr:$src)>, Requires<[HasSSE41]>; |
| 3481 | def : Pat<(int_x86_sse41_pmovzxwd (vzload_v2i64 addr:$src)), |
| 3482 | (PMOVZXWDrm addr:$src)>, Requires<[HasSSE41]>; |
| 3483 | |
| 3484 | def : Pat<(int_x86_sse41_pmovzxdq (vzmovl_v2i64 addr:$src)), |
| 3485 | (PMOVZXDQrm addr:$src)>, Requires<[HasSSE41]>; |
| 3486 | def : Pat<(int_x86_sse41_pmovzxdq (vzload_v2i64 addr:$src)), |
| 3487 | (PMOVZXDQrm addr:$src)>, Requires<[HasSSE41]>; |
| 3488 | |
| 3489 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3490 | multiclass SS41I_binop_rm_int4<bits<8> opc, string OpcodeStr, Intrinsic IntId> { |
| 3491 | def rr : SS48I<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 3492 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 3493 | [(set VR128:$dst, (IntId VR128:$src))]>, OpSize; |
| 3494 | |
| 3495 | def rm : SS48I<opc, MRMSrcMem, (outs VR128:$dst), (ins i32mem:$src), |
| 3496 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3497 | [(set VR128:$dst, |
| 3498 | (IntId (bitconvert (v4i32 (scalar_to_vector (loadi32 addr:$src))))))]>, |
| 3499 | OpSize; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3500 | } |
| 3501 | |
| 3502 | defm PMOVSXBD : SS41I_binop_rm_int4<0x21, "pmovsxbd", int_x86_sse41_pmovsxbd>; |
| 3503 | defm PMOVSXWQ : SS41I_binop_rm_int4<0x24, "pmovsxwq", int_x86_sse41_pmovsxwq>; |
| 3504 | defm PMOVZXBD : SS41I_binop_rm_int4<0x31, "pmovzxbd", int_x86_sse41_pmovzxbd>; |
| 3505 | defm PMOVZXWQ : SS41I_binop_rm_int4<0x34, "pmovzxwq", int_x86_sse41_pmovzxwq>; |
| 3506 | |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3507 | // Common patterns involving scalar load |
| 3508 | def : Pat<(int_x86_sse41_pmovsxbd (vzmovl_v4i32 addr:$src)), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3509 | (PMOVSXBDrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3510 | def : Pat<(int_x86_sse41_pmovsxwq (vzmovl_v4i32 addr:$src)), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3511 | (PMOVSXWQrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3512 | |
| 3513 | def : Pat<(int_x86_sse41_pmovzxbd (vzmovl_v4i32 addr:$src)), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3514 | (PMOVZXBDrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3515 | def : Pat<(int_x86_sse41_pmovzxwq (vzmovl_v4i32 addr:$src)), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3516 | (PMOVZXWQrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3517 | |
| 3518 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3519 | multiclass SS41I_binop_rm_int2<bits<8> opc, string OpcodeStr, Intrinsic IntId> { |
| 3520 | def rr : SS48I<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 3521 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 3522 | [(set VR128:$dst, (IntId VR128:$src))]>, OpSize; |
| 3523 | |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3524 | // Expecting a i16 load any extended to i32 value. |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3525 | def rm : SS48I<opc, MRMSrcMem, (outs VR128:$dst), (ins i16mem:$src), |
| 3526 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3527 | [(set VR128:$dst, (IntId (bitconvert |
| 3528 | (v4i32 (scalar_to_vector (loadi16_anyext addr:$src))))))]>, |
| 3529 | OpSize; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3530 | } |
| 3531 | |
| 3532 | defm PMOVSXBQ : SS41I_binop_rm_int2<0x22, "pmovsxbq", int_x86_sse41_pmovsxbq>; |
Eli Friedman | 75a89d6 | 2009-06-06 05:55:37 +0000 | [diff] [blame] | 3533 | defm PMOVZXBQ : SS41I_binop_rm_int2<0x32, "pmovzxbq", int_x86_sse41_pmovzxbq>; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3534 | |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3535 | // Common patterns involving scalar load |
| 3536 | def : Pat<(int_x86_sse41_pmovsxbq |
| 3537 | (bitconvert (v4i32 (X86vzmovl |
| 3538 | (v4i32 (scalar_to_vector (loadi32 addr:$src))))))), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3539 | (PMOVSXBQrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3540 | |
| 3541 | def : Pat<(int_x86_sse41_pmovzxbq |
| 3542 | (bitconvert (v4i32 (X86vzmovl |
| 3543 | (v4i32 (scalar_to_vector (loadi32 addr:$src))))))), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3544 | (PMOVZXBQrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3545 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3546 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3547 | /// SS41I_binop_ext8 - SSE 4.1 extract 8 bits to 32 bit reg or 8 bit mem |
| 3548 | multiclass SS41I_extract8<bits<8> opc, string OpcodeStr> { |
Evan Cheng | c2054be | 2008-03-26 08:11:49 +0000 | [diff] [blame] | 3549 | def rr : SS4AIi8<opc, MRMDestReg, (outs GR32:$dst), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3550 | (ins VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3551 | !strconcat(OpcodeStr, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3552 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3553 | [(set GR32:$dst, (X86pextrb (v16i8 VR128:$src1), imm:$src2))]>, |
| 3554 | OpSize; |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3555 | def mr : SS4AIi8<opc, MRMDestMem, (outs), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3556 | (ins i8mem:$dst, VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3557 | !strconcat(OpcodeStr, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3558 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3559 | []>, OpSize; |
| 3560 | // FIXME: |
| 3561 | // There's an AssertZext in the way of writing the store pattern |
| 3562 | // (store (i8 (trunc (X86pextrb (v16i8 VR128:$src1), imm:$src2))), addr:$dst) |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3563 | } |
| 3564 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3565 | defm PEXTRB : SS41I_extract8<0x14, "pextrb">; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3566 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3567 | |
| 3568 | /// SS41I_extract16 - SSE 4.1 extract 16 bits to memory destination |
| 3569 | multiclass SS41I_extract16<bits<8> opc, string OpcodeStr> { |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3570 | def mr : SS4AIi8<opc, MRMDestMem, (outs), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3571 | (ins i16mem:$dst, VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3572 | !strconcat(OpcodeStr, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3573 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
| 3574 | []>, OpSize; |
| 3575 | // FIXME: |
| 3576 | // There's an AssertZext in the way of writing the store pattern |
| 3577 | // (store (i16 (trunc (X86pextrw (v16i8 VR128:$src1), imm:$src2))), addr:$dst) |
| 3578 | } |
| 3579 | |
| 3580 | defm PEXTRW : SS41I_extract16<0x15, "pextrw">; |
| 3581 | |
| 3582 | |
| 3583 | /// SS41I_extract32 - SSE 4.1 extract 32 bits to int reg or memory destination |
| 3584 | multiclass SS41I_extract32<bits<8> opc, string OpcodeStr> { |
Evan Cheng | c2054be | 2008-03-26 08:11:49 +0000 | [diff] [blame] | 3585 | def rr : SS4AIi8<opc, MRMDestReg, (outs GR32:$dst), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3586 | (ins VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3587 | !strconcat(OpcodeStr, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3588 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
| 3589 | [(set GR32:$dst, |
| 3590 | (extractelt (v4i32 VR128:$src1), imm:$src2))]>, OpSize; |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3591 | def mr : SS4AIi8<opc, MRMDestMem, (outs), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3592 | (ins i32mem:$dst, VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3593 | !strconcat(OpcodeStr, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3594 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
| 3595 | [(store (extractelt (v4i32 VR128:$src1), imm:$src2), |
| 3596 | addr:$dst)]>, OpSize; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3597 | } |
| 3598 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3599 | defm PEXTRD : SS41I_extract32<0x16, "pextrd">; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3600 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3601 | |
Evan Cheng | 6c24933 | 2008-03-24 21:52:23 +0000 | [diff] [blame] | 3602 | /// SS41I_extractf32 - SSE 4.1 extract 32 bits fp value to int reg or memory |
| 3603 | /// destination |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3604 | multiclass SS41I_extractf32<bits<8> opc, string OpcodeStr> { |
Evan Cheng | c2054be | 2008-03-26 08:11:49 +0000 | [diff] [blame] | 3605 | def rr : SS4AIi8<opc, MRMDestReg, (outs GR32:$dst), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3606 | (ins VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3607 | !strconcat(OpcodeStr, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3608 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Dan Gohman | 788db59 | 2008-04-16 02:32:24 +0000 | [diff] [blame] | 3609 | [(set GR32:$dst, |
| 3610 | (extractelt (bc_v4i32 (v4f32 VR128:$src1)), imm:$src2))]>, |
Evan Cheng | 6c24933 | 2008-03-24 21:52:23 +0000 | [diff] [blame] | 3611 | OpSize; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3612 | def mr : SS4AIi8<opc, MRMDestMem, (outs), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3613 | (ins f32mem:$dst, VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3614 | !strconcat(OpcodeStr, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3615 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Evan Cheng | 6c24933 | 2008-03-24 21:52:23 +0000 | [diff] [blame] | 3616 | [(store (extractelt (bc_v4i32 (v4f32 VR128:$src1)), imm:$src2), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3617 | addr:$dst)]>, OpSize; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3618 | } |
| 3619 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3620 | defm EXTRACTPS : SS41I_extractf32<0x17, "extractps">; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3621 | |
Dan Gohman | a41862a | 2008-08-08 18:30:21 +0000 | [diff] [blame] | 3622 | // Also match an EXTRACTPS store when the store is done as f32 instead of i32. |
| 3623 | def : Pat<(store (f32 (bitconvert (extractelt (bc_v4i32 (v4f32 VR128:$src1)), |
| 3624 | imm:$src2))), |
| 3625 | addr:$dst), |
| 3626 | (EXTRACTPSmr addr:$dst, VR128:$src1, imm:$src2)>, |
| 3627 | Requires<[HasSSE41]>; |
| 3628 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3629 | let Constraints = "$src1 = $dst" in { |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3630 | multiclass SS41I_insert8<bits<8> opc, string OpcodeStr> { |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3631 | def rr : SS4AIi8<opc, MRMSrcReg, (outs VR128:$dst), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3632 | (ins VR128:$src1, GR32:$src2, i32i8imm:$src3), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3633 | !strconcat(OpcodeStr, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3634 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3635 | [(set VR128:$dst, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3636 | (X86pinsrb VR128:$src1, GR32:$src2, imm:$src3))]>, OpSize; |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3637 | def rm : SS4AIi8<opc, MRMSrcMem, (outs VR128:$dst), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3638 | (ins VR128:$src1, i8mem:$src2, i32i8imm:$src3), |
| 3639 | !strconcat(OpcodeStr, |
| 3640 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3641 | [(set VR128:$dst, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3642 | (X86pinsrb VR128:$src1, (extloadi8 addr:$src2), |
| 3643 | imm:$src3))]>, OpSize; |
| 3644 | } |
| 3645 | } |
| 3646 | |
| 3647 | defm PINSRB : SS41I_insert8<0x20, "pinsrb">; |
| 3648 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3649 | let Constraints = "$src1 = $dst" in { |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3650 | multiclass SS41I_insert32<bits<8> opc, string OpcodeStr> { |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3651 | def rr : SS4AIi8<opc, MRMSrcReg, (outs VR128:$dst), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3652 | (ins VR128:$src1, GR32:$src2, i32i8imm:$src3), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3653 | !strconcat(OpcodeStr, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3654 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3655 | [(set VR128:$dst, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3656 | (v4i32 (insertelt VR128:$src1, GR32:$src2, imm:$src3)))]>, |
| 3657 | OpSize; |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3658 | def rm : SS4AIi8<opc, MRMSrcMem, (outs VR128:$dst), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3659 | (ins VR128:$src1, i32mem:$src2, i32i8imm:$src3), |
| 3660 | !strconcat(OpcodeStr, |
| 3661 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3662 | [(set VR128:$dst, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3663 | (v4i32 (insertelt VR128:$src1, (loadi32 addr:$src2), |
| 3664 | imm:$src3)))]>, OpSize; |
| 3665 | } |
| 3666 | } |
| 3667 | |
| 3668 | defm PINSRD : SS41I_insert32<0x22, "pinsrd">; |
| 3669 | |
Eric Christopher | a044360 | 2009-07-23 02:22:41 +0000 | [diff] [blame] | 3670 | // insertps has a few different modes, there's the first two here below which |
| 3671 | // are optimized inserts that won't zero arbitrary elements in the destination |
| 3672 | // vector. The next one matches the intrinsic and could zero arbitrary elements |
| 3673 | // in the target vector. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3674 | let Constraints = "$src1 = $dst" in { |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3675 | multiclass SS41I_insertf32<bits<8> opc, string OpcodeStr> { |
Eric Christopher | efb657e | 2009-07-24 00:33:09 +0000 | [diff] [blame] | 3676 | def rr : SS4AIi8<opc, MRMSrcReg, (outs VR128:$dst), |
| 3677 | (ins VR128:$src1, VR128:$src2, i32i8imm:$src3), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3678 | !strconcat(OpcodeStr, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3679 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3680 | [(set VR128:$dst, |
| 3681 | (X86insrtps VR128:$src1, VR128:$src2, imm:$src3))]>, |
| 3682 | OpSize; |
Eric Christopher | efb657e | 2009-07-24 00:33:09 +0000 | [diff] [blame] | 3683 | def rm : SS4AIi8<opc, MRMSrcMem, (outs VR128:$dst), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3684 | (ins VR128:$src1, f32mem:$src2, i32i8imm:$src3), |
| 3685 | !strconcat(OpcodeStr, |
| 3686 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3687 | [(set VR128:$dst, |
Eric Christopher | efb657e | 2009-07-24 00:33:09 +0000 | [diff] [blame] | 3688 | (X86insrtps VR128:$src1, |
| 3689 | (v4f32 (scalar_to_vector (loadf32 addr:$src2))), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3690 | imm:$src3))]>, OpSize; |
| 3691 | } |
| 3692 | } |
| 3693 | |
Evan Cheng | c2054be | 2008-03-26 08:11:49 +0000 | [diff] [blame] | 3694 | defm INSERTPS : SS41I_insertf32<0x21, "insertps">; |
Nate Begeman | 0dd3cb5 | 2008-03-16 21:14:46 +0000 | [diff] [blame] | 3695 | |
Eric Christopher | efb657e | 2009-07-24 00:33:09 +0000 | [diff] [blame] | 3696 | def : Pat<(int_x86_sse41_insertps VR128:$src1, VR128:$src2, imm:$src3), |
| 3697 | (INSERTPSrr VR128:$src1, VR128:$src2, imm:$src3)>; |
| 3698 | |
Eric Christopher | 95d7926 | 2009-07-29 00:28:05 +0000 | [diff] [blame] | 3699 | // ptest instruction we'll lower to this in X86ISelLowering primarily from |
| 3700 | // the intel intrinsic that corresponds to this. |
Nate Begeman | 0dd3cb5 | 2008-03-16 21:14:46 +0000 | [diff] [blame] | 3701 | let Defs = [EFLAGS] in { |
| 3702 | def PTESTrr : SS48I<0x17, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
Eric Christopher | 95d7926 | 2009-07-29 00:28:05 +0000 | [diff] [blame] | 3703 | "ptest \t{$src2, $src1|$src1, $src2}", |
| 3704 | [(X86ptest VR128:$src1, VR128:$src2), |
| 3705 | (implicit EFLAGS)]>, OpSize; |
Nate Begeman | 0dd3cb5 | 2008-03-16 21:14:46 +0000 | [diff] [blame] | 3706 | def PTESTrm : SS48I<0x17, MRMSrcMem, (outs), (ins VR128:$src1, i128mem:$src2), |
Eric Christopher | 95d7926 | 2009-07-29 00:28:05 +0000 | [diff] [blame] | 3707 | "ptest \t{$src2, $src1|$src1, $src2}", |
| 3708 | [(X86ptest VR128:$src1, (load addr:$src2)), |
| 3709 | (implicit EFLAGS)]>, OpSize; |
Nate Begeman | 0dd3cb5 | 2008-03-16 21:14:46 +0000 | [diff] [blame] | 3710 | } |
| 3711 | |
| 3712 | def MOVNTDQArm : SS48I<0x2A, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
| 3713 | "movntdqa\t{$src, $dst|$dst, $src}", |
| 3714 | [(set VR128:$dst, (int_x86_sse41_movntdqa addr:$src))]>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 3715 | |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3716 | |
| 3717 | //===----------------------------------------------------------------------===// |
| 3718 | // SSE4.2 Instructions |
| 3719 | //===----------------------------------------------------------------------===// |
| 3720 | |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 3721 | /// SS42I_binop_rm_int - Simple SSE 4.2 binary operator |
| 3722 | let Constraints = "$src1 = $dst" in { |
| 3723 | multiclass SS42I_binop_rm_int<bits<8> opc, string OpcodeStr, |
| 3724 | Intrinsic IntId128, bit Commutable = 0> { |
| 3725 | def rr : SS428I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3726 | (ins VR128:$src1, VR128:$src2), |
| 3727 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3728 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 3729 | OpSize { |
| 3730 | let isCommutable = Commutable; |
| 3731 | } |
| 3732 | def rm : SS428I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3733 | (ins VR128:$src1, i128mem:$src2), |
| 3734 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3735 | [(set VR128:$dst, |
| 3736 | (IntId128 VR128:$src1, |
| 3737 | (bitconvert (memopv16i8 addr:$src2))))]>, OpSize; |
| 3738 | } |
| 3739 | } |
| 3740 | |
Nate Begeman | 235666b | 2008-07-17 17:04:58 +0000 | [diff] [blame] | 3741 | defm PCMPGTQ : SS42I_binop_rm_int<0x37, "pcmpgtq", int_x86_sse42_pcmpgtq>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 3742 | |
| 3743 | def : Pat<(v2i64 (X86pcmpgtq VR128:$src1, VR128:$src2)), |
| 3744 | (PCMPGTQrr VR128:$src1, VR128:$src2)>; |
| 3745 | def : Pat<(v2i64 (X86pcmpgtq VR128:$src1, (memop addr:$src2))), |
| 3746 | (PCMPGTQrm VR128:$src1, addr:$src2)>; |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3747 | |
| 3748 | // crc intrinsic instruction |
| 3749 | // This set of instructions are only rm, the only difference is the size |
| 3750 | // of r and m. |
| 3751 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3752 | def CRC32m8 : SS42FI<0xF0, MRMSrcMem, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3753 | (ins GR32:$src1, i8mem:$src2), |
| 3754 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3755 | [(set GR32:$dst, |
| 3756 | (int_x86_sse42_crc32_8 GR32:$src1, |
| 3757 | (load addr:$src2)))]>, OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3758 | def CRC32r8 : SS42FI<0xF0, MRMSrcReg, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3759 | (ins GR32:$src1, GR8:$src2), |
| 3760 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3761 | [(set GR32:$dst, |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3762 | (int_x86_sse42_crc32_8 GR32:$src1, GR8:$src2))]>, |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3763 | OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3764 | def CRC32m16 : SS42FI<0xF1, MRMSrcMem, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3765 | (ins GR32:$src1, i16mem:$src2), |
| 3766 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3767 | [(set GR32:$dst, |
| 3768 | (int_x86_sse42_crc32_16 GR32:$src1, |
| 3769 | (load addr:$src2)))]>, |
| 3770 | OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3771 | def CRC32r16 : SS42FI<0xF1, MRMSrcReg, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3772 | (ins GR32:$src1, GR16:$src2), |
| 3773 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3774 | [(set GR32:$dst, |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3775 | (int_x86_sse42_crc32_16 GR32:$src1, GR16:$src2))]>, |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3776 | OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3777 | def CRC32m32 : SS42FI<0xF1, MRMSrcMem, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3778 | (ins GR32:$src1, i32mem:$src2), |
| 3779 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3780 | [(set GR32:$dst, |
| 3781 | (int_x86_sse42_crc32_32 GR32:$src1, |
| 3782 | (load addr:$src2)))]>, OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3783 | def CRC32r32 : SS42FI<0xF1, MRMSrcReg, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3784 | (ins GR32:$src1, GR32:$src2), |
| 3785 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3786 | [(set GR32:$dst, |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3787 | (int_x86_sse42_crc32_32 GR32:$src1, GR32:$src2))]>, |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3788 | OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3789 | def CRC64m64 : SS42FI<0xF0, MRMSrcMem, (outs GR64:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3790 | (ins GR64:$src1, i64mem:$src2), |
| 3791 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3792 | [(set GR64:$dst, |
| 3793 | (int_x86_sse42_crc32_64 GR64:$src1, |
| 3794 | (load addr:$src2)))]>, |
| 3795 | OpSize, REX_W; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3796 | def CRC64r64 : SS42FI<0xF0, MRMSrcReg, (outs GR64:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3797 | (ins GR64:$src1, GR64:$src2), |
| 3798 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3799 | [(set GR64:$dst, |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3800 | (int_x86_sse42_crc32_64 GR64:$src1, GR64:$src2))]>, |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3801 | OpSize, REX_W; |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3802 | } |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3803 | |
| 3804 | // String/text processing instructions. |
| 3805 | let Defs = [EFLAGS], usesCustomDAGSchedInserter = 1 in { |
| 3806 | def PCMPISTRM128REG : SS42AI<0, Pseudo, (outs VR128:$dst), |
| 3807 | (ins VR128:$src1, VR128:$src2, i8imm:$src3), |
| 3808 | "#PCMPISTRM128rr PSEUDO!", |
| 3809 | [(set VR128:$dst, |
| 3810 | (int_x86_sse42_pcmpistrm128 VR128:$src1, VR128:$src2, |
| 3811 | imm:$src3))]>, OpSize; |
| 3812 | def PCMPISTRM128MEM : SS42AI<0, Pseudo, (outs VR128:$dst), |
| 3813 | (ins VR128:$src1, i128mem:$src2, i8imm:$src3), |
| 3814 | "#PCMPISTRM128rm PSEUDO!", |
| 3815 | [(set VR128:$dst, |
| 3816 | (int_x86_sse42_pcmpistrm128 VR128:$src1, |
| 3817 | (load addr:$src2), |
| 3818 | imm:$src3))]>, OpSize; |
| 3819 | } |
| 3820 | |
| 3821 | let Defs = [XMM0, EFLAGS] in { |
| 3822 | def PCMPISTRM128rr : SS42AI<0x62, MRMSrcReg, (outs), |
| 3823 | (ins VR128:$src1, VR128:$src2, i8imm:$src3), |
| 3824 | "pcmpistrm\t{$src3, $src2, $src1|$src1, $src2, $src3}", |
| 3825 | []>, OpSize; |
| 3826 | def PCMPISTRM128rm : SS42AI<0x62, MRMSrcMem, (outs), |
| 3827 | (ins VR128:$src1, i128mem:$src2, i8imm:$src3), |
| 3828 | "pcmpistrm\t{$src3, $src2, $src1|$src1, $src2, $src3}", |
| 3829 | []>, OpSize; |
| 3830 | } |
| 3831 | |
| 3832 | let Defs = [EFLAGS], Uses = [EAX, EDX], |
| 3833 | usesCustomDAGSchedInserter = 1 in { |
| 3834 | def PCMPESTRM128REG : SS42AI<0, Pseudo, (outs VR128:$dst), |
| 3835 | (ins VR128:$src1, VR128:$src3, i8imm:$src5), |
| 3836 | "#PCMPESTRM128rr PSEUDO!", |
| 3837 | [(set VR128:$dst, |
| 3838 | (int_x86_sse42_pcmpestrm128 VR128:$src1, EAX, |
| 3839 | VR128:$src3, |
| 3840 | EDX, imm:$src5))]>, OpSize; |
| 3841 | def PCMPESTRM128MEM : SS42AI<0, Pseudo, (outs VR128:$dst), |
| 3842 | (ins VR128:$src1, i128mem:$src3, i8imm:$src5), |
| 3843 | "#PCMPESTRM128rm PSEUDO!", |
| 3844 | [(set VR128:$dst, |
| 3845 | (int_x86_sse42_pcmpestrm128 VR128:$src1, EAX, |
| 3846 | (load addr:$src3), |
| 3847 | EDX, imm:$src5))]>, OpSize; |
| 3848 | } |
| 3849 | |
| 3850 | let Defs = [XMM0, EFLAGS], Uses = [EAX, EDX] in { |
Sean Callanan | c5a05b7 | 2009-08-20 18:24:27 +0000 | [diff] [blame] | 3851 | def PCMPESTRM128rr : SS42AI<0x60, MRMSrcReg, (outs), |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3852 | (ins VR128:$src1, VR128:$src3, i8imm:$src5), |
| 3853 | "pcmpestrm\t{$src5, $src3, $src1|$src1, $src3, $src5}", |
| 3854 | []>, OpSize; |
Sean Callanan | c5a05b7 | 2009-08-20 18:24:27 +0000 | [diff] [blame] | 3855 | def PCMPESTRM128rm : SS42AI<0x60, MRMSrcMem, (outs), |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3856 | (ins VR128:$src1, i128mem:$src3, i8imm:$src5), |
| 3857 | "pcmpestrm\t{$src5, $src3, $src1|$src1, $src3, $src5}", |
| 3858 | []>, OpSize; |
| 3859 | } |
| 3860 | |
| 3861 | let Defs = [ECX, EFLAGS] in { |
| 3862 | multiclass SS42AI_pcmpistri<Intrinsic IntId128> { |
| 3863 | def rr : SS42AI<0x63, MRMSrcReg, (outs), |
| 3864 | (ins VR128:$src1, VR128:$src2, i8imm:$src3), |
| 3865 | "pcmpistri\t{$src3, $src2, $src1|$src1, $src2, $src3}", |
| 3866 | [(set ECX, |
| 3867 | (IntId128 VR128:$src1, VR128:$src2, imm:$src3)), |
| 3868 | (implicit EFLAGS)]>, |
| 3869 | OpSize; |
| 3870 | def rm : SS42AI<0x63, MRMSrcMem, (outs), |
| 3871 | (ins VR128:$src1, i128mem:$src2, i8imm:$src3), |
| 3872 | "pcmpistri\t{$src3, $src2, $src1|$src1, $src2, $src3}", |
| 3873 | [(set ECX, |
| 3874 | (IntId128 VR128:$src1, (load addr:$src2), imm:$src3)), |
| 3875 | (implicit EFLAGS)]>, |
| 3876 | OpSize; |
| 3877 | } |
| 3878 | } |
| 3879 | |
| 3880 | defm PCMPISTRI : SS42AI_pcmpistri<int_x86_sse42_pcmpistri128>; |
| 3881 | defm PCMPISTRIA : SS42AI_pcmpistri<int_x86_sse42_pcmpistria128>; |
| 3882 | defm PCMPISTRIC : SS42AI_pcmpistri<int_x86_sse42_pcmpistric128>; |
| 3883 | defm PCMPISTRIO : SS42AI_pcmpistri<int_x86_sse42_pcmpistrio128>; |
| 3884 | defm PCMPISTRIS : SS42AI_pcmpistri<int_x86_sse42_pcmpistris128>; |
| 3885 | defm PCMPISTRIZ : SS42AI_pcmpistri<int_x86_sse42_pcmpistriz128>; |
| 3886 | |
| 3887 | let Defs = [ECX, EFLAGS] in { |
| 3888 | let Uses = [EAX, EDX] in { |
| 3889 | multiclass SS42AI_pcmpestri<Intrinsic IntId128> { |
| 3890 | def rr : SS42AI<0x61, MRMSrcReg, (outs), |
| 3891 | (ins VR128:$src1, VR128:$src3, i8imm:$src5), |
| 3892 | "pcmpestri\t{$src5, $src3, $src1|$src1, $src3, $src5}", |
| 3893 | [(set ECX, |
| 3894 | (IntId128 VR128:$src1, EAX, VR128:$src3, EDX, imm:$src5)), |
| 3895 | (implicit EFLAGS)]>, |
| 3896 | OpSize; |
| 3897 | def rm : SS42AI<0x61, MRMSrcMem, (outs), |
| 3898 | (ins VR128:$src1, i128mem:$src3, i8imm:$src5), |
| 3899 | "pcmpestri\t{$src5, $src3, $src1|$src1, $src3, $src5}", |
| 3900 | [(set ECX, |
| 3901 | (IntId128 VR128:$src1, EAX, (load addr:$src3), |
| 3902 | EDX, imm:$src5)), |
| 3903 | (implicit EFLAGS)]>, |
| 3904 | OpSize; |
| 3905 | } |
| 3906 | } |
| 3907 | } |
| 3908 | |
| 3909 | defm PCMPESTRI : SS42AI_pcmpestri<int_x86_sse42_pcmpestri128>; |
| 3910 | defm PCMPESTRIA : SS42AI_pcmpestri<int_x86_sse42_pcmpestria128>; |
| 3911 | defm PCMPESTRIC : SS42AI_pcmpestri<int_x86_sse42_pcmpestric128>; |
| 3912 | defm PCMPESTRIO : SS42AI_pcmpestri<int_x86_sse42_pcmpestrio128>; |
| 3913 | defm PCMPESTRIS : SS42AI_pcmpestri<int_x86_sse42_pcmpestris128>; |
| 3914 | defm PCMPESTRIZ : SS42AI_pcmpestri<int_x86_sse42_pcmpestriz128>; |