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>, |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 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 | |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 119 | def alignedloadfsf32 : PatFrag<(ops node:$ptr), |
| 120 | (f32 (alignedload node:$ptr))>; |
| 121 | def alignedloadfsf64 : PatFrag<(ops node:$ptr), |
| 122 | (f64 (alignedload node:$ptr))>; |
| 123 | def alignedloadv4f32 : PatFrag<(ops node:$ptr), |
| 124 | (v4f32 (alignedload node:$ptr))>; |
| 125 | def alignedloadv2f64 : PatFrag<(ops node:$ptr), |
| 126 | (v2f64 (alignedload node:$ptr))>; |
| 127 | def alignedloadv4i32 : PatFrag<(ops node:$ptr), |
| 128 | (v4i32 (alignedload node:$ptr))>; |
| 129 | def alignedloadv2i64 : PatFrag<(ops node:$ptr), |
| 130 | (v2i64 (alignedload node:$ptr))>; |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 131 | |
| 132 | // Like 'load', but uses special alignment checks suitable for use in |
| 133 | // memory operands in most SSE instructions, which are required to |
| 134 | // be naturally aligned on some targets but not on others. |
| 135 | // FIXME: Actually implement support for targets that don't require the |
| 136 | // alignment. This probably wants a subtarget predicate. |
Dan Gohman | 2a17412 | 2008-10-15 06:50:19 +0000 | [diff] [blame] | 137 | def memop : PatFrag<(ops node:$ptr), (load node:$ptr), [{ |
| 138 | return cast<LoadSDNode>(N)->getAlignment() >= 16; |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 139 | }]>; |
| 140 | |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 141 | def memopfsf32 : PatFrag<(ops node:$ptr), (f32 (memop node:$ptr))>; |
| 142 | def memopfsf64 : PatFrag<(ops node:$ptr), (f64 (memop node:$ptr))>; |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 143 | def memopv4f32 : PatFrag<(ops node:$ptr), (v4f32 (memop node:$ptr))>; |
| 144 | def memopv2f64 : PatFrag<(ops node:$ptr), (v2f64 (memop node:$ptr))>; |
| 145 | def memopv4i32 : PatFrag<(ops node:$ptr), (v4i32 (memop node:$ptr))>; |
| 146 | def memopv2i64 : PatFrag<(ops node:$ptr), (v2i64 (memop node:$ptr))>; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 147 | def memopv16i8 : PatFrag<(ops node:$ptr), (v16i8 (memop node:$ptr))>; |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 148 | |
Bill Wendling | 3b15d72 | 2007-08-11 09:52:53 +0000 | [diff] [blame] | 149 | // SSSE3 uses MMX registers for some instructions. They aren't aligned on a |
| 150 | // 16-byte boundary. |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 151 | // FIXME: 8 byte alignment for mmx reads is not required |
Dan Gohman | 61efc5a | 2008-10-16 00:03:00 +0000 | [diff] [blame] | 152 | def memop64 : PatFrag<(ops node:$ptr), (load node:$ptr), [{ |
Dan Gohman | 2a17412 | 2008-10-15 06:50:19 +0000 | [diff] [blame] | 153 | return cast<LoadSDNode>(N)->getAlignment() >= 8; |
Bill Wendling | 3b15d72 | 2007-08-11 09:52:53 +0000 | [diff] [blame] | 154 | }]>; |
| 155 | |
| 156 | def memopv8i8 : PatFrag<(ops node:$ptr), (v8i8 (memop64 node:$ptr))>; |
Bill Wendling | 3b15d72 | 2007-08-11 09:52:53 +0000 | [diff] [blame] | 157 | def memopv4i16 : PatFrag<(ops node:$ptr), (v4i16 (memop64 node:$ptr))>; |
| 158 | def memopv8i16 : PatFrag<(ops node:$ptr), (v8i16 (memop64 node:$ptr))>; |
| 159 | def memopv2i32 : PatFrag<(ops node:$ptr), (v2i32 (memop64 node:$ptr))>; |
| 160 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 161 | def bc_v4f32 : PatFrag<(ops node:$in), (v4f32 (bitconvert node:$in))>; |
| 162 | def bc_v2f64 : PatFrag<(ops node:$in), (v2f64 (bitconvert node:$in))>; |
| 163 | def bc_v16i8 : PatFrag<(ops node:$in), (v16i8 (bitconvert node:$in))>; |
| 164 | def bc_v8i16 : PatFrag<(ops node:$in), (v8i16 (bitconvert node:$in))>; |
| 165 | def bc_v4i32 : PatFrag<(ops node:$in), (v4i32 (bitconvert node:$in))>; |
| 166 | def bc_v2i64 : PatFrag<(ops node:$in), (v2i64 (bitconvert node:$in))>; |
| 167 | |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 168 | def vzmovl_v2i64 : PatFrag<(ops node:$src), |
| 169 | (bitconvert (v2i64 (X86vzmovl |
| 170 | (v2i64 (scalar_to_vector (loadi64 node:$src))))))>; |
| 171 | def vzmovl_v4i32 : PatFrag<(ops node:$src), |
| 172 | (bitconvert (v4i32 (X86vzmovl |
| 173 | (v4i32 (scalar_to_vector (loadi32 node:$src))))))>; |
| 174 | |
| 175 | def vzload_v2i64 : PatFrag<(ops node:$src), |
| 176 | (bitconvert (v2i64 (X86vzload node:$src)))>; |
| 177 | |
| 178 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 179 | def fp32imm0 : PatLeaf<(f32 fpimm), [{ |
| 180 | return N->isExactlyValue(+0.0); |
| 181 | }]>; |
| 182 | |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 183 | // BYTE_imm - Transform bit immediates into byte immediates. |
| 184 | def BYTE_imm : SDNodeXForm<imm, [{ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 185 | // Transformation function: imm >> 3 |
Dan Gohman | faeb4a3 | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 186 | return getI32Imm(N->getZExtValue() >> 3); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 187 | }]>; |
| 188 | |
| 189 | // SHUFFLE_get_shuf_imm xform function: convert vector_shuffle mask to PSHUF*, |
| 190 | // SHUFP* etc. imm. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 191 | def SHUFFLE_get_shuf_imm : SDNodeXForm<vector_shuffle, [{ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 192 | return getI8Imm(X86::getShuffleSHUFImmediate(N)); |
| 193 | }]>; |
| 194 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 195 | // SHUFFLE_get_pshufhw_imm xform function: convert vector_shuffle mask to |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 196 | // PSHUFHW imm. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 197 | def SHUFFLE_get_pshufhw_imm : SDNodeXForm<vector_shuffle, [{ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 198 | return getI8Imm(X86::getShufflePSHUFHWImmediate(N)); |
| 199 | }]>; |
| 200 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 201 | // SHUFFLE_get_pshuflw_imm xform function: convert vector_shuffle mask to |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 202 | // PSHUFLW imm. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 203 | def SHUFFLE_get_pshuflw_imm : SDNodeXForm<vector_shuffle, [{ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 204 | return getI8Imm(X86::getShufflePSHUFLWImmediate(N)); |
| 205 | }]>; |
| 206 | |
Nate Begeman | 080f8e2 | 2009-10-19 02:17:23 +0000 | [diff] [blame] | 207 | // SHUFFLE_get_palign_imm xform function: convert vector_shuffle mask to |
| 208 | // a PALIGNR imm. |
| 209 | def SHUFFLE_get_palign_imm : SDNodeXForm<vector_shuffle, [{ |
| 210 | return getI8Imm(X86::getShufflePALIGNRImmediate(N)); |
| 211 | }]>; |
| 212 | |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 213 | def splat_lo : PatFrag<(ops node:$lhs, node:$rhs), |
| 214 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 215 | ShuffleVectorSDNode *SVOp = cast<ShuffleVectorSDNode>(N); |
| 216 | return SVOp->isSplat() && SVOp->getSplatIndex() == 0; |
| 217 | }]>; |
| 218 | |
| 219 | def movddup : PatFrag<(ops node:$lhs, node:$rhs), |
| 220 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 221 | return X86::isMOVDDUPMask(cast<ShuffleVectorSDNode>(N)); |
| 222 | }]>; |
| 223 | |
| 224 | def movhlps : PatFrag<(ops node:$lhs, node:$rhs), |
| 225 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 226 | return X86::isMOVHLPSMask(cast<ShuffleVectorSDNode>(N)); |
| 227 | }]>; |
| 228 | |
| 229 | def movhlps_undef : PatFrag<(ops node:$lhs, node:$rhs), |
| 230 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 231 | return X86::isMOVHLPS_v_undef_Mask(cast<ShuffleVectorSDNode>(N)); |
| 232 | }]>; |
| 233 | |
Nate Begeman | b13034d | 2009-11-07 23:17:15 +0000 | [diff] [blame] | 234 | def movlhps : PatFrag<(ops node:$lhs, node:$rhs), |
| 235 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 236 | return X86::isMOVLHPSMask(cast<ShuffleVectorSDNode>(N)); |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 237 | }]>; |
| 238 | |
| 239 | def movlp : PatFrag<(ops node:$lhs, node:$rhs), |
| 240 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 241 | return X86::isMOVLPMask(cast<ShuffleVectorSDNode>(N)); |
| 242 | }]>; |
| 243 | |
| 244 | def movl : PatFrag<(ops node:$lhs, node:$rhs), |
| 245 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 246 | return X86::isMOVLMask(cast<ShuffleVectorSDNode>(N)); |
| 247 | }]>; |
| 248 | |
| 249 | def movshdup : PatFrag<(ops node:$lhs, node:$rhs), |
| 250 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 251 | return X86::isMOVSHDUPMask(cast<ShuffleVectorSDNode>(N)); |
| 252 | }]>; |
| 253 | |
| 254 | def movsldup : PatFrag<(ops node:$lhs, node:$rhs), |
| 255 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 256 | return X86::isMOVSLDUPMask(cast<ShuffleVectorSDNode>(N)); |
| 257 | }]>; |
| 258 | |
| 259 | def unpckl : PatFrag<(ops node:$lhs, node:$rhs), |
| 260 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 261 | return X86::isUNPCKLMask(cast<ShuffleVectorSDNode>(N)); |
| 262 | }]>; |
| 263 | |
| 264 | def unpckh : PatFrag<(ops node:$lhs, node:$rhs), |
| 265 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 266 | return X86::isUNPCKHMask(cast<ShuffleVectorSDNode>(N)); |
| 267 | }]>; |
| 268 | |
| 269 | def unpckl_undef : PatFrag<(ops node:$lhs, node:$rhs), |
| 270 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 271 | return X86::isUNPCKL_v_undef_Mask(cast<ShuffleVectorSDNode>(N)); |
| 272 | }]>; |
| 273 | |
| 274 | def unpckh_undef : PatFrag<(ops node:$lhs, node:$rhs), |
| 275 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 276 | return X86::isUNPCKH_v_undef_Mask(cast<ShuffleVectorSDNode>(N)); |
| 277 | }]>; |
| 278 | |
| 279 | def pshufd : PatFrag<(ops node:$lhs, node:$rhs), |
| 280 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 281 | return X86::isPSHUFDMask(cast<ShuffleVectorSDNode>(N)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 282 | }], SHUFFLE_get_shuf_imm>; |
| 283 | |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 284 | def shufp : PatFrag<(ops node:$lhs, node:$rhs), |
| 285 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 286 | return X86::isSHUFPMask(cast<ShuffleVectorSDNode>(N)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 287 | }], SHUFFLE_get_shuf_imm>; |
| 288 | |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 289 | def pshufhw : PatFrag<(ops node:$lhs, node:$rhs), |
| 290 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 291 | return X86::isPSHUFHWMask(cast<ShuffleVectorSDNode>(N)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 292 | }], SHUFFLE_get_pshufhw_imm>; |
| 293 | |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 294 | def pshuflw : PatFrag<(ops node:$lhs, node:$rhs), |
| 295 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 296 | return X86::isPSHUFLWMask(cast<ShuffleVectorSDNode>(N)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 297 | }], SHUFFLE_get_pshuflw_imm>; |
| 298 | |
Nate Begeman | 080f8e2 | 2009-10-19 02:17:23 +0000 | [diff] [blame] | 299 | def palign : PatFrag<(ops node:$lhs, node:$rhs), |
| 300 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 301 | return X86::isPALIGNRMask(cast<ShuffleVectorSDNode>(N)); |
| 302 | }], SHUFFLE_get_palign_imm>; |
| 303 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 304 | //===----------------------------------------------------------------------===// |
| 305 | // SSE scalar FP Instructions |
| 306 | //===----------------------------------------------------------------------===// |
| 307 | |
Dan Gohman | 30afe01 | 2009-10-29 18:10:34 +0000 | [diff] [blame] | 308 | // CMOV* - Used to implement the SSE SELECT DAG operation. Expanded after |
| 309 | // instruction selection into a branch sequence. |
| 310 | let Uses = [EFLAGS], usesCustomInserter = 1 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 311 | def CMOV_FR32 : I<0, Pseudo, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 312 | (outs FR32:$dst), (ins FR32:$t, FR32:$f, i8imm:$cond), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 313 | "#CMOV_FR32 PSEUDO!", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 314 | [(set FR32:$dst, (X86cmov FR32:$t, FR32:$f, imm:$cond, |
| 315 | EFLAGS))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 316 | def CMOV_FR64 : I<0, Pseudo, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 317 | (outs FR64:$dst), (ins FR64:$t, FR64:$f, i8imm:$cond), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 318 | "#CMOV_FR64 PSEUDO!", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 319 | [(set FR64:$dst, (X86cmov FR64:$t, FR64:$f, imm:$cond, |
| 320 | EFLAGS))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 321 | def CMOV_V4F32 : 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_V4F32 PSEUDO!", |
| 324 | [(set VR128:$dst, |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 325 | (v4f32 (X86cmov VR128:$t, VR128:$f, imm:$cond, |
| 326 | EFLAGS)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 327 | def CMOV_V2F64 : 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_V2F64 PSEUDO!", |
| 330 | [(set VR128:$dst, |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 331 | (v2f64 (X86cmov VR128:$t, VR128:$f, imm:$cond, |
| 332 | EFLAGS)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 333 | def CMOV_V2I64 : I<0, Pseudo, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 334 | (outs VR128:$dst), (ins VR128:$t, VR128:$f, i8imm:$cond), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 335 | "#CMOV_V2I64 PSEUDO!", |
| 336 | [(set VR128:$dst, |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 337 | (v2i64 (X86cmov VR128:$t, VR128:$f, imm:$cond, |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 338 | EFLAGS)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 339 | } |
| 340 | |
| 341 | //===----------------------------------------------------------------------===// |
| 342 | // SSE1 Instructions |
| 343 | //===----------------------------------------------------------------------===// |
| 344 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 345 | // Move Instructions |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 346 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 347 | def MOVSSrr : SSI<0x10, MRMSrcReg, (outs FR32:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 348 | "movss\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 349 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 350 | def MOVSSrm : SSI<0x10, MRMSrcMem, (outs FR32:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 351 | "movss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 352 | [(set FR32:$dst, (loadf32 addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 353 | def MOVSSmr : SSI<0x11, MRMDestMem, (outs), (ins f32mem:$dst, FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 354 | "movss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 355 | [(store FR32:$src, addr:$dst)]>; |
| 356 | |
| 357 | // Conversion instructions |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 358 | def CVTTSS2SIrr : SSI<0x2C, MRMSrcReg, (outs GR32:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 359 | "cvttss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 360 | [(set GR32:$dst, (fp_to_sint FR32:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 361 | def CVTTSS2SIrm : SSI<0x2C, MRMSrcMem, (outs GR32:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 362 | "cvttss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 363 | [(set GR32:$dst, (fp_to_sint (loadf32 addr:$src)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 364 | def CVTSI2SSrr : SSI<0x2A, MRMSrcReg, (outs FR32:$dst), (ins GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 365 | "cvtsi2ss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 366 | [(set FR32:$dst, (sint_to_fp GR32:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 367 | def CVTSI2SSrm : SSI<0x2A, MRMSrcMem, (outs FR32:$dst), (ins i32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 368 | "cvtsi2ss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 369 | [(set FR32:$dst, (sint_to_fp (loadi32 addr:$src)))]>; |
| 370 | |
| 371 | // Match intrinsics which expect XMM operand(s). |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 372 | def CVTSS2SIrr: SSI<0x2D, MRMSrcReg, (outs GR32:$dst), (ins FR32:$src), |
| 373 | "cvtss2si{l}\t{$src, $dst|$dst, $src}", []>; |
| 374 | def CVTSS2SIrm: SSI<0x2D, MRMSrcMem, (outs GR32:$dst), (ins f32mem:$src), |
| 375 | "cvtss2si{l}\t{$src, $dst|$dst, $src}", []>; |
| 376 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 377 | def Int_CVTSS2SIrr : SSI<0x2D, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 378 | "cvtss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 379 | [(set GR32:$dst, (int_x86_sse_cvtss2si VR128:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 380 | def Int_CVTSS2SIrm : SSI<0x2D, MRMSrcMem, (outs GR32:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 381 | "cvtss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 382 | [(set GR32:$dst, (int_x86_sse_cvtss2si |
| 383 | (load addr:$src)))]>; |
| 384 | |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 385 | // Match intrinisics which expect MM and XMM operand(s). |
| 386 | def Int_CVTPS2PIrr : PSI<0x2D, MRMSrcReg, (outs VR64:$dst), (ins VR128:$src), |
| 387 | "cvtps2pi\t{$src, $dst|$dst, $src}", |
| 388 | [(set VR64:$dst, (int_x86_sse_cvtps2pi VR128:$src))]>; |
| 389 | def Int_CVTPS2PIrm : PSI<0x2D, MRMSrcMem, (outs VR64:$dst), (ins f64mem:$src), |
| 390 | "cvtps2pi\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 391 | [(set VR64:$dst, (int_x86_sse_cvtps2pi |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 392 | (load addr:$src)))]>; |
| 393 | def Int_CVTTPS2PIrr: PSI<0x2C, MRMSrcReg, (outs VR64:$dst), (ins VR128:$src), |
| 394 | "cvttps2pi\t{$src, $dst|$dst, $src}", |
| 395 | [(set VR64:$dst, (int_x86_sse_cvttps2pi VR128:$src))]>; |
| 396 | def Int_CVTTPS2PIrm: PSI<0x2C, MRMSrcMem, (outs VR64:$dst), (ins f64mem:$src), |
| 397 | "cvttps2pi\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 398 | [(set VR64:$dst, (int_x86_sse_cvttps2pi |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 399 | (load addr:$src)))]>; |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 400 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 401 | def Int_CVTPI2PSrr : PSI<0x2A, MRMSrcReg, |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 402 | (outs VR128:$dst), (ins VR128:$src1, VR64:$src2), |
| 403 | "cvtpi2ps\t{$src2, $dst|$dst, $src2}", |
| 404 | [(set VR128:$dst, (int_x86_sse_cvtpi2ps VR128:$src1, |
| 405 | VR64:$src2))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 406 | def Int_CVTPI2PSrm : PSI<0x2A, MRMSrcMem, |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 407 | (outs VR128:$dst), (ins VR128:$src1, i64mem:$src2), |
| 408 | "cvtpi2ps\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 409 | [(set VR128:$dst, (int_x86_sse_cvtpi2ps VR128:$src1, |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 410 | (load addr:$src2)))]>; |
| 411 | } |
| 412 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 413 | // Aliases for intrinsics |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 414 | def Int_CVTTSS2SIrr : SSI<0x2C, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 415 | "cvttss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 416 | [(set GR32:$dst, |
| 417 | (int_x86_sse_cvttss2si VR128:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 418 | def Int_CVTTSS2SIrm : SSI<0x2C, MRMSrcMem, (outs GR32:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 419 | "cvttss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 420 | [(set GR32:$dst, |
| 421 | (int_x86_sse_cvttss2si(load addr:$src)))]>; |
| 422 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 423 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 424 | def Int_CVTSI2SSrr : SSI<0x2A, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 425 | (outs VR128:$dst), (ins VR128:$src1, GR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 426 | "cvtsi2ss\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 427 | [(set VR128:$dst, (int_x86_sse_cvtsi2ss VR128:$src1, |
| 428 | GR32:$src2))]>; |
| 429 | def Int_CVTSI2SSrm : SSI<0x2A, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 430 | (outs VR128:$dst), (ins VR128:$src1, i32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 431 | "cvtsi2ss\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 432 | [(set VR128:$dst, (int_x86_sse_cvtsi2ss VR128:$src1, |
| 433 | (loadi32 addr:$src2)))]>; |
| 434 | } |
| 435 | |
| 436 | // Comparison instructions |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 437 | let Constraints = "$src1 = $dst", neverHasSideEffects = 1 in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 438 | def CMPSSrr : SSIi8<0xC2, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 439 | (outs FR32:$dst), (ins FR32:$src1, FR32:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 440 | "cmp${cc}ss\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 441 | let mayLoad = 1 in |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 442 | def CMPSSrm : SSIi8<0xC2, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 443 | (outs FR32:$dst), (ins FR32:$src1, f32mem:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 444 | "cmp${cc}ss\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 445 | } |
| 446 | |
Evan Cheng | 5568707 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 447 | let Defs = [EFLAGS] in { |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 448 | def UCOMISSrr: PSI<0x2E, MRMSrcReg, (outs), (ins FR32:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 449 | "ucomiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 450 | [(X86cmp FR32:$src1, FR32:$src2), (implicit EFLAGS)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 451 | def UCOMISSrm: PSI<0x2E, MRMSrcMem, (outs), (ins FR32:$src1, f32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 452 | "ucomiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 453 | [(X86cmp FR32:$src1, (loadf32 addr:$src2)), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 454 | (implicit EFLAGS)]>; |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 455 | |
| 456 | def COMISSrr: PSI<0x2F, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
| 457 | "comiss\t{$src2, $src1|$src1, $src2}", []>; |
| 458 | def COMISSrm: PSI<0x2F, MRMSrcMem, (outs), (ins VR128:$src1, f128mem:$src2), |
| 459 | "comiss\t{$src2, $src1|$src1, $src2}", []>; |
| 460 | |
Evan Cheng | 5568707 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 461 | } // Defs = [EFLAGS] |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 462 | |
| 463 | // Aliases to match intrinsics which expect XMM operand(s). |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 464 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 465 | def Int_CMPSSrr : SSIi8<0xC2, MRMSrcReg, |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 466 | (outs VR128:$dst), |
| 467 | (ins VR128:$src1, VR128:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 468 | "cmp${cc}ss\t{$src, $dst|$dst, $src}", |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 469 | [(set VR128:$dst, (int_x86_sse_cmp_ss |
| 470 | VR128:$src1, |
| 471 | VR128:$src, imm:$cc))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 472 | def Int_CMPSSrm : SSIi8<0xC2, MRMSrcMem, |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 473 | (outs VR128:$dst), |
| 474 | (ins VR128:$src1, f32mem:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 475 | "cmp${cc}ss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 476 | [(set VR128:$dst, (int_x86_sse_cmp_ss VR128:$src1, |
| 477 | (load addr:$src), imm:$cc))]>; |
| 478 | } |
| 479 | |
Evan Cheng | 5568707 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 480 | let Defs = [EFLAGS] in { |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 481 | def Int_UCOMISSrr: PSI<0x2E, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 482 | "ucomiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 483 | [(X86ucomi (v4f32 VR128:$src1), VR128:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 484 | (implicit EFLAGS)]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 485 | def Int_UCOMISSrm: PSI<0x2E, MRMSrcMem, (outs),(ins VR128:$src1, f128mem:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 486 | "ucomiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 487 | [(X86ucomi (v4f32 VR128:$src1), (load addr:$src2)), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 488 | (implicit EFLAGS)]>; |
| 489 | |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 490 | def Int_COMISSrr: PSI<0x2F, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 491 | "comiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 492 | [(X86comi (v4f32 VR128:$src1), VR128:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 493 | (implicit EFLAGS)]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 494 | def Int_COMISSrm: PSI<0x2F, MRMSrcMem, (outs), (ins VR128:$src1, f128mem:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 495 | "comiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 496 | [(X86comi (v4f32 VR128:$src1), (load addr:$src2)), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 497 | (implicit EFLAGS)]>; |
Evan Cheng | 5568707 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 498 | } // Defs = [EFLAGS] |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 499 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 500 | // Aliases of packed SSE1 instructions for scalar use. These all have names |
| 501 | // that start with 'Fs'. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 502 | |
| 503 | // Alias instructions that map fld0 to pxor for sse. |
Dan Gohman | 51dbce6 | 2009-09-21 18:30:38 +0000 | [diff] [blame] | 504 | let isReMaterializable = 1, isAsCheapAsAMove = 1, isCodeGenOnly = 1, |
| 505 | canFoldAsLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 506 | def FsFLD0SS : I<0xEF, MRMInitReg, (outs FR32:$dst), (ins), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 507 | "pxor\t$dst, $dst", [(set FR32:$dst, fp32imm0)]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 508 | Requires<[HasSSE1]>, TB, OpSize; |
| 509 | |
| 510 | // Alias instruction to do FR32 reg-to-reg copy using movaps. Upper bits are |
| 511 | // disregarded. |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 512 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 513 | def FsMOVAPSrr : PSI<0x28, MRMSrcReg, (outs FR32:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 514 | "movaps\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 515 | |
| 516 | // Alias instruction to load FR32 from f128mem using movaps. Upper bits are |
| 517 | // disregarded. |
Evan Cheng | 8e66471 | 2009-11-17 09:51:18 +0000 | [diff] [blame] | 518 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 519 | def FsMOVAPSrm : PSI<0x28, MRMSrcMem, (outs FR32:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 520 | "movaps\t{$src, $dst|$dst, $src}", |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 521 | [(set FR32:$dst, (alignedloadfsf32 addr:$src))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 522 | |
| 523 | // Alias bitwise logical operations using SSE logical ops on packed FP values. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 524 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 525 | let isCommutable = 1 in { |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 526 | def FsANDPSrr : PSI<0x54, MRMSrcReg, (outs FR32:$dst), |
| 527 | (ins FR32:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 528 | "andps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 529 | [(set FR32:$dst, (X86fand FR32:$src1, FR32:$src2))]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 530 | def FsORPSrr : PSI<0x56, MRMSrcReg, (outs FR32:$dst), |
| 531 | (ins FR32:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 532 | "orps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 533 | [(set FR32:$dst, (X86for FR32:$src1, FR32:$src2))]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 534 | def FsXORPSrr : PSI<0x57, MRMSrcReg, (outs FR32:$dst), |
| 535 | (ins FR32:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 536 | "xorps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 537 | [(set FR32:$dst, (X86fxor FR32:$src1, FR32:$src2))]>; |
| 538 | } |
| 539 | |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 540 | def FsANDPSrm : PSI<0x54, MRMSrcMem, (outs FR32:$dst), |
| 541 | (ins FR32:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 542 | "andps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 543 | [(set FR32:$dst, (X86fand FR32:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 544 | (memopfsf32 addr:$src2)))]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 545 | def FsORPSrm : PSI<0x56, MRMSrcMem, (outs FR32:$dst), |
| 546 | (ins FR32:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 547 | "orps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 548 | [(set FR32:$dst, (X86for FR32:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 549 | (memopfsf32 addr:$src2)))]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 550 | def FsXORPSrm : PSI<0x57, MRMSrcMem, (outs FR32:$dst), |
| 551 | (ins FR32:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 552 | "xorps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 553 | [(set FR32:$dst, (X86fxor FR32:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 554 | (memopfsf32 addr:$src2)))]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 555 | |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 556 | let neverHasSideEffects = 1 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 557 | def FsANDNPSrr : PSI<0x55, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 558 | (outs FR32:$dst), (ins FR32:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 559 | "andnps\t{$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 560 | let mayLoad = 1 in |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 561 | def FsANDNPSrm : PSI<0x55, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 562 | (outs FR32:$dst), (ins FR32:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 563 | "andnps\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 564 | } |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 565 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 566 | |
| 567 | /// basic_sse1_fp_binop_rm - SSE1 binops come in both scalar and vector forms. |
| 568 | /// |
| 569 | /// In addition, we also have a special variant of the scalar form here to |
| 570 | /// represent the associated intrinsic operation. This form is unlike the |
| 571 | /// 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] | 572 | /// and leaves the top elements unmodified (therefore these cannot be commuted). |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 573 | /// |
| 574 | /// These three forms can each be reg+reg or reg+mem, so there are a total of |
| 575 | /// six "instructions". |
| 576 | /// |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 577 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 578 | multiclass basic_sse1_fp_binop_rm<bits<8> opc, string OpcodeStr, |
| 579 | SDNode OpNode, Intrinsic F32Int, |
| 580 | bit Commutable = 0> { |
| 581 | // Scalar operation, reg+reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 582 | 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] | 583 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 584 | [(set FR32:$dst, (OpNode FR32:$src1, FR32:$src2))]> { |
| 585 | let isCommutable = Commutable; |
| 586 | } |
| 587 | |
| 588 | // Scalar operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 589 | def SSrm : SSI<opc, MRMSrcMem, (outs FR32:$dst), |
| 590 | (ins FR32:$src1, f32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 591 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 592 | [(set FR32:$dst, (OpNode FR32:$src1, (load addr:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 593 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 594 | // Vector operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 595 | def PSrr : PSI<opc, MRMSrcReg, (outs VR128:$dst), |
| 596 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 597 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 598 | [(set VR128:$dst, (v4f32 (OpNode VR128:$src1, VR128:$src2)))]> { |
| 599 | let isCommutable = Commutable; |
| 600 | } |
| 601 | |
| 602 | // Vector operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 603 | def PSrm : PSI<opc, MRMSrcMem, (outs VR128:$dst), |
| 604 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 605 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 606 | [(set VR128:$dst, (OpNode VR128:$src1, (memopv4f32 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 607 | |
| 608 | // Intrinsic operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 609 | def SSrr_Int : SSI<opc, MRMSrcReg, (outs VR128:$dst), |
| 610 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 611 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 5d5dbbc | 2009-02-26 03:12:02 +0000 | [diff] [blame] | 612 | [(set VR128:$dst, (F32Int VR128:$src1, VR128:$src2))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 613 | |
| 614 | // Intrinsic operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 615 | def SSrm_Int : SSI<opc, MRMSrcMem, (outs VR128:$dst), |
| 616 | (ins VR128:$src1, ssmem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 617 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 618 | [(set VR128:$dst, (F32Int VR128:$src1, |
| 619 | sse_load_f32:$src2))]>; |
| 620 | } |
| 621 | } |
| 622 | |
| 623 | // Arithmetic instructions |
| 624 | defm ADD : basic_sse1_fp_binop_rm<0x58, "add", fadd, int_x86_sse_add_ss, 1>; |
| 625 | defm MUL : basic_sse1_fp_binop_rm<0x59, "mul", fmul, int_x86_sse_mul_ss, 1>; |
| 626 | defm SUB : basic_sse1_fp_binop_rm<0x5C, "sub", fsub, int_x86_sse_sub_ss>; |
| 627 | defm DIV : basic_sse1_fp_binop_rm<0x5E, "div", fdiv, int_x86_sse_div_ss>; |
| 628 | |
| 629 | /// sse1_fp_binop_rm - Other SSE1 binops |
| 630 | /// |
| 631 | /// This multiclass is like basic_sse1_fp_binop_rm, with the addition of |
| 632 | /// instructions for a full-vector intrinsic form. Operations that map |
| 633 | /// onto C operators don't use this form since they just use the plain |
| 634 | /// vector form instead of having a separate vector intrinsic form. |
| 635 | /// |
| 636 | /// This provides a total of eight "instructions". |
| 637 | /// |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 638 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 639 | multiclass sse1_fp_binop_rm<bits<8> opc, string OpcodeStr, |
| 640 | SDNode OpNode, |
| 641 | Intrinsic F32Int, |
| 642 | Intrinsic V4F32Int, |
| 643 | bit Commutable = 0> { |
| 644 | |
| 645 | // Scalar operation, reg+reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 646 | 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] | 647 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 648 | [(set FR32:$dst, (OpNode FR32:$src1, FR32:$src2))]> { |
| 649 | let isCommutable = Commutable; |
| 650 | } |
| 651 | |
| 652 | // Scalar operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 653 | def SSrm : SSI<opc, MRMSrcMem, (outs FR32:$dst), |
| 654 | (ins FR32:$src1, f32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 655 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 656 | [(set FR32:$dst, (OpNode FR32:$src1, (load addr:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 657 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 658 | // Vector operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 659 | def PSrr : PSI<opc, MRMSrcReg, (outs VR128:$dst), |
| 660 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 661 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 662 | [(set VR128:$dst, (v4f32 (OpNode VR128:$src1, VR128:$src2)))]> { |
| 663 | let isCommutable = Commutable; |
| 664 | } |
| 665 | |
| 666 | // Vector operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 667 | def PSrm : PSI<opc, MRMSrcMem, (outs VR128:$dst), |
| 668 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 669 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 670 | [(set VR128:$dst, (OpNode VR128:$src1, (memopv4f32 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 671 | |
| 672 | // Intrinsic operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 673 | def SSrr_Int : SSI<opc, MRMSrcReg, (outs VR128:$dst), |
| 674 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 675 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 676 | [(set VR128:$dst, (F32Int VR128:$src1, VR128:$src2))]> { |
| 677 | let isCommutable = Commutable; |
| 678 | } |
| 679 | |
| 680 | // Intrinsic operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 681 | def SSrm_Int : SSI<opc, MRMSrcMem, (outs VR128:$dst), |
| 682 | (ins VR128:$src1, ssmem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 683 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 684 | [(set VR128:$dst, (F32Int VR128:$src1, |
| 685 | sse_load_f32:$src2))]>; |
| 686 | |
| 687 | // Vector intrinsic operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 688 | def PSrr_Int : PSI<opc, MRMSrcReg, (outs VR128:$dst), |
| 689 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 690 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 691 | [(set VR128:$dst, (V4F32Int VR128:$src1, VR128:$src2))]> { |
| 692 | let isCommutable = Commutable; |
| 693 | } |
| 694 | |
| 695 | // Vector intrinsic operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 696 | def PSrm_Int : PSI<opc, MRMSrcMem, (outs VR128:$dst), |
| 697 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 698 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 699 | [(set VR128:$dst, (V4F32Int VR128:$src1, (memopv4f32 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 700 | } |
| 701 | } |
| 702 | |
| 703 | defm MAX : sse1_fp_binop_rm<0x5F, "max", X86fmax, |
| 704 | int_x86_sse_max_ss, int_x86_sse_max_ps>; |
| 705 | defm MIN : sse1_fp_binop_rm<0x5D, "min", X86fmin, |
| 706 | int_x86_sse_min_ss, int_x86_sse_min_ps>; |
| 707 | |
| 708 | //===----------------------------------------------------------------------===// |
| 709 | // SSE packed FP Instructions |
| 710 | |
| 711 | // Move Instructions |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 712 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 713 | def MOVAPSrr : PSI<0x28, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 714 | "movaps\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 715 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 716 | def MOVAPSrm : PSI<0x28, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 717 | "movaps\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 718 | [(set VR128:$dst, (alignedloadv4f32 addr:$src))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 719 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 720 | def MOVAPSmr : PSI<0x29, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 721 | "movaps\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 722 | [(alignedstore (v4f32 VR128:$src), addr:$dst)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 723 | |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 724 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 725 | def MOVUPSrr : PSI<0x10, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 726 | "movups\t{$src, $dst|$dst, $src}", []>; |
Evan Cheng | 9d7cd4e | 2009-11-16 21:56:03 +0000 | [diff] [blame] | 727 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 728 | def MOVUPSrm : PSI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 729 | "movups\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 730 | [(set VR128:$dst, (loadv4f32 addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 731 | def MOVUPSmr : PSI<0x11, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 732 | "movups\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 733 | [(store (v4f32 VR128:$src), addr:$dst)]>; |
| 734 | |
| 735 | // Intrinsic forms of MOVUPS load and store |
Evan Cheng | 8e66471 | 2009-11-17 09:51:18 +0000 | [diff] [blame] | 736 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 737 | def MOVUPSrm_Int : PSI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 738 | "movups\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 739 | [(set VR128:$dst, (int_x86_sse_loadu_ps addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 740 | def MOVUPSmr_Int : PSI<0x11, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 741 | "movups\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 742 | [(int_x86_sse_storeu_ps addr:$dst, VR128:$src)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 743 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 744 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 745 | let AddedComplexity = 20 in { |
| 746 | def MOVLPSrm : PSI<0x12, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 747 | (outs VR128:$dst), (ins VR128:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 748 | "movlps\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 749 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 750 | (movlp VR128:$src1, |
| 751 | (bc_v4f32 (v2f64 (scalar_to_vector (loadf64 addr:$src2))))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 752 | def MOVHPSrm : PSI<0x16, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 753 | (outs VR128:$dst), (ins VR128:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 754 | "movhps\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 755 | [(set VR128:$dst, |
Nate Begeman | b13034d | 2009-11-07 23:17:15 +0000 | [diff] [blame] | 756 | (movlhps VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 757 | (bc_v4f32 (v2f64 (scalar_to_vector (loadf64 addr:$src2))))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 758 | } // AddedComplexity |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 759 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 760 | |
Evan Cheng | d743a5f | 2008-05-10 00:59:18 +0000 | [diff] [blame] | 761 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 762 | def MOVLPSmr : PSI<0x13, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 763 | "movlps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 764 | [(store (f64 (vector_extract (bc_v2f64 (v4f32 VR128:$src)), |
| 765 | (iPTR 0))), addr:$dst)]>; |
| 766 | |
| 767 | // v2f64 extract element 1 is always custom lowered to unpack high to low |
| 768 | // 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] | 769 | def MOVHPSmr : PSI<0x17, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 770 | "movhps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 771 | [(store (f64 (vector_extract |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 772 | (unpckh (bc_v2f64 (v4f32 VR128:$src)), |
| 773 | (undef)), (iPTR 0))), addr:$dst)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 774 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 775 | let Constraints = "$src1 = $dst" in { |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 776 | let AddedComplexity = 20 in { |
Evan Cheng | 7581a82 | 2009-05-12 20:17:52 +0000 | [diff] [blame] | 777 | def MOVLHPSrr : PSI<0x16, MRMSrcReg, (outs VR128:$dst), |
| 778 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 779 | "movlhps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 780 | [(set VR128:$dst, |
Nate Begeman | b13034d | 2009-11-07 23:17:15 +0000 | [diff] [blame] | 781 | (v4f32 (movlhps VR128:$src1, VR128:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 782 | |
Evan Cheng | 7581a82 | 2009-05-12 20:17:52 +0000 | [diff] [blame] | 783 | def MOVHLPSrr : PSI<0x12, MRMSrcReg, (outs VR128:$dst), |
| 784 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 785 | "movhlps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 786 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 787 | (v4f32 (movhlps VR128:$src1, VR128:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 788 | } // AddedComplexity |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 789 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 790 | |
Nate Begeman | b44aad7 | 2009-04-29 22:47:44 +0000 | [diff] [blame] | 791 | let AddedComplexity = 20 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 792 | def : Pat<(v4f32 (movddup VR128:$src, (undef))), |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 793 | (MOVLHPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>; |
Nate Begeman | b44aad7 | 2009-04-29 22:47:44 +0000 | [diff] [blame] | 794 | def : Pat<(v2i64 (movddup VR128:$src, (undef))), |
| 795 | (MOVLHPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>; |
| 796 | } |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 797 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 798 | |
| 799 | |
| 800 | // Arithmetic |
| 801 | |
| 802 | /// sse1_fp_unop_rm - SSE1 unops come in both scalar and vector forms. |
| 803 | /// |
| 804 | /// In addition, we also have a special variant of the scalar form here to |
| 805 | /// represent the associated intrinsic operation. This form is unlike the |
| 806 | /// plain scalar form, in that it takes an entire vector (instead of a |
| 807 | /// scalar) and leaves the top elements undefined. |
| 808 | /// |
| 809 | /// And, we have a special variant form for a full-vector intrinsic form. |
| 810 | /// |
| 811 | /// These four forms can each have a reg or a mem operand, so there are a |
| 812 | /// total of eight "instructions". |
| 813 | /// |
| 814 | multiclass sse1_fp_unop_rm<bits<8> opc, string OpcodeStr, |
| 815 | SDNode OpNode, |
| 816 | Intrinsic F32Int, |
| 817 | Intrinsic V4F32Int, |
| 818 | bit Commutable = 0> { |
| 819 | // Scalar operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 820 | def SSr : SSI<opc, MRMSrcReg, (outs FR32:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 821 | !strconcat(OpcodeStr, "ss\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 822 | [(set FR32:$dst, (OpNode FR32:$src))]> { |
| 823 | let isCommutable = Commutable; |
| 824 | } |
| 825 | |
| 826 | // Scalar operation, mem. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 827 | def SSm : SSI<opc, MRMSrcMem, (outs FR32:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 828 | !strconcat(OpcodeStr, "ss\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 829 | [(set FR32:$dst, (OpNode (load addr:$src)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 830 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 831 | // Vector operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 832 | def PSr : PSI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 833 | !strconcat(OpcodeStr, "ps\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 834 | [(set VR128:$dst, (v4f32 (OpNode VR128:$src)))]> { |
| 835 | let isCommutable = Commutable; |
| 836 | } |
| 837 | |
| 838 | // Vector operation, mem. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 839 | def PSm : PSI<opc, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 840 | !strconcat(OpcodeStr, "ps\t{$src, $dst|$dst, $src}"), |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 841 | [(set VR128:$dst, (OpNode (memopv4f32 addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 842 | |
| 843 | // Intrinsic operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 844 | def SSr_Int : SSI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 845 | !strconcat(OpcodeStr, "ss\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 846 | [(set VR128:$dst, (F32Int VR128:$src))]> { |
| 847 | let isCommutable = Commutable; |
| 848 | } |
| 849 | |
| 850 | // Intrinsic operation, mem. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 851 | def SSm_Int : SSI<opc, MRMSrcMem, (outs VR128:$dst), (ins ssmem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 852 | !strconcat(OpcodeStr, "ss\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 853 | [(set VR128:$dst, (F32Int sse_load_f32:$src))]>; |
| 854 | |
| 855 | // Vector intrinsic operation, reg |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 856 | def PSr_Int : PSI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 857 | !strconcat(OpcodeStr, "ps\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 858 | [(set VR128:$dst, (V4F32Int VR128:$src))]> { |
| 859 | let isCommutable = Commutable; |
| 860 | } |
| 861 | |
| 862 | // Vector intrinsic operation, mem |
Dan Gohman | c747be5 | 2007-08-02 21:06:40 +0000 | [diff] [blame] | 863 | def PSm_Int : PSI<opc, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 864 | !strconcat(OpcodeStr, "ps\t{$src, $dst|$dst, $src}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 865 | [(set VR128:$dst, (V4F32Int (memopv4f32 addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 866 | } |
| 867 | |
| 868 | // Square root. |
| 869 | defm SQRT : sse1_fp_unop_rm<0x51, "sqrt", fsqrt, |
| 870 | int_x86_sse_sqrt_ss, int_x86_sse_sqrt_ps>; |
| 871 | |
| 872 | // Reciprocal approximations. Note that these typically require refinement |
| 873 | // in order to obtain suitable precision. |
| 874 | defm RSQRT : sse1_fp_unop_rm<0x52, "rsqrt", X86frsqrt, |
| 875 | int_x86_sse_rsqrt_ss, int_x86_sse_rsqrt_ps>; |
| 876 | defm RCP : sse1_fp_unop_rm<0x53, "rcp", X86frcp, |
| 877 | int_x86_sse_rcp_ss, int_x86_sse_rcp_ps>; |
| 878 | |
| 879 | // Logical |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 880 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 881 | let isCommutable = 1 in { |
| 882 | def ANDPSrr : PSI<0x54, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 883 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 884 | "andps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 885 | [(set VR128:$dst, (v2i64 |
| 886 | (and VR128:$src1, VR128:$src2)))]>; |
| 887 | def ORPSrr : PSI<0x56, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 888 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 889 | "orps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 890 | [(set VR128:$dst, (v2i64 |
| 891 | (or VR128:$src1, VR128:$src2)))]>; |
| 892 | def XORPSrr : PSI<0x57, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 893 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 894 | "xorps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 895 | [(set VR128:$dst, (v2i64 |
| 896 | (xor VR128:$src1, VR128:$src2)))]>; |
| 897 | } |
| 898 | |
| 899 | def ANDPSrm : PSI<0x54, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 900 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 901 | "andps\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 902 | [(set VR128:$dst, (and (bc_v2i64 (v4f32 VR128:$src1)), |
| 903 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 904 | def ORPSrm : PSI<0x56, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 905 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 906 | "orps\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 907 | [(set VR128:$dst, (or (bc_v2i64 (v4f32 VR128:$src1)), |
| 908 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 909 | def XORPSrm : PSI<0x57, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 910 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 911 | "xorps\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 912 | [(set VR128:$dst, (xor (bc_v2i64 (v4f32 VR128:$src1)), |
| 913 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 914 | def ANDNPSrr : PSI<0x55, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 915 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 916 | "andnps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 917 | [(set VR128:$dst, |
| 918 | (v2i64 (and (xor VR128:$src1, |
| 919 | (bc_v2i64 (v4i32 immAllOnesV))), |
| 920 | VR128:$src2)))]>; |
| 921 | def ANDNPSrm : PSI<0x55, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 922 | (outs VR128:$dst), (ins VR128:$src1,f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 923 | "andnps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 924 | [(set VR128:$dst, |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 925 | (v2i64 (and (xor (bc_v2i64 (v4f32 VR128:$src1)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 926 | (bc_v2i64 (v4i32 immAllOnesV))), |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 927 | (memopv2i64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 928 | } |
| 929 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 930 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 931 | def CMPPSrri : PSIi8<0xC2, MRMSrcReg, |
Nate Begeman | 061db5f | 2008-05-12 20:34:32 +0000 | [diff] [blame] | 932 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src, SSECC:$cc), |
| 933 | "cmp${cc}ps\t{$src, $dst|$dst, $src}", |
| 934 | [(set VR128:$dst, (int_x86_sse_cmp_ps VR128:$src1, |
| 935 | VR128:$src, imm:$cc))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 936 | def CMPPSrmi : PSIi8<0xC2, MRMSrcMem, |
Nate Begeman | 061db5f | 2008-05-12 20:34:32 +0000 | [diff] [blame] | 937 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src, SSECC:$cc), |
| 938 | "cmp${cc}ps\t{$src, $dst|$dst, $src}", |
| 939 | [(set VR128:$dst, (int_x86_sse_cmp_ps VR128:$src1, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 940 | (memop addr:$src), imm:$cc))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 941 | } |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 942 | def : Pat<(v4i32 (X86cmpps (v4f32 VR128:$src1), VR128:$src2, imm:$cc)), |
| 943 | (CMPPSrri VR128:$src1, VR128:$src2, imm:$cc)>; |
| 944 | def : Pat<(v4i32 (X86cmpps (v4f32 VR128:$src1), (memop addr:$src2), imm:$cc)), |
| 945 | (CMPPSrmi VR128:$src1, addr:$src2, imm:$cc)>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 946 | |
| 947 | // Shuffle and unpack instructions |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 948 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 949 | let isConvertibleToThreeAddress = 1 in // Convert to pshufd |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 950 | def SHUFPSrri : PSIi8<0xC6, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 951 | (outs VR128:$dst), (ins VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 952 | VR128:$src2, i8imm:$src3), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 953 | "shufps\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 954 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 955 | (v4f32 (shufp:$src3 VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 956 | def SHUFPSrmi : PSIi8<0xC6, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 957 | (outs VR128:$dst), (ins VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 958 | f128mem:$src2, i8imm:$src3), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 959 | "shufps\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 960 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 961 | (v4f32 (shufp:$src3 |
| 962 | VR128:$src1, (memopv4f32 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 963 | |
| 964 | let AddedComplexity = 10 in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 965 | def UNPCKHPSrr : PSI<0x15, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 966 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 967 | "unpckhps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 968 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 969 | (v4f32 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 970 | def UNPCKHPSrm : PSI<0x15, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 971 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 972 | "unpckhps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 973 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 974 | (v4f32 (unpckh VR128:$src1, |
| 975 | (memopv4f32 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 976 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 977 | def UNPCKLPSrr : PSI<0x14, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 978 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 979 | "unpcklps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 980 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 981 | (v4f32 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 982 | def UNPCKLPSrm : PSI<0x14, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 983 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 984 | "unpcklps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 985 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 986 | (unpckl VR128:$src1, (memopv4f32 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 987 | } // AddedComplexity |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 988 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 989 | |
| 990 | // Mask creation |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 991 | def MOVMSKPSrr : PSI<0x50, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 992 | "movmskps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 993 | [(set GR32:$dst, (int_x86_sse_movmsk_ps VR128:$src))]>; |
Evan Cheng | d8296b8 | 2009-05-28 18:55:28 +0000 | [diff] [blame] | 994 | def MOVMSKPDrr : PDI<0x50, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 995 | "movmskpd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 996 | [(set GR32:$dst, (int_x86_sse2_movmsk_pd VR128:$src))]>; |
| 997 | |
Evan Cheng | d1d6807 | 2008-03-08 00:58:38 +0000 | [diff] [blame] | 998 | // Prefetch intrinsic. |
| 999 | def PREFETCHT0 : PSI<0x18, MRM1m, (outs), (ins i8mem:$src), |
| 1000 | "prefetcht0\t$src", [(prefetch addr:$src, imm, (i32 3))]>; |
| 1001 | def PREFETCHT1 : PSI<0x18, MRM2m, (outs), (ins i8mem:$src), |
| 1002 | "prefetcht1\t$src", [(prefetch addr:$src, imm, (i32 2))]>; |
| 1003 | def PREFETCHT2 : PSI<0x18, MRM3m, (outs), (ins i8mem:$src), |
| 1004 | "prefetcht2\t$src", [(prefetch addr:$src, imm, (i32 1))]>; |
| 1005 | def PREFETCHNTA : PSI<0x18, MRM0m, (outs), (ins i8mem:$src), |
| 1006 | "prefetchnta\t$src", [(prefetch addr:$src, imm, (i32 0))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1007 | |
| 1008 | // Non-temporal stores |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1009 | def MOVNTPSmr : PSI<0x2B, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1010 | "movntps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1011 | [(int_x86_sse_movnt_ps addr:$dst, VR128:$src)]>; |
| 1012 | |
| 1013 | // Load, store, and memory fence |
Evan Cheng | 68cca15 | 2009-05-27 18:38:01 +0000 | [diff] [blame] | 1014 | def SFENCE : PSI<0xAE, MRM7r, (outs), (ins), "sfence", [(int_x86_sse_sfence)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1015 | |
| 1016 | // MXCSR register |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1017 | def LDMXCSR : PSI<0xAE, MRM2m, (outs), (ins i32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1018 | "ldmxcsr\t$src", [(int_x86_sse_ldmxcsr addr:$src)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1019 | def STMXCSR : PSI<0xAE, MRM3m, (outs), (ins i32mem:$dst), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1020 | "stmxcsr\t$dst", [(int_x86_sse_stmxcsr addr:$dst)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1021 | |
| 1022 | // Alias instructions that map zero vector to pxor / xorp* for sse. |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1023 | // We set canFoldAsLoad because this can be converted to a constant-pool |
Dan Gohman | 37eb6c8 | 2008-12-03 05:21:24 +0000 | [diff] [blame] | 1024 | // load of an all-zeros value if folding it would be beneficial. |
Daniel Dunbar | a0e6200 | 2009-08-11 22:17:52 +0000 | [diff] [blame] | 1025 | let isReMaterializable = 1, isAsCheapAsAMove = 1, canFoldAsLoad = 1, |
| 1026 | isCodeGenOnly = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1027 | def V_SET0 : PSI<0x57, MRMInitReg, (outs VR128:$dst), (ins), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1028 | "xorps\t$dst, $dst", |
Chris Lattner | e6aa386 | 2007-11-25 00:24:49 +0000 | [diff] [blame] | 1029 | [(set VR128:$dst, (v4i32 immAllZerosV))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1030 | |
Evan Cheng | a15896e | 2008-03-12 07:02:50 +0000 | [diff] [blame] | 1031 | let Predicates = [HasSSE1] in { |
| 1032 | def : Pat<(v2i64 immAllZerosV), (V_SET0)>; |
| 1033 | def : Pat<(v8i16 immAllZerosV), (V_SET0)>; |
| 1034 | def : Pat<(v16i8 immAllZerosV), (V_SET0)>; |
| 1035 | def : Pat<(v2f64 immAllZerosV), (V_SET0)>; |
| 1036 | def : Pat<(v4f32 immAllZerosV), (V_SET0)>; |
| 1037 | } |
| 1038 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1039 | // FR32 to 128-bit vector conversion. |
Evan Cheng | bd0ca9c | 2009-02-05 08:42:55 +0000 | [diff] [blame] | 1040 | let isAsCheapAsAMove = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1041 | def MOVSS2PSrr : SSI<0x10, MRMSrcReg, (outs VR128:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1042 | "movss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1043 | [(set VR128:$dst, |
| 1044 | (v4f32 (scalar_to_vector FR32:$src)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1045 | def MOVSS2PSrm : SSI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1046 | "movss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1047 | [(set VR128:$dst, |
| 1048 | (v4f32 (scalar_to_vector (loadf32 addr:$src))))]>; |
| 1049 | |
| 1050 | // FIXME: may not be able to eliminate this movss with coalescing the src and |
| 1051 | // dest register classes are different. We really want to write this pattern |
| 1052 | // like this: |
| 1053 | // def : Pat<(f32 (vector_extract (v4f32 VR128:$src), (iPTR 0))), |
| 1054 | // (f32 FR32:$src)>; |
Evan Cheng | bd0ca9c | 2009-02-05 08:42:55 +0000 | [diff] [blame] | 1055 | let isAsCheapAsAMove = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1056 | def MOVPS2SSrr : SSI<0x10, MRMSrcReg, (outs FR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1057 | "movss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1058 | [(set FR32:$dst, (vector_extract (v4f32 VR128:$src), |
| 1059 | (iPTR 0)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1060 | def MOVPS2SSmr : SSI<0x11, MRMDestMem, (outs), (ins f32mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1061 | "movss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1062 | [(store (f32 (vector_extract (v4f32 VR128:$src), |
| 1063 | (iPTR 0))), addr:$dst)]>; |
| 1064 | |
| 1065 | |
| 1066 | // Move to lower bits of a VR128, leaving upper bits alone. |
| 1067 | // Three operand (but two address) aliases. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1068 | let Constraints = "$src1 = $dst" in { |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1069 | let neverHasSideEffects = 1 in |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1070 | def MOVLSS2PSrr : SSI<0x10, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1071 | (outs VR128:$dst), (ins VR128:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1072 | "movss\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1073 | |
| 1074 | let AddedComplexity = 15 in |
| 1075 | def MOVLPSrr : SSI<0x10, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1076 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1077 | "movss\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1078 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1079 | (v4f32 (movl VR128:$src1, VR128:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1080 | } |
| 1081 | |
| 1082 | // Move to lower bits of a VR128 and zeroing upper bits. |
| 1083 | // Loading from memory automatically zeroing upper bits. |
| 1084 | let AddedComplexity = 20 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1085 | def MOVZSS2PSrm : SSI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1086 | "movss\t{$src, $dst|$dst, $src}", |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 1087 | [(set VR128:$dst, (v4f32 (X86vzmovl (v4f32 (scalar_to_vector |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1088 | (loadf32 addr:$src))))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1089 | |
Evan Cheng | 056afe1 | 2008-05-20 18:24:47 +0000 | [diff] [blame] | 1090 | def : Pat<(v4f32 (X86vzmovl (loadv4f32 addr:$src))), |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 1091 | (MOVZSS2PSrm addr:$src)>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1092 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1093 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1094 | // SSE2 Instructions |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1095 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1096 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1097 | // Move Instructions |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1098 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1099 | def MOVSDrr : SDI<0x10, MRMSrcReg, (outs FR64:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1100 | "movsd\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1101 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1102 | def MOVSDrm : SDI<0x10, MRMSrcMem, (outs FR64:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1103 | "movsd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1104 | [(set FR64:$dst, (loadf64 addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1105 | def MOVSDmr : SDI<0x11, MRMDestMem, (outs), (ins f64mem:$dst, FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1106 | "movsd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1107 | [(store FR64:$src, addr:$dst)]>; |
| 1108 | |
| 1109 | // Conversion instructions |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1110 | def CVTTSD2SIrr : SDI<0x2C, MRMSrcReg, (outs GR32:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1111 | "cvttsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1112 | [(set GR32:$dst, (fp_to_sint FR64:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1113 | def CVTTSD2SIrm : SDI<0x2C, MRMSrcMem, (outs GR32:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1114 | "cvttsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1115 | [(set GR32:$dst, (fp_to_sint (loadf64 addr:$src)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1116 | def CVTSD2SSrr : SDI<0x5A, MRMSrcReg, (outs FR32:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1117 | "cvtsd2ss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1118 | [(set FR32:$dst, (fround FR64:$src))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1119 | def CVTSD2SSrm : SDI<0x5A, MRMSrcMem, (outs FR32:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1120 | "cvtsd2ss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1121 | [(set FR32:$dst, (fround (loadf64 addr:$src)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1122 | def CVTSI2SDrr : SDI<0x2A, MRMSrcReg, (outs FR64:$dst), (ins GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1123 | "cvtsi2sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1124 | [(set FR64:$dst, (sint_to_fp GR32:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1125 | def CVTSI2SDrm : SDI<0x2A, MRMSrcMem, (outs FR64:$dst), (ins i32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1126 | "cvtsi2sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1127 | [(set FR64:$dst, (sint_to_fp (loadi32 addr:$src)))]>; |
| 1128 | |
Sean Callanan | 3d5824c | 2009-09-16 01:13:52 +0000 | [diff] [blame] | 1129 | def CVTPD2DQrm : S3DI<0xE6, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
| 1130 | "cvtpd2dq\t{$src, $dst|$dst, $src}", []>; |
| 1131 | def CVTPD2DQrr : S3DI<0xE6, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1132 | "cvtpd2dq\t{$src, $dst|$dst, $src}", []>; |
| 1133 | def CVTDQ2PDrm : S3SI<0xE6, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
| 1134 | "cvtdq2pd\t{$src, $dst|$dst, $src}", []>; |
| 1135 | def CVTDQ2PDrr : S3SI<0xE6, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1136 | "cvtdq2pd\t{$src, $dst|$dst, $src}", []>; |
| 1137 | def CVTPS2DQrr : PDI<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1138 | "cvtps2dq\t{$src, $dst|$dst, $src}", []>; |
| 1139 | def CVTPS2DQrm : PDI<0x5B, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
| 1140 | "cvtps2dq\t{$src, $dst|$dst, $src}", []>; |
| 1141 | def CVTDQ2PSrr : PSI<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1142 | "cvtdq2ps\t{$src, $dst|$dst, $src}", []>; |
| 1143 | def CVTDQ2PSrm : PSI<0x5B, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
| 1144 | "cvtdq2ps\t{$src, $dst|$dst, $src}", []>; |
| 1145 | def COMISDrr: PDI<0x2F, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
| 1146 | "comisd\t{$src2, $src1|$src1, $src2}", []>; |
| 1147 | def COMISDrm: PDI<0x2F, MRMSrcMem, (outs), (ins VR128:$src1, f128mem:$src2), |
| 1148 | "comisd\t{$src2, $src1|$src1, $src2}", []>; |
| 1149 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1150 | // SSE2 instructions with XS prefix |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1151 | def CVTSS2SDrr : I<0x5A, MRMSrcReg, (outs FR64:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1152 | "cvtss2sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1153 | [(set FR64:$dst, (fextend FR32:$src))]>, XS, |
| 1154 | Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1155 | def CVTSS2SDrm : I<0x5A, MRMSrcMem, (outs FR64:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1156 | "cvtss2sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1157 | [(set FR64:$dst, (extloadf32 addr:$src))]>, XS, |
| 1158 | Requires<[HasSSE2]>; |
| 1159 | |
| 1160 | // Match intrinsics which expect XMM operand(s). |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1161 | def Int_CVTSD2SIrr : SDI<0x2D, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1162 | "cvtsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1163 | [(set GR32:$dst, (int_x86_sse2_cvtsd2si VR128:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1164 | def Int_CVTSD2SIrm : SDI<0x2D, MRMSrcMem, (outs GR32:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1165 | "cvtsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1166 | [(set GR32:$dst, (int_x86_sse2_cvtsd2si |
| 1167 | (load addr:$src)))]>; |
| 1168 | |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 1169 | // Match intrinisics which expect MM and XMM operand(s). |
| 1170 | def Int_CVTPD2PIrr : PDI<0x2D, MRMSrcReg, (outs VR64:$dst), (ins VR128:$src), |
| 1171 | "cvtpd2pi\t{$src, $dst|$dst, $src}", |
| 1172 | [(set VR64:$dst, (int_x86_sse_cvtpd2pi VR128:$src))]>; |
| 1173 | def Int_CVTPD2PIrm : PDI<0x2D, MRMSrcMem, (outs VR64:$dst), (ins f128mem:$src), |
| 1174 | "cvtpd2pi\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1175 | [(set VR64:$dst, (int_x86_sse_cvtpd2pi |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1176 | (memop addr:$src)))]>; |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 1177 | def Int_CVTTPD2PIrr: PDI<0x2C, MRMSrcReg, (outs VR64:$dst), (ins VR128:$src), |
| 1178 | "cvttpd2pi\t{$src, $dst|$dst, $src}", |
| 1179 | [(set VR64:$dst, (int_x86_sse_cvttpd2pi VR128:$src))]>; |
| 1180 | def Int_CVTTPD2PIrm: PDI<0x2C, MRMSrcMem, (outs VR64:$dst), (ins f128mem:$src), |
| 1181 | "cvttpd2pi\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1182 | [(set VR64:$dst, (int_x86_sse_cvttpd2pi |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1183 | (memop addr:$src)))]>; |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 1184 | def Int_CVTPI2PDrr : PDI<0x2A, MRMSrcReg, (outs VR128:$dst), (ins VR64:$src), |
| 1185 | "cvtpi2pd\t{$src, $dst|$dst, $src}", |
| 1186 | [(set VR128:$dst, (int_x86_sse_cvtpi2pd VR64:$src))]>; |
| 1187 | def Int_CVTPI2PDrm : PDI<0x2A, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), |
| 1188 | "cvtpi2pd\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1189 | [(set VR128:$dst, (int_x86_sse_cvtpi2pd |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 1190 | (load addr:$src)))]>; |
| 1191 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1192 | // Aliases for intrinsics |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1193 | def Int_CVTTSD2SIrr : SDI<0x2C, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1194 | "cvttsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1195 | [(set GR32:$dst, |
| 1196 | (int_x86_sse2_cvttsd2si VR128:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1197 | def Int_CVTTSD2SIrm : SDI<0x2C, MRMSrcMem, (outs GR32:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1198 | "cvttsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1199 | [(set GR32:$dst, (int_x86_sse2_cvttsd2si |
| 1200 | (load addr:$src)))]>; |
| 1201 | |
| 1202 | // Comparison instructions |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1203 | let Constraints = "$src1 = $dst", neverHasSideEffects = 1 in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1204 | def CMPSDrr : SDIi8<0xC2, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1205 | (outs FR64:$dst), (ins FR64:$src1, FR64:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1206 | "cmp${cc}sd\t{$src, $dst|$dst, $src}", []>; |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1207 | let mayLoad = 1 in |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1208 | def CMPSDrm : SDIi8<0xC2, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1209 | (outs FR64:$dst), (ins FR64:$src1, f64mem:$src, 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 | } |
| 1212 | |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1213 | let Defs = [EFLAGS] in { |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1214 | def UCOMISDrr: PDI<0x2E, MRMSrcReg, (outs), (ins FR64:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1215 | "ucomisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1216 | [(X86cmp FR64:$src1, FR64:$src2), (implicit EFLAGS)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1217 | def UCOMISDrm: PDI<0x2E, MRMSrcMem, (outs), (ins FR64:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1218 | "ucomisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1219 | [(X86cmp FR64:$src1, (loadf64 addr:$src2)), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1220 | (implicit EFLAGS)]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1221 | } // Defs = [EFLAGS] |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1222 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1223 | // Aliases to match intrinsics which expect XMM operand(s). |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1224 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1225 | def Int_CMPSDrr : SDIi8<0xC2, MRMSrcReg, |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1226 | (outs VR128:$dst), |
| 1227 | (ins VR128:$src1, VR128:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1228 | "cmp${cc}sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1229 | [(set VR128:$dst, (int_x86_sse2_cmp_sd VR128:$src1, |
| 1230 | VR128:$src, imm:$cc))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1231 | def Int_CMPSDrm : SDIi8<0xC2, MRMSrcMem, |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1232 | (outs VR128:$dst), |
| 1233 | (ins VR128:$src1, f64mem:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1234 | "cmp${cc}sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1235 | [(set VR128:$dst, (int_x86_sse2_cmp_sd VR128:$src1, |
| 1236 | (load addr:$src), imm:$cc))]>; |
| 1237 | } |
| 1238 | |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1239 | let Defs = [EFLAGS] in { |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1240 | def Int_UCOMISDrr: PDI<0x2E, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1241 | "ucomisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1242 | [(X86ucomi (v2f64 VR128:$src1), (v2f64 VR128:$src2)), |
| 1243 | (implicit EFLAGS)]>; |
| 1244 | def Int_UCOMISDrm: PDI<0x2E, MRMSrcMem, (outs),(ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1245 | "ucomisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1246 | [(X86ucomi (v2f64 VR128:$src1), (load addr:$src2)), |
| 1247 | (implicit EFLAGS)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1248 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1249 | def Int_COMISDrr: PDI<0x2F, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1250 | "comisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1251 | [(X86comi (v2f64 VR128:$src1), (v2f64 VR128:$src2)), |
| 1252 | (implicit EFLAGS)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1253 | def Int_COMISDrm: PDI<0x2F, MRMSrcMem, (outs), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1254 | "comisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1255 | [(X86comi (v2f64 VR128:$src1), (load addr:$src2)), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1256 | (implicit EFLAGS)]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1257 | } // Defs = [EFLAGS] |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1258 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1259 | // Aliases of packed SSE2 instructions for scalar use. These all have names |
| 1260 | // that start with 'Fs'. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1261 | |
| 1262 | // Alias instructions that map fld0 to pxor for sse. |
Dan Gohman | 51dbce6 | 2009-09-21 18:30:38 +0000 | [diff] [blame] | 1263 | let isReMaterializable = 1, isAsCheapAsAMove = 1, isCodeGenOnly = 1, |
| 1264 | canFoldAsLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1265 | def FsFLD0SD : I<0xEF, MRMInitReg, (outs FR64:$dst), (ins), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1266 | "pxor\t$dst, $dst", [(set FR64:$dst, fpimm0)]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1267 | Requires<[HasSSE2]>, TB, OpSize; |
| 1268 | |
| 1269 | // Alias instruction to do FR64 reg-to-reg copy using movapd. Upper bits are |
| 1270 | // disregarded. |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1271 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1272 | def FsMOVAPDrr : PDI<0x28, MRMSrcReg, (outs FR64:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1273 | "movapd\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1274 | |
| 1275 | // Alias instruction to load FR64 from f128mem using movapd. Upper bits are |
| 1276 | // disregarded. |
Evan Cheng | 8e66471 | 2009-11-17 09:51:18 +0000 | [diff] [blame] | 1277 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1278 | def FsMOVAPDrm : PDI<0x28, MRMSrcMem, (outs FR64:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1279 | "movapd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 1280 | [(set FR64:$dst, (alignedloadfsf64 addr:$src))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1281 | |
| 1282 | // Alias bitwise logical operations using SSE logical ops on packed FP values. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1283 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1284 | let isCommutable = 1 in { |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1285 | def FsANDPDrr : PDI<0x54, MRMSrcReg, (outs FR64:$dst), |
| 1286 | (ins FR64:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1287 | "andpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1288 | [(set FR64:$dst, (X86fand FR64:$src1, FR64:$src2))]>; |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1289 | def FsORPDrr : PDI<0x56, MRMSrcReg, (outs FR64:$dst), |
| 1290 | (ins FR64:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1291 | "orpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1292 | [(set FR64:$dst, (X86for FR64:$src1, FR64:$src2))]>; |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1293 | def FsXORPDrr : PDI<0x57, MRMSrcReg, (outs FR64:$dst), |
| 1294 | (ins FR64:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1295 | "xorpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1296 | [(set FR64:$dst, (X86fxor FR64:$src1, FR64:$src2))]>; |
| 1297 | } |
| 1298 | |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1299 | def FsANDPDrm : PDI<0x54, MRMSrcMem, (outs FR64:$dst), |
| 1300 | (ins FR64:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1301 | "andpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1302 | [(set FR64:$dst, (X86fand FR64:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 1303 | (memopfsf64 addr:$src2)))]>; |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1304 | def FsORPDrm : PDI<0x56, MRMSrcMem, (outs FR64:$dst), |
| 1305 | (ins FR64:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1306 | "orpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1307 | [(set FR64:$dst, (X86for FR64:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 1308 | (memopfsf64 addr:$src2)))]>; |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1309 | def FsXORPDrm : PDI<0x57, MRMSrcMem, (outs FR64:$dst), |
| 1310 | (ins FR64:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1311 | "xorpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1312 | [(set FR64:$dst, (X86fxor FR64:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 1313 | (memopfsf64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1314 | |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1315 | let neverHasSideEffects = 1 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1316 | def FsANDNPDrr : PDI<0x55, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1317 | (outs FR64:$dst), (ins FR64:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1318 | "andnpd\t{$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1319 | let mayLoad = 1 in |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1320 | def FsANDNPDrm : PDI<0x55, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1321 | (outs FR64:$dst), (ins FR64:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1322 | "andnpd\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1323 | } |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1324 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1325 | |
| 1326 | /// basic_sse2_fp_binop_rm - SSE2 binops come in both scalar and vector forms. |
| 1327 | /// |
| 1328 | /// In addition, we also have a special variant of the scalar form here to |
| 1329 | /// represent the associated intrinsic operation. This form is unlike the |
| 1330 | /// 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] | 1331 | /// and leaves the top elements unmodified (therefore these cannot be commuted). |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1332 | /// |
| 1333 | /// These three forms can each be reg+reg or reg+mem, so there are a total of |
| 1334 | /// six "instructions". |
| 1335 | /// |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1336 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1337 | multiclass basic_sse2_fp_binop_rm<bits<8> opc, string OpcodeStr, |
| 1338 | SDNode OpNode, Intrinsic F64Int, |
| 1339 | bit Commutable = 0> { |
| 1340 | // Scalar operation, reg+reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1341 | 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] | 1342 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1343 | [(set FR64:$dst, (OpNode FR64:$src1, FR64:$src2))]> { |
| 1344 | let isCommutable = Commutable; |
| 1345 | } |
| 1346 | |
| 1347 | // Scalar operation, reg+mem. |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1348 | def SDrm : SDI<opc, MRMSrcMem, (outs FR64:$dst), |
| 1349 | (ins FR64:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1350 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1351 | [(set FR64:$dst, (OpNode FR64:$src1, (load addr:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1352 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1353 | // Vector operation, reg+reg. |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1354 | def PDrr : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1355 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1356 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1357 | [(set VR128:$dst, (v2f64 (OpNode VR128:$src1, VR128:$src2)))]> { |
| 1358 | let isCommutable = Commutable; |
| 1359 | } |
| 1360 | |
| 1361 | // Vector operation, reg+mem. |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1362 | def PDrm : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1363 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1364 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1365 | [(set VR128:$dst, (OpNode VR128:$src1, (memopv2f64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1366 | |
| 1367 | // Intrinsic operation, reg+reg. |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1368 | def SDrr_Int : SDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1369 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1370 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 5d5dbbc | 2009-02-26 03:12:02 +0000 | [diff] [blame] | 1371 | [(set VR128:$dst, (F64Int VR128:$src1, VR128:$src2))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1372 | |
| 1373 | // Intrinsic operation, reg+mem. |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1374 | def SDrm_Int : SDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1375 | (ins VR128:$src1, sdmem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1376 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1377 | [(set VR128:$dst, (F64Int VR128:$src1, |
| 1378 | sse_load_f64:$src2))]>; |
| 1379 | } |
| 1380 | } |
| 1381 | |
| 1382 | // Arithmetic instructions |
| 1383 | defm ADD : basic_sse2_fp_binop_rm<0x58, "add", fadd, int_x86_sse2_add_sd, 1>; |
| 1384 | defm MUL : basic_sse2_fp_binop_rm<0x59, "mul", fmul, int_x86_sse2_mul_sd, 1>; |
| 1385 | defm SUB : basic_sse2_fp_binop_rm<0x5C, "sub", fsub, int_x86_sse2_sub_sd>; |
| 1386 | defm DIV : basic_sse2_fp_binop_rm<0x5E, "div", fdiv, int_x86_sse2_div_sd>; |
| 1387 | |
| 1388 | /// sse2_fp_binop_rm - Other SSE2 binops |
| 1389 | /// |
| 1390 | /// This multiclass is like basic_sse2_fp_binop_rm, with the addition of |
| 1391 | /// instructions for a full-vector intrinsic form. Operations that map |
| 1392 | /// onto C operators don't use this form since they just use the plain |
| 1393 | /// vector form instead of having a separate vector intrinsic form. |
| 1394 | /// |
| 1395 | /// This provides a total of eight "instructions". |
| 1396 | /// |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1397 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1398 | multiclass sse2_fp_binop_rm<bits<8> opc, string OpcodeStr, |
| 1399 | SDNode OpNode, |
| 1400 | Intrinsic F64Int, |
| 1401 | Intrinsic V2F64Int, |
| 1402 | bit Commutable = 0> { |
| 1403 | |
| 1404 | // Scalar operation, reg+reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1405 | 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] | 1406 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1407 | [(set FR64:$dst, (OpNode FR64:$src1, FR64:$src2))]> { |
| 1408 | let isCommutable = Commutable; |
| 1409 | } |
| 1410 | |
| 1411 | // Scalar operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1412 | def SDrm : SDI<opc, MRMSrcMem, (outs FR64:$dst), |
| 1413 | (ins FR64:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1414 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1415 | [(set FR64:$dst, (OpNode FR64:$src1, (load addr:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1416 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1417 | // Vector operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1418 | def PDrr : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1419 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1420 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1421 | [(set VR128:$dst, (v2f64 (OpNode VR128:$src1, VR128:$src2)))]> { |
| 1422 | let isCommutable = Commutable; |
| 1423 | } |
| 1424 | |
| 1425 | // Vector operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1426 | def PDrm : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1427 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1428 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1429 | [(set VR128:$dst, (OpNode VR128:$src1, (memopv2f64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1430 | |
| 1431 | // Intrinsic operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1432 | def SDrr_Int : SDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1433 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1434 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1435 | [(set VR128:$dst, (F64Int VR128:$src1, VR128:$src2))]> { |
| 1436 | let isCommutable = Commutable; |
| 1437 | } |
| 1438 | |
| 1439 | // Intrinsic operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1440 | def SDrm_Int : SDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1441 | (ins VR128:$src1, sdmem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1442 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1443 | [(set VR128:$dst, (F64Int VR128:$src1, |
| 1444 | sse_load_f64:$src2))]>; |
| 1445 | |
| 1446 | // Vector intrinsic operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1447 | def PDrr_Int : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1448 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1449 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1450 | [(set VR128:$dst, (V2F64Int VR128:$src1, VR128:$src2))]> { |
| 1451 | let isCommutable = Commutable; |
| 1452 | } |
| 1453 | |
| 1454 | // Vector intrinsic operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1455 | def PDrm_Int : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1456 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1457 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1458 | [(set VR128:$dst, (V2F64Int VR128:$src1, |
| 1459 | (memopv2f64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1460 | } |
| 1461 | } |
| 1462 | |
| 1463 | defm MAX : sse2_fp_binop_rm<0x5F, "max", X86fmax, |
| 1464 | int_x86_sse2_max_sd, int_x86_sse2_max_pd>; |
| 1465 | defm MIN : sse2_fp_binop_rm<0x5D, "min", X86fmin, |
| 1466 | int_x86_sse2_min_sd, int_x86_sse2_min_pd>; |
| 1467 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1468 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1469 | // SSE packed FP Instructions |
| 1470 | |
| 1471 | // Move Instructions |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1472 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1473 | def MOVAPDrr : PDI<0x28, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1474 | "movapd\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1475 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1476 | def MOVAPDrm : PDI<0x28, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1477 | "movapd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1478 | [(set VR128:$dst, (alignedloadv2f64 addr:$src))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1479 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1480 | def MOVAPDmr : PDI<0x29, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1481 | "movapd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1482 | [(alignedstore (v2f64 VR128:$src), addr:$dst)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1483 | |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1484 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1485 | def MOVUPDrr : PDI<0x10, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1486 | "movupd\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1487 | let canFoldAsLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1488 | def MOVUPDrm : PDI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1489 | "movupd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1490 | [(set VR128:$dst, (loadv2f64 addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1491 | def MOVUPDmr : PDI<0x11, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1492 | "movupd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1493 | [(store (v2f64 VR128:$src), addr:$dst)]>; |
| 1494 | |
| 1495 | // Intrinsic forms of MOVUPD load and store |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1496 | def MOVUPDrm_Int : PDI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1497 | "movupd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1498 | [(set VR128:$dst, (int_x86_sse2_loadu_pd addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1499 | def MOVUPDmr_Int : PDI<0x11, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1500 | "movupd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1501 | [(int_x86_sse2_storeu_pd addr:$dst, VR128:$src)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1502 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1503 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1504 | let AddedComplexity = 20 in { |
| 1505 | def MOVLPDrm : PDI<0x12, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1506 | (outs VR128:$dst), (ins VR128:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1507 | "movlpd\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1508 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1509 | (v2f64 (movlp VR128:$src1, |
| 1510 | (scalar_to_vector (loadf64 addr:$src2)))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1511 | def MOVHPDrm : PDI<0x16, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1512 | (outs VR128:$dst), (ins VR128:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1513 | "movhpd\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1514 | [(set VR128:$dst, |
Nate Begeman | b13034d | 2009-11-07 23:17:15 +0000 | [diff] [blame] | 1515 | (v2f64 (movlhps VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1516 | (scalar_to_vector (loadf64 addr:$src2)))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1517 | } // AddedComplexity |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1518 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1519 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1520 | def MOVLPDmr : PDI<0x13, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1521 | "movlpd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1522 | [(store (f64 (vector_extract (v2f64 VR128:$src), |
| 1523 | (iPTR 0))), addr:$dst)]>; |
| 1524 | |
| 1525 | // v2f64 extract element 1 is always custom lowered to unpack high to low |
| 1526 | // 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] | 1527 | def MOVHPDmr : PDI<0x17, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1528 | "movhpd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1529 | [(store (f64 (vector_extract |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1530 | (v2f64 (unpckh VR128:$src, (undef))), |
| 1531 | (iPTR 0))), addr:$dst)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1532 | |
| 1533 | // SSE2 instructions without OpSize prefix |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1534 | def Int_CVTDQ2PSrr : I<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1535 | "cvtdq2ps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1536 | [(set VR128:$dst, (int_x86_sse2_cvtdq2ps VR128:$src))]>, |
| 1537 | TB, Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1538 | def Int_CVTDQ2PSrm : I<0x5B, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1539 | "cvtdq2ps\t{$src, $dst|$dst, $src}", |
| 1540 | [(set VR128:$dst, (int_x86_sse2_cvtdq2ps |
| 1541 | (bitconvert (memopv2i64 addr:$src))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1542 | TB, Requires<[HasSSE2]>; |
| 1543 | |
| 1544 | // SSE2 instructions with XS prefix |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1545 | def Int_CVTDQ2PDrr : I<0xE6, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1546 | "cvtdq2pd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1547 | [(set VR128:$dst, (int_x86_sse2_cvtdq2pd VR128:$src))]>, |
| 1548 | XS, Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1549 | def Int_CVTDQ2PDrm : I<0xE6, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1550 | "cvtdq2pd\t{$src, $dst|$dst, $src}", |
| 1551 | [(set VR128:$dst, (int_x86_sse2_cvtdq2pd |
| 1552 | (bitconvert (memopv2i64 addr:$src))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1553 | XS, Requires<[HasSSE2]>; |
| 1554 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1555 | def Int_CVTPS2DQrr : PDI<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1556 | "cvtps2dq\t{$src, $dst|$dst, $src}", |
| 1557 | [(set VR128:$dst, (int_x86_sse2_cvtps2dq VR128:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1558 | def Int_CVTPS2DQrm : PDI<0x5B, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1559 | "cvtps2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1560 | [(set VR128:$dst, (int_x86_sse2_cvtps2dq |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1561 | (memop addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1562 | // SSE2 packed instructions with XS prefix |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1563 | def CVTTPS2DQrr : SSI<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1564 | "cvttps2dq\t{$src, $dst|$dst, $src}", []>; |
| 1565 | def CVTTPS2DQrm : SSI<0x5B, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
| 1566 | "cvttps2dq\t{$src, $dst|$dst, $src}", []>; |
| 1567 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1568 | def Int_CVTTPS2DQrr : I<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1569 | "cvttps2dq\t{$src, $dst|$dst, $src}", |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1570 | [(set VR128:$dst, |
| 1571 | (int_x86_sse2_cvttps2dq VR128:$src))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1572 | XS, Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1573 | def Int_CVTTPS2DQrm : I<0x5B, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1574 | "cvttps2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1575 | [(set VR128:$dst, (int_x86_sse2_cvttps2dq |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1576 | (memop addr:$src)))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1577 | XS, Requires<[HasSSE2]>; |
| 1578 | |
| 1579 | // SSE2 packed instructions with XD prefix |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1580 | def Int_CVTPD2DQrr : I<0xE6, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1581 | "cvtpd2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1582 | [(set VR128:$dst, (int_x86_sse2_cvtpd2dq VR128:$src))]>, |
| 1583 | XD, Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1584 | def Int_CVTPD2DQrm : I<0xE6, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1585 | "cvtpd2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1586 | [(set VR128:$dst, (int_x86_sse2_cvtpd2dq |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1587 | (memop addr:$src)))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1588 | XD, Requires<[HasSSE2]>; |
| 1589 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1590 | def Int_CVTTPD2DQrr : PDI<0xE6, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1591 | "cvttpd2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1592 | [(set VR128:$dst, (int_x86_sse2_cvttpd2dq VR128:$src))]>; |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1593 | def Int_CVTTPD2DQrm : PDI<0xE6, MRMSrcMem, (outs VR128:$dst),(ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1594 | "cvttpd2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1595 | [(set VR128:$dst, (int_x86_sse2_cvttpd2dq |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1596 | (memop addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1597 | |
| 1598 | // SSE2 instructions without OpSize prefix |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1599 | def CVTPS2PDrr : I<0x5A, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1600 | "cvtps2pd\t{$src, $dst|$dst, $src}", []>, TB; |
| 1601 | def CVTPS2PDrm : I<0x5A, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src), |
| 1602 | "cvtps2pd\t{$src, $dst|$dst, $src}", []>, TB; |
| 1603 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1604 | def Int_CVTPS2PDrr : I<0x5A, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1605 | "cvtps2pd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1606 | [(set VR128:$dst, (int_x86_sse2_cvtps2pd VR128:$src))]>, |
| 1607 | TB, Requires<[HasSSE2]>; |
Mon P Wang | aa3f266 | 2008-05-28 00:42:27 +0000 | [diff] [blame] | 1608 | def Int_CVTPS2PDrm : I<0x5A, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1609 | "cvtps2pd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1610 | [(set VR128:$dst, (int_x86_sse2_cvtps2pd |
| 1611 | (load addr:$src)))]>, |
| 1612 | TB, Requires<[HasSSE2]>; |
| 1613 | |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1614 | def CVTPD2PSrr : PDI<0x5A, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1615 | "cvtpd2ps\t{$src, $dst|$dst, $src}", []>; |
| 1616 | def CVTPD2PSrm : PDI<0x5A, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
| 1617 | "cvtpd2ps\t{$src, $dst|$dst, $src}", []>; |
| 1618 | |
| 1619 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1620 | def Int_CVTPD2PSrr : PDI<0x5A, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1621 | "cvtpd2ps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1622 | [(set VR128:$dst, (int_x86_sse2_cvtpd2ps VR128:$src))]>; |
Mon P Wang | aa3f266 | 2008-05-28 00:42:27 +0000 | [diff] [blame] | 1623 | def Int_CVTPD2PSrm : PDI<0x5A, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1624 | "cvtpd2ps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1625 | [(set VR128:$dst, (int_x86_sse2_cvtpd2ps |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1626 | (memop addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1627 | |
| 1628 | // Match intrinsics which expect XMM operand(s). |
| 1629 | // Aliases for intrinsics |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1630 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1631 | def Int_CVTSI2SDrr: SDI<0x2A, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1632 | (outs VR128:$dst), (ins VR128:$src1, GR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1633 | "cvtsi2sd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1634 | [(set VR128:$dst, (int_x86_sse2_cvtsi2sd VR128:$src1, |
| 1635 | GR32:$src2))]>; |
| 1636 | def Int_CVTSI2SDrm: SDI<0x2A, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1637 | (outs VR128:$dst), (ins VR128:$src1, i32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1638 | "cvtsi2sd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1639 | [(set VR128:$dst, (int_x86_sse2_cvtsi2sd VR128:$src1, |
| 1640 | (loadi32 addr:$src2)))]>; |
| 1641 | def Int_CVTSD2SSrr: SDI<0x5A, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1642 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1643 | "cvtsd2ss\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1644 | [(set VR128:$dst, (int_x86_sse2_cvtsd2ss VR128:$src1, |
| 1645 | VR128:$src2))]>; |
| 1646 | def Int_CVTSD2SSrm: SDI<0x5A, MRMSrcMem, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1647 | (outs VR128:$dst), (ins VR128:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1648 | "cvtsd2ss\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1649 | [(set VR128:$dst, (int_x86_sse2_cvtsd2ss VR128:$src1, |
| 1650 | (load addr:$src2)))]>; |
| 1651 | def Int_CVTSS2SDrr: I<0x5A, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1652 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1653 | "cvtss2sd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1654 | [(set VR128:$dst, (int_x86_sse2_cvtss2sd VR128:$src1, |
| 1655 | VR128:$src2))]>, XS, |
| 1656 | Requires<[HasSSE2]>; |
| 1657 | def Int_CVTSS2SDrm: I<0x5A, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1658 | (outs VR128:$dst), (ins VR128:$src1, f32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1659 | "cvtss2sd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1660 | [(set VR128:$dst, (int_x86_sse2_cvtss2sd VR128:$src1, |
| 1661 | (load addr:$src2)))]>, XS, |
| 1662 | Requires<[HasSSE2]>; |
| 1663 | } |
| 1664 | |
| 1665 | // Arithmetic |
| 1666 | |
| 1667 | /// sse2_fp_unop_rm - SSE2 unops come in both scalar and vector forms. |
| 1668 | /// |
| 1669 | /// In addition, we also have a special variant of the scalar form here to |
| 1670 | /// represent the associated intrinsic operation. This form is unlike the |
| 1671 | /// plain scalar form, in that it takes an entire vector (instead of a |
| 1672 | /// scalar) and leaves the top elements undefined. |
| 1673 | /// |
| 1674 | /// And, we have a special variant form for a full-vector intrinsic form. |
| 1675 | /// |
| 1676 | /// These four forms can each have a reg or a mem operand, so there are a |
| 1677 | /// total of eight "instructions". |
| 1678 | /// |
| 1679 | multiclass sse2_fp_unop_rm<bits<8> opc, string OpcodeStr, |
| 1680 | SDNode OpNode, |
| 1681 | Intrinsic F64Int, |
| 1682 | Intrinsic V2F64Int, |
| 1683 | bit Commutable = 0> { |
| 1684 | // Scalar operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1685 | def SDr : SDI<opc, MRMSrcReg, (outs FR64:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1686 | !strconcat(OpcodeStr, "sd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1687 | [(set FR64:$dst, (OpNode FR64:$src))]> { |
| 1688 | let isCommutable = Commutable; |
| 1689 | } |
| 1690 | |
| 1691 | // Scalar operation, mem. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1692 | def SDm : SDI<opc, MRMSrcMem, (outs FR64:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1693 | !strconcat(OpcodeStr, "sd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1694 | [(set FR64:$dst, (OpNode (load addr:$src)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1695 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1696 | // Vector operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1697 | def PDr : PDI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1698 | !strconcat(OpcodeStr, "pd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1699 | [(set VR128:$dst, (v2f64 (OpNode VR128:$src)))]> { |
| 1700 | let isCommutable = Commutable; |
| 1701 | } |
| 1702 | |
| 1703 | // Vector operation, mem. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1704 | def PDm : PDI<opc, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1705 | !strconcat(OpcodeStr, "pd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1706 | [(set VR128:$dst, (OpNode (memopv2f64 addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1707 | |
| 1708 | // Intrinsic operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1709 | def SDr_Int : SDI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1710 | !strconcat(OpcodeStr, "sd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1711 | [(set VR128:$dst, (F64Int VR128:$src))]> { |
| 1712 | let isCommutable = Commutable; |
| 1713 | } |
| 1714 | |
| 1715 | // Intrinsic operation, mem. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1716 | def SDm_Int : SDI<opc, MRMSrcMem, (outs VR128:$dst), (ins sdmem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1717 | !strconcat(OpcodeStr, "sd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1718 | [(set VR128:$dst, (F64Int sse_load_f64:$src))]>; |
| 1719 | |
| 1720 | // Vector intrinsic operation, reg |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1721 | def PDr_Int : PDI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1722 | !strconcat(OpcodeStr, "pd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1723 | [(set VR128:$dst, (V2F64Int VR128:$src))]> { |
| 1724 | let isCommutable = Commutable; |
| 1725 | } |
| 1726 | |
| 1727 | // Vector intrinsic operation, mem |
Dan Gohman | c747be5 | 2007-08-02 21:06:40 +0000 | [diff] [blame] | 1728 | def PDm_Int : PDI<opc, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1729 | !strconcat(OpcodeStr, "pd\t{$src, $dst|$dst, $src}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1730 | [(set VR128:$dst, (V2F64Int (memopv2f64 addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1731 | } |
| 1732 | |
| 1733 | // Square root. |
| 1734 | defm SQRT : sse2_fp_unop_rm<0x51, "sqrt", fsqrt, |
| 1735 | int_x86_sse2_sqrt_sd, int_x86_sse2_sqrt_pd>; |
| 1736 | |
| 1737 | // There is no f64 version of the reciprocal approximation instructions. |
| 1738 | |
| 1739 | // Logical |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1740 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1741 | let isCommutable = 1 in { |
| 1742 | def ANDPDrr : PDI<0x54, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1743 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1744 | "andpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1745 | [(set VR128:$dst, |
| 1746 | (and (bc_v2i64 (v2f64 VR128:$src1)), |
| 1747 | (bc_v2i64 (v2f64 VR128:$src2))))]>; |
| 1748 | def ORPDrr : PDI<0x56, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1749 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1750 | "orpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1751 | [(set VR128:$dst, |
| 1752 | (or (bc_v2i64 (v2f64 VR128:$src1)), |
| 1753 | (bc_v2i64 (v2f64 VR128:$src2))))]>; |
| 1754 | def XORPDrr : PDI<0x57, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1755 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1756 | "xorpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1757 | [(set VR128:$dst, |
| 1758 | (xor (bc_v2i64 (v2f64 VR128:$src1)), |
| 1759 | (bc_v2i64 (v2f64 VR128:$src2))))]>; |
| 1760 | } |
| 1761 | |
| 1762 | def ANDPDrm : PDI<0x54, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1763 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1764 | "andpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1765 | [(set VR128:$dst, |
| 1766 | (and (bc_v2i64 (v2f64 VR128:$src1)), |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 1767 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1768 | def ORPDrm : PDI<0x56, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1769 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1770 | "orpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1771 | [(set VR128:$dst, |
| 1772 | (or (bc_v2i64 (v2f64 VR128:$src1)), |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 1773 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1774 | def XORPDrm : PDI<0x57, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1775 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1776 | "xorpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1777 | [(set VR128:$dst, |
| 1778 | (xor (bc_v2i64 (v2f64 VR128:$src1)), |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 1779 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1780 | def ANDNPDrr : PDI<0x55, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1781 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1782 | "andnpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1783 | [(set VR128:$dst, |
| 1784 | (and (vnot (bc_v2i64 (v2f64 VR128:$src1))), |
| 1785 | (bc_v2i64 (v2f64 VR128:$src2))))]>; |
| 1786 | def ANDNPDrm : PDI<0x55, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1787 | (outs VR128:$dst), (ins VR128:$src1,f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1788 | "andnpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1789 | [(set VR128:$dst, |
| 1790 | (and (vnot (bc_v2i64 (v2f64 VR128:$src1))), |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 1791 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1792 | } |
| 1793 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1794 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1795 | def CMPPDrri : PDIi8<0xC2, MRMSrcReg, |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1796 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src, SSECC:$cc), |
| 1797 | "cmp${cc}pd\t{$src, $dst|$dst, $src}", |
| 1798 | [(set VR128:$dst, (int_x86_sse2_cmp_pd VR128:$src1, |
Nate Begeman | 061db5f | 2008-05-12 20:34:32 +0000 | [diff] [blame] | 1799 | VR128:$src, imm:$cc))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1800 | def CMPPDrmi : PDIi8<0xC2, MRMSrcMem, |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1801 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src, SSECC:$cc), |
| 1802 | "cmp${cc}pd\t{$src, $dst|$dst, $src}", |
| 1803 | [(set VR128:$dst, (int_x86_sse2_cmp_pd VR128:$src1, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1804 | (memop addr:$src), imm:$cc))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1805 | } |
Evan Cheng | 3375409 | 2008-08-05 22:19:15 +0000 | [diff] [blame] | 1806 | def : Pat<(v2i64 (X86cmppd (v2f64 VR128:$src1), VR128:$src2, imm:$cc)), |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 1807 | (CMPPDrri VR128:$src1, VR128:$src2, imm:$cc)>; |
Evan Cheng | 3375409 | 2008-08-05 22:19:15 +0000 | [diff] [blame] | 1808 | def : Pat<(v2i64 (X86cmppd (v2f64 VR128:$src1), (memop addr:$src2), imm:$cc)), |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 1809 | (CMPPDrmi VR128:$src1, addr:$src2, imm:$cc)>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1810 | |
| 1811 | // Shuffle and unpack instructions |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1812 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1813 | def SHUFPDrri : PDIi8<0xC6, MRMSrcReg, |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1814 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2, i8imm:$src3), |
| 1815 | "shufpd\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1816 | [(set VR128:$dst, |
| 1817 | (v2f64 (shufp:$src3 VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1818 | def SHUFPDrmi : PDIi8<0xC6, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1819 | (outs VR128:$dst), (ins VR128:$src1, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1820 | f128mem:$src2, i8imm:$src3), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1821 | "shufpd\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1822 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1823 | (v2f64 (shufp:$src3 |
| 1824 | VR128:$src1, (memopv2f64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1825 | |
| 1826 | let AddedComplexity = 10 in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1827 | def UNPCKHPDrr : PDI<0x15, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1828 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1829 | "unpckhpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1830 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1831 | (v2f64 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1832 | def UNPCKHPDrm : PDI<0x15, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1833 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1834 | "unpckhpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1835 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1836 | (v2f64 (unpckh VR128:$src1, |
| 1837 | (memopv2f64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1838 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1839 | def UNPCKLPDrr : PDI<0x14, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1840 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1841 | "unpcklpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1842 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1843 | (v2f64 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1844 | def UNPCKLPDrm : PDI<0x14, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1845 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1846 | "unpcklpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1847 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1848 | (unpckl VR128:$src1, (memopv2f64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1849 | } // AddedComplexity |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1850 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1851 | |
| 1852 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1853 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1854 | // SSE integer instructions |
| 1855 | |
| 1856 | // Move Instructions |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1857 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1858 | def MOVDQArr : PDI<0x6F, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1859 | "movdqa\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1860 | let canFoldAsLoad = 1, mayLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1861 | def MOVDQArm : PDI<0x6F, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1862 | "movdqa\t{$src, $dst|$dst, $src}", |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 1863 | [/*(set VR128:$dst, (alignedloadv2i64 addr:$src))*/]>; |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1864 | let mayStore = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1865 | def MOVDQAmr : PDI<0x7F, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1866 | "movdqa\t{$src, $dst|$dst, $src}", |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 1867 | [/*(alignedstore (v2i64 VR128:$src), addr:$dst)*/]>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1868 | let canFoldAsLoad = 1, mayLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1869 | def MOVDQUrm : I<0x6F, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1870 | "movdqu\t{$src, $dst|$dst, $src}", |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 1871 | [/*(set VR128:$dst, (loadv2i64 addr:$src))*/]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1872 | XS, Requires<[HasSSE2]>; |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1873 | let mayStore = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1874 | def MOVDQUmr : I<0x7F, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1875 | "movdqu\t{$src, $dst|$dst, $src}", |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 1876 | [/*(store (v2i64 VR128:$src), addr:$dst)*/]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1877 | XS, Requires<[HasSSE2]>; |
| 1878 | |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1879 | // Intrinsic forms of MOVDQU load and store |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1880 | let canFoldAsLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1881 | def MOVDQUrm_Int : I<0x6F, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1882 | "movdqu\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1883 | [(set VR128:$dst, (int_x86_sse2_loadu_dq addr:$src))]>, |
| 1884 | XS, Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1885 | def MOVDQUmr_Int : I<0x7F, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1886 | "movdqu\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1887 | [(int_x86_sse2_storeu_dq addr:$dst, VR128:$src)]>, |
| 1888 | XS, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1889 | |
Evan Cheng | 8800475 | 2008-03-05 08:11:27 +0000 | [diff] [blame] | 1890 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1891 | |
| 1892 | multiclass PDI_binop_rm_int<bits<8> opc, string OpcodeStr, Intrinsic IntId, |
| 1893 | bit Commutable = 0> { |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1894 | def rr : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1895 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1896 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1897 | [(set VR128:$dst, (IntId VR128:$src1, VR128:$src2))]> { |
| 1898 | let isCommutable = Commutable; |
| 1899 | } |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1900 | def rm : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1901 | (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1902 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1903 | [(set VR128:$dst, (IntId VR128:$src1, |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1904 | (bitconvert (memopv2i64 |
| 1905 | addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1906 | } |
| 1907 | |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 1908 | multiclass PDI_binop_rmi_int<bits<8> opc, bits<8> opc2, Format ImmForm, |
| 1909 | string OpcodeStr, |
| 1910 | Intrinsic IntId, Intrinsic IntId2> { |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1911 | def rr : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1912 | (ins VR128:$src1, VR128:$src2), |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 1913 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 1914 | [(set VR128:$dst, (IntId VR128:$src1, VR128:$src2))]>; |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1915 | def rm : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1916 | (ins VR128:$src1, i128mem:$src2), |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 1917 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 1918 | [(set VR128:$dst, (IntId VR128:$src1, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1919 | (bitconvert (memopv2i64 addr:$src2))))]>; |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1920 | def ri : PDIi8<opc2, ImmForm, (outs VR128:$dst), |
| 1921 | (ins VR128:$src1, i32i8imm:$src2), |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 1922 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 1923 | [(set VR128:$dst, (IntId2 VR128:$src1, (i32 imm:$src2)))]>; |
| 1924 | } |
| 1925 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1926 | /// PDI_binop_rm - Simple SSE2 binary operator. |
| 1927 | multiclass PDI_binop_rm<bits<8> opc, string OpcodeStr, SDNode OpNode, |
| 1928 | ValueType OpVT, bit Commutable = 0> { |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1929 | def rr : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1930 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1931 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1932 | [(set VR128:$dst, (OpVT (OpNode VR128:$src1, VR128:$src2)))]> { |
| 1933 | let isCommutable = Commutable; |
| 1934 | } |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1935 | def rm : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1936 | (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1937 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1938 | [(set VR128:$dst, (OpVT (OpNode VR128:$src1, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1939 | (bitconvert (memopv2i64 addr:$src2)))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1940 | } |
| 1941 | |
| 1942 | /// PDI_binop_rm_v2i64 - Simple SSE2 binary operator whose type is v2i64. |
| 1943 | /// |
| 1944 | /// FIXME: we could eliminate this and use PDI_binop_rm instead if tblgen knew |
| 1945 | /// to collapse (bitconvert VT to VT) into its operand. |
| 1946 | /// |
| 1947 | multiclass PDI_binop_rm_v2i64<bits<8> opc, string OpcodeStr, SDNode OpNode, |
| 1948 | bit Commutable = 0> { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1949 | def rr : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1950 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1951 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1952 | [(set VR128:$dst, (v2i64 (OpNode VR128:$src1, VR128:$src2)))]> { |
| 1953 | let isCommutable = Commutable; |
| 1954 | } |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1955 | def rm : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1956 | (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1957 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1958 | [(set VR128:$dst, (OpNode VR128:$src1, |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1959 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1960 | } |
| 1961 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1962 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1963 | |
| 1964 | // 128-bit Integer Arithmetic |
| 1965 | |
| 1966 | defm PADDB : PDI_binop_rm<0xFC, "paddb", add, v16i8, 1>; |
| 1967 | defm PADDW : PDI_binop_rm<0xFD, "paddw", add, v8i16, 1>; |
| 1968 | defm PADDD : PDI_binop_rm<0xFE, "paddd", add, v4i32, 1>; |
| 1969 | defm PADDQ : PDI_binop_rm_v2i64<0xD4, "paddq", add, 1>; |
| 1970 | |
| 1971 | defm PADDSB : PDI_binop_rm_int<0xEC, "paddsb" , int_x86_sse2_padds_b, 1>; |
| 1972 | defm PADDSW : PDI_binop_rm_int<0xED, "paddsw" , int_x86_sse2_padds_w, 1>; |
| 1973 | defm PADDUSB : PDI_binop_rm_int<0xDC, "paddusb", int_x86_sse2_paddus_b, 1>; |
| 1974 | defm PADDUSW : PDI_binop_rm_int<0xDD, "paddusw", int_x86_sse2_paddus_w, 1>; |
| 1975 | |
| 1976 | defm PSUBB : PDI_binop_rm<0xF8, "psubb", sub, v16i8>; |
| 1977 | defm PSUBW : PDI_binop_rm<0xF9, "psubw", sub, v8i16>; |
| 1978 | defm PSUBD : PDI_binop_rm<0xFA, "psubd", sub, v4i32>; |
| 1979 | defm PSUBQ : PDI_binop_rm_v2i64<0xFB, "psubq", sub>; |
| 1980 | |
| 1981 | defm PSUBSB : PDI_binop_rm_int<0xE8, "psubsb" , int_x86_sse2_psubs_b>; |
| 1982 | defm PSUBSW : PDI_binop_rm_int<0xE9, "psubsw" , int_x86_sse2_psubs_w>; |
| 1983 | defm PSUBUSB : PDI_binop_rm_int<0xD8, "psubusb", int_x86_sse2_psubus_b>; |
| 1984 | defm PSUBUSW : PDI_binop_rm_int<0xD9, "psubusw", int_x86_sse2_psubus_w>; |
| 1985 | |
| 1986 | defm PMULLW : PDI_binop_rm<0xD5, "pmullw", mul, v8i16, 1>; |
| 1987 | |
| 1988 | defm PMULHUW : PDI_binop_rm_int<0xE4, "pmulhuw", int_x86_sse2_pmulhu_w, 1>; |
| 1989 | defm PMULHW : PDI_binop_rm_int<0xE5, "pmulhw" , int_x86_sse2_pmulh_w , 1>; |
| 1990 | defm PMULUDQ : PDI_binop_rm_int<0xF4, "pmuludq", int_x86_sse2_pmulu_dq, 1>; |
| 1991 | |
| 1992 | defm PMADDWD : PDI_binop_rm_int<0xF5, "pmaddwd", int_x86_sse2_pmadd_wd, 1>; |
| 1993 | |
| 1994 | defm PAVGB : PDI_binop_rm_int<0xE0, "pavgb", int_x86_sse2_pavg_b, 1>; |
| 1995 | defm PAVGW : PDI_binop_rm_int<0xE3, "pavgw", int_x86_sse2_pavg_w, 1>; |
| 1996 | |
| 1997 | |
| 1998 | defm PMINUB : PDI_binop_rm_int<0xDA, "pminub", int_x86_sse2_pminu_b, 1>; |
| 1999 | defm PMINSW : PDI_binop_rm_int<0xEA, "pminsw", int_x86_sse2_pmins_w, 1>; |
| 2000 | defm PMAXUB : PDI_binop_rm_int<0xDE, "pmaxub", int_x86_sse2_pmaxu_b, 1>; |
| 2001 | 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] | 2002 | 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] | 2003 | |
| 2004 | |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 2005 | defm PSLLW : PDI_binop_rmi_int<0xF1, 0x71, MRM6r, "psllw", |
| 2006 | int_x86_sse2_psll_w, int_x86_sse2_pslli_w>; |
| 2007 | defm PSLLD : PDI_binop_rmi_int<0xF2, 0x72, MRM6r, "pslld", |
| 2008 | int_x86_sse2_psll_d, int_x86_sse2_pslli_d>; |
| 2009 | defm PSLLQ : PDI_binop_rmi_int<0xF3, 0x73, MRM6r, "psllq", |
| 2010 | int_x86_sse2_psll_q, int_x86_sse2_pslli_q>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2011 | |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 2012 | defm PSRLW : PDI_binop_rmi_int<0xD1, 0x71, MRM2r, "psrlw", |
| 2013 | int_x86_sse2_psrl_w, int_x86_sse2_psrli_w>; |
| 2014 | defm PSRLD : PDI_binop_rmi_int<0xD2, 0x72, MRM2r, "psrld", |
| 2015 | int_x86_sse2_psrl_d, int_x86_sse2_psrli_d>; |
Nate Begeman | c2ca5f6 | 2008-05-13 17:52:09 +0000 | [diff] [blame] | 2016 | defm PSRLQ : PDI_binop_rmi_int<0xD3, 0x73, MRM2r, "psrlq", |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 2017 | int_x86_sse2_psrl_q, int_x86_sse2_psrli_q>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2018 | |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 2019 | defm PSRAW : PDI_binop_rmi_int<0xE1, 0x71, MRM4r, "psraw", |
| 2020 | int_x86_sse2_psra_w, int_x86_sse2_psrai_w>; |
Nate Begeman | d66fc34 | 2008-05-13 01:47:52 +0000 | [diff] [blame] | 2021 | defm PSRAD : PDI_binop_rmi_int<0xE2, 0x72, MRM4r, "psrad", |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 2022 | int_x86_sse2_psra_d, int_x86_sse2_psrai_d>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2023 | |
| 2024 | // 128-bit logical shifts. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2025 | let Constraints = "$src1 = $dst", neverHasSideEffects = 1 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2026 | def PSLLDQri : PDIi8<0x73, MRM7r, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2027 | (outs VR128:$dst), (ins VR128:$src1, i32i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2028 | "pslldq\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2029 | def PSRLDQri : PDIi8<0x73, MRM3r, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2030 | (outs VR128:$dst), (ins VR128:$src1, i32i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2031 | "psrldq\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2032 | // PSRADQri doesn't exist in SSE[1-3]. |
| 2033 | } |
| 2034 | |
| 2035 | let Predicates = [HasSSE2] in { |
| 2036 | def : Pat<(int_x86_sse2_psll_dq VR128:$src1, imm:$src2), |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2037 | (v2i64 (PSLLDQri VR128:$src1, (BYTE_imm imm:$src2)))>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2038 | def : Pat<(int_x86_sse2_psrl_dq VR128:$src1, imm:$src2), |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2039 | (v2i64 (PSRLDQri VR128:$src1, (BYTE_imm imm:$src2)))>; |
Bill Wendling | 314ee05 | 2008-10-02 05:56:52 +0000 | [diff] [blame] | 2040 | def : Pat<(int_x86_sse2_psll_dq_bs VR128:$src1, imm:$src2), |
| 2041 | (v2i64 (PSLLDQri VR128:$src1, imm:$src2))>; |
| 2042 | def : Pat<(int_x86_sse2_psrl_dq_bs VR128:$src1, imm:$src2), |
| 2043 | (v2i64 (PSRLDQri VR128:$src1, imm:$src2))>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2044 | def : Pat<(v2f64 (X86fsrl VR128:$src1, i32immSExt8:$src2)), |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2045 | (v2f64 (PSRLDQri VR128:$src1, (BYTE_imm imm:$src2)))>; |
Evan Cheng | dea9936 | 2008-05-29 08:22:04 +0000 | [diff] [blame] | 2046 | |
| 2047 | // Shift up / down and insert zero's. |
| 2048 | def : Pat<(v2i64 (X86vshl VR128:$src, (i8 imm:$amt))), |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2049 | (v2i64 (PSLLDQri VR128:$src, (BYTE_imm imm:$amt)))>; |
Evan Cheng | dea9936 | 2008-05-29 08:22:04 +0000 | [diff] [blame] | 2050 | def : Pat<(v2i64 (X86vshr VR128:$src, (i8 imm:$amt))), |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2051 | (v2i64 (PSRLDQri VR128:$src, (BYTE_imm imm:$amt)))>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2052 | } |
| 2053 | |
| 2054 | // Logical |
| 2055 | defm PAND : PDI_binop_rm_v2i64<0xDB, "pand", and, 1>; |
| 2056 | defm POR : PDI_binop_rm_v2i64<0xEB, "por" , or , 1>; |
| 2057 | defm PXOR : PDI_binop_rm_v2i64<0xEF, "pxor", xor, 1>; |
| 2058 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2059 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2060 | def PANDNrr : PDI<0xDF, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2061 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2062 | "pandn\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2063 | [(set VR128:$dst, (v2i64 (and (vnot VR128:$src1), |
| 2064 | VR128:$src2)))]>; |
| 2065 | |
| 2066 | def PANDNrm : PDI<0xDF, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2067 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2068 | "pandn\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2069 | [(set VR128:$dst, (v2i64 (and (vnot VR128:$src1), |
Dan Gohman | 7dc1901 | 2007-08-02 21:17:01 +0000 | [diff] [blame] | 2070 | (memopv2i64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2071 | } |
| 2072 | |
| 2073 | // SSE2 Integer comparison |
| 2074 | defm PCMPEQB : PDI_binop_rm_int<0x74, "pcmpeqb", int_x86_sse2_pcmpeq_b>; |
| 2075 | defm PCMPEQW : PDI_binop_rm_int<0x75, "pcmpeqw", int_x86_sse2_pcmpeq_w>; |
| 2076 | defm PCMPEQD : PDI_binop_rm_int<0x76, "pcmpeqd", int_x86_sse2_pcmpeq_d>; |
| 2077 | defm PCMPGTB : PDI_binop_rm_int<0x64, "pcmpgtb", int_x86_sse2_pcmpgt_b>; |
| 2078 | defm PCMPGTW : PDI_binop_rm_int<0x65, "pcmpgtw", int_x86_sse2_pcmpgt_w>; |
| 2079 | defm PCMPGTD : PDI_binop_rm_int<0x66, "pcmpgtd", int_x86_sse2_pcmpgt_d>; |
| 2080 | |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2081 | def : Pat<(v16i8 (X86pcmpeqb VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2082 | (PCMPEQBrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2083 | def : Pat<(v16i8 (X86pcmpeqb VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2084 | (PCMPEQBrm VR128:$src1, addr:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2085 | def : Pat<(v8i16 (X86pcmpeqw VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2086 | (PCMPEQWrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2087 | def : Pat<(v8i16 (X86pcmpeqw VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2088 | (PCMPEQWrm VR128:$src1, addr:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2089 | def : Pat<(v4i32 (X86pcmpeqd VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2090 | (PCMPEQDrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2091 | def : Pat<(v4i32 (X86pcmpeqd VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2092 | (PCMPEQDrm VR128:$src1, addr:$src2)>; |
| 2093 | |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2094 | def : Pat<(v16i8 (X86pcmpgtb VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2095 | (PCMPGTBrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2096 | def : Pat<(v16i8 (X86pcmpgtb VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2097 | (PCMPGTBrm VR128:$src1, addr:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2098 | def : Pat<(v8i16 (X86pcmpgtw VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2099 | (PCMPGTWrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2100 | def : Pat<(v8i16 (X86pcmpgtw VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2101 | (PCMPGTWrm VR128:$src1, addr:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2102 | def : Pat<(v4i32 (X86pcmpgtd VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2103 | (PCMPGTDrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2104 | def : Pat<(v4i32 (X86pcmpgtd VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2105 | (PCMPGTDrm VR128:$src1, addr:$src2)>; |
| 2106 | |
| 2107 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2108 | // Pack instructions |
| 2109 | defm PACKSSWB : PDI_binop_rm_int<0x63, "packsswb", int_x86_sse2_packsswb_128>; |
| 2110 | defm PACKSSDW : PDI_binop_rm_int<0x6B, "packssdw", int_x86_sse2_packssdw_128>; |
| 2111 | defm PACKUSWB : PDI_binop_rm_int<0x67, "packuswb", int_x86_sse2_packuswb_128>; |
| 2112 | |
| 2113 | // Shuffle and unpack instructions |
Nate Begeman | 080f8e2 | 2009-10-19 02:17:23 +0000 | [diff] [blame] | 2114 | let AddedComplexity = 5 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2115 | def PSHUFDri : PDIi8<0x70, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2116 | (outs VR128:$dst), (ins VR128:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2117 | "pshufd\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2118 | [(set VR128:$dst, (v4i32 (pshufd:$src2 |
| 2119 | VR128:$src1, (undef))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2120 | def PSHUFDmi : PDIi8<0x70, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2121 | (outs VR128:$dst), (ins i128mem:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2122 | "pshufd\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2123 | [(set VR128:$dst, (v4i32 (pshufd:$src2 |
Evan Cheng | e31a26a | 2009-12-09 21:00:30 +0000 | [diff] [blame] | 2124 | (bc_v4i32 (memopv2i64 addr:$src1)), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2125 | (undef))))]>; |
Eric Christopher | f365029 | 2009-11-07 08:45:53 +0000 | [diff] [blame] | 2126 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2127 | |
| 2128 | // SSE2 with ImmT == Imm8 and XS prefix. |
| 2129 | def PSHUFHWri : Ii8<0x70, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2130 | (outs VR128:$dst), (ins VR128:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2131 | "pshufhw\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2132 | [(set VR128:$dst, (v8i16 (pshufhw:$src2 VR128:$src1, |
| 2133 | (undef))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2134 | XS, Requires<[HasSSE2]>; |
| 2135 | def PSHUFHWmi : Ii8<0x70, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2136 | (outs VR128:$dst), (ins i128mem:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2137 | "pshufhw\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2138 | [(set VR128:$dst, (v8i16 (pshufhw:$src2 |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2139 | (bc_v8i16 (memopv2i64 addr:$src1)), |
| 2140 | (undef))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2141 | XS, Requires<[HasSSE2]>; |
| 2142 | |
| 2143 | // SSE2 with ImmT == Imm8 and XD prefix. |
| 2144 | def PSHUFLWri : Ii8<0x70, MRMSrcReg, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2145 | (outs VR128:$dst), (ins VR128:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2146 | "pshuflw\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2147 | [(set VR128:$dst, (v8i16 (pshuflw:$src2 VR128:$src1, |
| 2148 | (undef))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2149 | XD, Requires<[HasSSE2]>; |
| 2150 | def PSHUFLWmi : Ii8<0x70, MRMSrcMem, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2151 | (outs VR128:$dst), (ins i128mem:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2152 | "pshuflw\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2153 | [(set VR128:$dst, (v8i16 (pshuflw:$src2 |
| 2154 | (bc_v8i16 (memopv2i64 addr:$src1)), |
| 2155 | (undef))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2156 | XD, Requires<[HasSSE2]>; |
| 2157 | |
| 2158 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2159 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2160 | def PUNPCKLBWrr : PDI<0x60, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2161 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2162 | "punpcklbw\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 | (v16i8 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2165 | def PUNPCKLBWrm : PDI<0x60, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2166 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2167 | "punpcklbw\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2168 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2169 | (unpckl VR128:$src1, |
| 2170 | (bc_v16i8 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2171 | def PUNPCKLWDrr : PDI<0x61, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2172 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2173 | "punpcklwd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2174 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2175 | (v8i16 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2176 | def PUNPCKLWDrm : PDI<0x61, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2177 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2178 | "punpcklwd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2179 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2180 | (unpckl VR128:$src1, |
| 2181 | (bc_v8i16 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2182 | def PUNPCKLDQrr : PDI<0x62, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2183 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2184 | "punpckldq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2185 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2186 | (v4i32 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2187 | def PUNPCKLDQrm : PDI<0x62, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2188 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2189 | "punpckldq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2190 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2191 | (unpckl VR128:$src1, |
| 2192 | (bc_v4i32 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2193 | def PUNPCKLQDQrr : PDI<0x6C, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2194 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2195 | "punpcklqdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2196 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2197 | (v2i64 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2198 | def PUNPCKLQDQrm : PDI<0x6C, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2199 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2200 | "punpcklqdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2201 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2202 | (v2i64 (unpckl VR128:$src1, |
| 2203 | (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2204 | |
| 2205 | def PUNPCKHBWrr : PDI<0x68, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2206 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2207 | "punpckhbw\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 | (v16i8 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2210 | def PUNPCKHBWrm : PDI<0x68, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2211 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2212 | "punpckhbw\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2213 | [(set VR128:$dst, |
| 2214 | (unpckh VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2215 | (bc_v16i8 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2216 | def PUNPCKHWDrr : PDI<0x69, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2217 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2218 | "punpckhwd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2219 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2220 | (v8i16 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2221 | def PUNPCKHWDrm : PDI<0x69, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2222 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2223 | "punpckhwd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2224 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2225 | (unpckh VR128:$src1, |
| 2226 | (bc_v8i16 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2227 | def PUNPCKHDQrr : PDI<0x6A, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2228 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2229 | "punpckhdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2230 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2231 | (v4i32 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2232 | def PUNPCKHDQrm : PDI<0x6A, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2233 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2234 | "punpckhdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2235 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2236 | (unpckh VR128:$src1, |
| 2237 | (bc_v4i32 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2238 | def PUNPCKHQDQrr : PDI<0x6D, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2239 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2240 | "punpckhqdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2241 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2242 | (v2i64 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2243 | def PUNPCKHQDQrm : PDI<0x6D, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2244 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2245 | "punpckhqdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2246 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2247 | (v2i64 (unpckh VR128:$src1, |
| 2248 | (memopv2i64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2249 | } |
| 2250 | |
| 2251 | // Extract / Insert |
| 2252 | def PEXTRWri : PDIi8<0xC5, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2253 | (outs GR32:$dst), (ins VR128:$src1, i32i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2254 | "pextrw\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2255 | [(set GR32:$dst, (X86pextrw (v8i16 VR128:$src1), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 2256 | imm:$src2))]>; |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2257 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2258 | def PINSRWrri : PDIi8<0xC4, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2259 | (outs VR128:$dst), (ins VR128:$src1, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2260 | GR32:$src2, i32i8imm:$src3), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2261 | "pinsrw\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2262 | [(set VR128:$dst, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 2263 | (X86pinsrw VR128:$src1, GR32:$src2, imm:$src3))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2264 | def PINSRWrmi : PDIi8<0xC4, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2265 | (outs VR128:$dst), (ins VR128:$src1, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2266 | i16mem:$src2, i32i8imm:$src3), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2267 | "pinsrw\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2268 | [(set VR128:$dst, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 2269 | (X86pinsrw VR128:$src1, (extloadi16 addr:$src2), |
| 2270 | imm:$src3))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2271 | } |
| 2272 | |
| 2273 | // Mask creation |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2274 | def PMOVMSKBrr : PDI<0xD7, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2275 | "pmovmskb\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2276 | [(set GR32:$dst, (int_x86_sse2_pmovmskb_128 VR128:$src))]>; |
| 2277 | |
| 2278 | // Conditional store |
Evan Cheng | 6e4d1d9 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2279 | let Uses = [EDI] in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2280 | def MASKMOVDQU : PDI<0xF7, MRMSrcReg, (outs), (ins VR128:$src, VR128:$mask), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2281 | "maskmovdqu\t{$mask, $src|$src, $mask}", |
Evan Cheng | 6e4d1d9 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2282 | [(int_x86_sse2_maskmov_dqu VR128:$src, VR128:$mask, EDI)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2283 | |
Evan Cheng | 430de08 | 2009-02-10 22:06:28 +0000 | [diff] [blame] | 2284 | let Uses = [RDI] in |
| 2285 | def MASKMOVDQU64 : PDI<0xF7, MRMSrcReg, (outs), (ins VR128:$src, VR128:$mask), |
| 2286 | "maskmovdqu\t{$mask, $src|$src, $mask}", |
| 2287 | [(int_x86_sse2_maskmov_dqu VR128:$src, VR128:$mask, RDI)]>; |
| 2288 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2289 | // Non-temporal stores |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2290 | def MOVNTPDmr : PDI<0x2B, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2291 | "movntpd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2292 | [(int_x86_sse2_movnt_pd addr:$dst, VR128:$src)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2293 | def MOVNTDQmr : PDI<0xE7, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2294 | "movntdq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2295 | [(int_x86_sse2_movnt_dq addr:$dst, VR128:$src)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2296 | def MOVNTImr : I<0xC3, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2297 | "movnti\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2298 | [(int_x86_sse2_movnt_i addr:$dst, GR32:$src)]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2299 | TB, Requires<[HasSSE2]>; |
| 2300 | |
| 2301 | // Flush cache |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2302 | def CLFLUSH : I<0xAE, MRM7m, (outs), (ins i8mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2303 | "clflush\t$src", [(int_x86_sse2_clflush addr:$src)]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2304 | TB, Requires<[HasSSE2]>; |
| 2305 | |
| 2306 | // Load, store, and memory fence |
Evan Cheng | 5d0d34e | 2008-10-17 17:14:20 +0000 | [diff] [blame] | 2307 | def LFENCE : I<0xAE, MRM5r, (outs), (ins), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2308 | "lfence", [(int_x86_sse2_lfence)]>, TB, Requires<[HasSSE2]>; |
Evan Cheng | 5d0d34e | 2008-10-17 17:14:20 +0000 | [diff] [blame] | 2309 | def MFENCE : I<0xAE, MRM6r, (outs), (ins), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2310 | "mfence", [(int_x86_sse2_mfence)]>, TB, Requires<[HasSSE2]>; |
| 2311 | |
Andrew Lenharth | 785610d | 2008-02-16 01:24:58 +0000 | [diff] [blame] | 2312 | //TODO: custom lower this so as to never even generate the noop |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2313 | 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] | 2314 | (i8 0)), (NOOP)>; |
| 2315 | def : Pat<(membarrier (i8 0), (i8 0), (i8 0), (i8 1), (i8 1)), (SFENCE)>; |
| 2316 | 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] | 2317 | 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] | 2318 | (i8 1)), (MFENCE)>; |
| 2319 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2320 | // Alias instructions that map zero vector to pxor / xorp* for sse. |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 2321 | // We set canFoldAsLoad because this can be converted to a constant-pool |
Dan Gohman | 37eb6c8 | 2008-12-03 05:21:24 +0000 | [diff] [blame] | 2322 | // load of an all-ones value if folding it would be beneficial. |
Daniel Dunbar | a0e6200 | 2009-08-11 22:17:52 +0000 | [diff] [blame] | 2323 | let isReMaterializable = 1, isAsCheapAsAMove = 1, canFoldAsLoad = 1, |
| 2324 | isCodeGenOnly = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2325 | def V_SETALLONES : PDI<0x76, MRMInitReg, (outs VR128:$dst), (ins), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2326 | "pcmpeqd\t$dst, $dst", |
Chris Lattner | e6aa386 | 2007-11-25 00:24:49 +0000 | [diff] [blame] | 2327 | [(set VR128:$dst, (v4i32 immAllOnesV))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2328 | |
| 2329 | // FR64 to 128-bit vector conversion. |
Evan Cheng | bd0ca9c | 2009-02-05 08:42:55 +0000 | [diff] [blame] | 2330 | let isAsCheapAsAMove = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2331 | def MOVSD2PDrr : SDI<0x10, MRMSrcReg, (outs VR128:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2332 | "movsd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2333 | [(set VR128:$dst, |
| 2334 | (v2f64 (scalar_to_vector FR64:$src)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2335 | def MOVSD2PDrm : SDI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2336 | "movsd\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2337 | [(set VR128:$dst, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2338 | (v2f64 (scalar_to_vector (loadf64 addr:$src))))]>; |
| 2339 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2340 | def MOVDI2PDIrr : PDI<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2341 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2342 | [(set VR128:$dst, |
| 2343 | (v4i32 (scalar_to_vector GR32:$src)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2344 | def MOVDI2PDIrm : PDI<0x6E, MRMSrcMem, (outs VR128:$dst), (ins i32mem:$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 VR128:$dst, |
| 2347 | (v4i32 (scalar_to_vector (loadi32 addr:$src))))]>; |
| 2348 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2349 | def MOVDI2SSrr : PDI<0x6E, MRMSrcReg, (outs FR32:$dst), (ins GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2350 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2351 | [(set FR32:$dst, (bitconvert GR32:$src))]>; |
| 2352 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2353 | def MOVDI2SSrm : PDI<0x6E, MRMSrcMem, (outs FR32:$dst), (ins i32mem:$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 FR32:$dst, (bitconvert (loadi32 addr:$src)))]>; |
| 2356 | |
| 2357 | // SSE2 instructions with XS prefix |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2358 | def MOVQI2PQIrm : I<0x7E, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2359 | "movq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2360 | [(set VR128:$dst, |
| 2361 | (v2i64 (scalar_to_vector (loadi64 addr:$src))))]>, XS, |
| 2362 | Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2363 | def MOVPQI2QImr : PDI<0xD6, MRMDestMem, (outs), (ins i64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2364 | "movq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2365 | [(store (i64 (vector_extract (v2i64 VR128:$src), |
| 2366 | (iPTR 0))), addr:$dst)]>; |
| 2367 | |
| 2368 | // FIXME: may not be able to eliminate this movss with coalescing the src and |
| 2369 | // dest register classes are different. We really want to write this pattern |
| 2370 | // like this: |
| 2371 | // def : Pat<(f32 (vector_extract (v4f32 VR128:$src), (iPTR 0))), |
| 2372 | // (f32 FR32:$src)>; |
Evan Cheng | bd0ca9c | 2009-02-05 08:42:55 +0000 | [diff] [blame] | 2373 | let isAsCheapAsAMove = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2374 | def MOVPD2SDrr : SDI<0x10, MRMSrcReg, (outs FR64:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2375 | "movsd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2376 | [(set FR64:$dst, (vector_extract (v2f64 VR128:$src), |
| 2377 | (iPTR 0)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2378 | def MOVPD2SDmr : SDI<0x11, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2379 | "movsd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2380 | [(store (f64 (vector_extract (v2f64 VR128:$src), |
| 2381 | (iPTR 0))), addr:$dst)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2382 | def MOVPDI2DIrr : PDI<0x7E, MRMDestReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2383 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2384 | [(set GR32:$dst, (vector_extract (v4i32 VR128:$src), |
| 2385 | (iPTR 0)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2386 | def MOVPDI2DImr : PDI<0x7E, MRMDestMem, (outs), (ins i32mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2387 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2388 | [(store (i32 (vector_extract (v4i32 VR128:$src), |
| 2389 | (iPTR 0))), addr:$dst)]>; |
| 2390 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2391 | def MOVSS2DIrr : PDI<0x7E, MRMDestReg, (outs GR32:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2392 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2393 | [(set GR32:$dst, (bitconvert FR32:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2394 | def MOVSS2DImr : PDI<0x7E, MRMDestMem, (outs), (ins i32mem:$dst, FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2395 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2396 | [(store (i32 (bitconvert FR32:$src)), addr:$dst)]>; |
| 2397 | |
| 2398 | |
| 2399 | // Move to lower bits of a VR128, leaving upper bits alone. |
| 2400 | // Three operand (but two address) aliases. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2401 | let Constraints = "$src1 = $dst" in { |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 2402 | let neverHasSideEffects = 1 in |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2403 | def MOVLSD2PDrr : SDI<0x10, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2404 | (outs VR128:$dst), (ins VR128:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2405 | "movsd\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2406 | |
| 2407 | let AddedComplexity = 15 in |
| 2408 | def MOVLPDrr : SDI<0x10, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2409 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2410 | "movsd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2411 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2412 | (v2f64 (movl VR128:$src1, VR128:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2413 | } |
| 2414 | |
| 2415 | // Store / copy lower 64-bits of a XMM register. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2416 | def MOVLQ128mr : PDI<0xD6, MRMDestMem, (outs), (ins i64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2417 | "movq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2418 | [(int_x86_sse2_storel_dq addr:$dst, VR128:$src)]>; |
| 2419 | |
| 2420 | // Move to lower bits of a VR128 and zeroing upper bits. |
| 2421 | // Loading from memory automatically zeroing upper bits. |
Evan Cheng | d743a5f | 2008-05-10 00:59:18 +0000 | [diff] [blame] | 2422 | let AddedComplexity = 20 in { |
| 2423 | def MOVZSD2PDrm : SDI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src), |
| 2424 | "movsd\t{$src, $dst|$dst, $src}", |
| 2425 | [(set VR128:$dst, |
| 2426 | (v2f64 (X86vzmovl (v2f64 (scalar_to_vector |
| 2427 | (loadf64 addr:$src))))))]>; |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 2428 | |
Evan Cheng | 056afe1 | 2008-05-20 18:24:47 +0000 | [diff] [blame] | 2429 | def : Pat<(v2f64 (X86vzmovl (loadv2f64 addr:$src))), |
| 2430 | (MOVZSD2PDrm addr:$src)>; |
| 2431 | def : Pat<(v2f64 (X86vzmovl (bc_v2f64 (loadv4f32 addr:$src)))), |
Evan Cheng | d743a5f | 2008-05-10 00:59:18 +0000 | [diff] [blame] | 2432 | (MOVZSD2PDrm addr:$src)>; |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2433 | def : Pat<(v2f64 (X86vzload addr:$src)), (MOVZSD2PDrm addr:$src)>; |
Evan Cheng | d743a5f | 2008-05-10 00:59:18 +0000 | [diff] [blame] | 2434 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2435 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2436 | // movd / movq to XMM register zero-extends |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2437 | let AddedComplexity = 15 in { |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2438 | def MOVZDI2PDIrr : PDI<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2439 | "movd\t{$src, $dst|$dst, $src}", |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2440 | [(set VR128:$dst, (v4i32 (X86vzmovl |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 2441 | (v4i32 (scalar_to_vector GR32:$src)))))]>; |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2442 | // This is X86-64 only. |
| 2443 | def MOVZQI2PQIrr : RPDI<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR64:$src), |
| 2444 | "mov{d|q}\t{$src, $dst|$dst, $src}", |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2445 | [(set VR128:$dst, (v2i64 (X86vzmovl |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 2446 | (v2i64 (scalar_to_vector GR64:$src)))))]>; |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2447 | } |
| 2448 | |
| 2449 | let AddedComplexity = 20 in { |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2450 | def MOVZDI2PDIrm : PDI<0x6E, MRMSrcMem, (outs VR128:$dst), (ins i32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2451 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2452 | [(set VR128:$dst, |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2453 | (v4i32 (X86vzmovl (v4i32 (scalar_to_vector |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 2454 | (loadi32 addr:$src))))))]>; |
Evan Cheng | 3ad16c4 | 2008-05-22 18:56:56 +0000 | [diff] [blame] | 2455 | |
| 2456 | def : Pat<(v4i32 (X86vzmovl (loadv4i32 addr:$src))), |
| 2457 | (MOVZDI2PDIrm addr:$src)>; |
| 2458 | def : Pat<(v4i32 (X86vzmovl (bc_v4i32 (loadv4f32 addr:$src)))), |
| 2459 | (MOVZDI2PDIrm addr:$src)>; |
Duncan Sands | 2418bec | 2008-06-13 19:07:40 +0000 | [diff] [blame] | 2460 | def : Pat<(v4i32 (X86vzmovl (bc_v4i32 (loadv2i64 addr:$src)))), |
| 2461 | (MOVZDI2PDIrm addr:$src)>; |
Evan Cheng | 3ad16c4 | 2008-05-22 18:56:56 +0000 | [diff] [blame] | 2462 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2463 | def MOVZQI2PQIrm : I<0x7E, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2464 | "movq\t{$src, $dst|$dst, $src}", |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2465 | [(set VR128:$dst, |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2466 | (v2i64 (X86vzmovl (v2i64 (scalar_to_vector |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 2467 | (loadi64 addr:$src))))))]>, XS, |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2468 | Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2469 | |
Evan Cheng | 3ad16c4 | 2008-05-22 18:56:56 +0000 | [diff] [blame] | 2470 | def : Pat<(v2i64 (X86vzmovl (loadv2i64 addr:$src))), |
| 2471 | (MOVZQI2PQIrm addr:$src)>; |
| 2472 | def : Pat<(v2i64 (X86vzmovl (bc_v2i64 (loadv4f32 addr:$src)))), |
| 2473 | (MOVZQI2PQIrm addr:$src)>; |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2474 | def : Pat<(v2i64 (X86vzload addr:$src)), (MOVZQI2PQIrm addr:$src)>; |
Evan Cheng | d743a5f | 2008-05-10 00:59:18 +0000 | [diff] [blame] | 2475 | } |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2476 | |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2477 | // Moving from XMM to XMM and clear upper 64 bits. Note, there is a bug in |
| 2478 | // IA32 document. movq xmm1, xmm2 does clear the high bits. |
| 2479 | let AddedComplexity = 15 in |
| 2480 | def MOVZPQILo2PQIrr : I<0x7E, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 2481 | "movq\t{$src, $dst|$dst, $src}", |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2482 | [(set VR128:$dst, (v2i64 (X86vzmovl (v2i64 VR128:$src))))]>, |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2483 | XS, Requires<[HasSSE2]>; |
| 2484 | |
Evan Cheng | 056afe1 | 2008-05-20 18:24:47 +0000 | [diff] [blame] | 2485 | let AddedComplexity = 20 in { |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2486 | def MOVZPQILo2PQIrm : I<0x7E, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
| 2487 | "movq\t{$src, $dst|$dst, $src}", |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2488 | [(set VR128:$dst, (v2i64 (X86vzmovl |
Evan Cheng | 056afe1 | 2008-05-20 18:24:47 +0000 | [diff] [blame] | 2489 | (loadv2i64 addr:$src))))]>, |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2490 | XS, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2491 | |
Evan Cheng | 056afe1 | 2008-05-20 18:24:47 +0000 | [diff] [blame] | 2492 | def : Pat<(v2i64 (X86vzmovl (bc_v2i64 (loadv4i32 addr:$src)))), |
| 2493 | (MOVZPQILo2PQIrm addr:$src)>; |
| 2494 | } |
| 2495 | |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2496 | // Instructions for the disassembler |
| 2497 | // xr = XMM register |
| 2498 | // xm = mem64 |
| 2499 | |
| 2500 | def MOVQxrxr : I<0x7E, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 2501 | "movq\t{$src, $dst|$dst, $src}", []>, XS; |
| 2502 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2503 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2504 | // SSE3 Instructions |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2505 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2506 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2507 | // Move Instructions |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2508 | def MOVSHDUPrr : S3SI<0x16, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2509 | "movshdup\t{$src, $dst|$dst, $src}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2510 | [(set VR128:$dst, (v4f32 (movshdup |
| 2511 | VR128:$src, (undef))))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2512 | def MOVSHDUPrm : S3SI<0x16, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2513 | "movshdup\t{$src, $dst|$dst, $src}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2514 | [(set VR128:$dst, (movshdup |
| 2515 | (memopv4f32 addr:$src), (undef)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2516 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2517 | def MOVSLDUPrr : S3SI<0x12, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2518 | "movsldup\t{$src, $dst|$dst, $src}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2519 | [(set VR128:$dst, (v4f32 (movsldup |
| 2520 | VR128:$src, (undef))))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2521 | def MOVSLDUPrm : S3SI<0x12, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2522 | "movsldup\t{$src, $dst|$dst, $src}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2523 | [(set VR128:$dst, (movsldup |
| 2524 | (memopv4f32 addr:$src), (undef)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2525 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2526 | def MOVDDUPrr : S3DI<0x12, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2527 | "movddup\t{$src, $dst|$dst, $src}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2528 | [(set VR128:$dst,(v2f64 (movddup VR128:$src, (undef))))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2529 | def MOVDDUPrm : S3DI<0x12, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2530 | "movddup\t{$src, $dst|$dst, $src}", |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 2531 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2532 | (v2f64 (movddup (scalar_to_vector (loadf64 addr:$src)), |
| 2533 | (undef))))]>; |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 2534 | |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2535 | def : Pat<(movddup (bc_v2f64 (v2i64 (scalar_to_vector (loadi64 addr:$src)))), |
| 2536 | (undef)), |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 2537 | (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; |
Nate Begeman | b44aad7 | 2009-04-29 22:47:44 +0000 | [diff] [blame] | 2538 | |
| 2539 | let AddedComplexity = 5 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2540 | def : Pat<(movddup (memopv2f64 addr:$src), (undef)), |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 2541 | (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; |
Nate Begeman | b44aad7 | 2009-04-29 22:47:44 +0000 | [diff] [blame] | 2542 | def : Pat<(movddup (bc_v4f32 (memopv2f64 addr:$src)), (undef)), |
| 2543 | (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; |
| 2544 | def : Pat<(movddup (memopv2i64 addr:$src), (undef)), |
| 2545 | (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; |
| 2546 | def : Pat<(movddup (bc_v4i32 (memopv2i64 addr:$src)), (undef)), |
| 2547 | (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; |
| 2548 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2549 | |
| 2550 | // Arithmetic |
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 ADDSUBPSrr : S3DI<0xD0, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2553 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2554 | "addsubps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2555 | [(set VR128:$dst, (int_x86_sse3_addsub_ps VR128:$src1, |
| 2556 | VR128:$src2))]>; |
| 2557 | def ADDSUBPSrm : S3DI<0xD0, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2558 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2559 | "addsubps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2560 | [(set VR128:$dst, (int_x86_sse3_addsub_ps VR128:$src1, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 2561 | (memop addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2562 | def ADDSUBPDrr : S3I<0xD0, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2563 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2564 | "addsubpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2565 | [(set VR128:$dst, (int_x86_sse3_addsub_pd VR128:$src1, |
| 2566 | VR128:$src2))]>; |
| 2567 | def ADDSUBPDrm : S3I<0xD0, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2568 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2569 | "addsubpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2570 | [(set VR128:$dst, (int_x86_sse3_addsub_pd VR128:$src1, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 2571 | (memop addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2572 | } |
| 2573 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2574 | def LDDQUrm : S3DI<0xF0, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2575 | "lddqu\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2576 | [(set VR128:$dst, (int_x86_sse3_ldu_dq addr:$src))]>; |
| 2577 | |
| 2578 | // Horizontal ops |
| 2579 | class S3D_Intrr<bits<8> o, string OpcodeStr, Intrinsic IntId> |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2580 | : S3DI<o, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2581 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2582 | [(set VR128:$dst, (v4f32 (IntId VR128:$src1, VR128:$src2)))]>; |
| 2583 | class S3D_Intrm<bits<8> o, string OpcodeStr, Intrinsic IntId> |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2584 | : S3DI<o, MRMSrcMem, (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2585 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 2586 | [(set VR128:$dst, (v4f32 (IntId VR128:$src1, (memop addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2587 | class S3_Intrr<bits<8> o, string OpcodeStr, Intrinsic IntId> |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2588 | : S3I<o, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2589 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2590 | [(set VR128:$dst, (v2f64 (IntId VR128:$src1, VR128:$src2)))]>; |
| 2591 | class S3_Intrm<bits<8> o, string OpcodeStr, Intrinsic IntId> |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2592 | : S3I<o, MRMSrcMem, (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2593 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 2594 | [(set VR128:$dst, (v2f64 (IntId VR128:$src1, (memopv2f64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2595 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2596 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2597 | def HADDPSrr : S3D_Intrr<0x7C, "haddps", int_x86_sse3_hadd_ps>; |
| 2598 | def HADDPSrm : S3D_Intrm<0x7C, "haddps", int_x86_sse3_hadd_ps>; |
| 2599 | def HADDPDrr : S3_Intrr <0x7C, "haddpd", int_x86_sse3_hadd_pd>; |
| 2600 | def HADDPDrm : S3_Intrm <0x7C, "haddpd", int_x86_sse3_hadd_pd>; |
| 2601 | def HSUBPSrr : S3D_Intrr<0x7D, "hsubps", int_x86_sse3_hsub_ps>; |
| 2602 | def HSUBPSrm : S3D_Intrm<0x7D, "hsubps", int_x86_sse3_hsub_ps>; |
| 2603 | def HSUBPDrr : S3_Intrr <0x7D, "hsubpd", int_x86_sse3_hsub_pd>; |
| 2604 | def HSUBPDrm : S3_Intrm <0x7D, "hsubpd", int_x86_sse3_hsub_pd>; |
| 2605 | } |
| 2606 | |
| 2607 | // Thread synchronization |
Bill Wendling | 6ee7655 | 2009-05-28 23:40:46 +0000 | [diff] [blame] | 2608 | def MONITOR : I<0x01, MRM1r, (outs), (ins), "monitor", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2609 | [(int_x86_sse3_monitor EAX, ECX, EDX)]>,TB, Requires<[HasSSE3]>; |
Bill Wendling | 6ee7655 | 2009-05-28 23:40:46 +0000 | [diff] [blame] | 2610 | def MWAIT : I<0x01, MRM1r, (outs), (ins), "mwait", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2611 | [(int_x86_sse3_mwait ECX, EAX)]>, TB, Requires<[HasSSE3]>; |
| 2612 | |
| 2613 | // vector_shuffle v1, <undef> <1, 1, 3, 3> |
| 2614 | let AddedComplexity = 15 in |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2615 | def : Pat<(v4i32 (movshdup VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2616 | (MOVSHDUPrr VR128:$src)>, Requires<[HasSSE3]>; |
| 2617 | let AddedComplexity = 20 in |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2618 | def : Pat<(v4i32 (movshdup (bc_v4i32 (memopv2i64 addr:$src)), (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2619 | (MOVSHDUPrm addr:$src)>, Requires<[HasSSE3]>; |
| 2620 | |
| 2621 | // vector_shuffle v1, <undef> <0, 0, 2, 2> |
| 2622 | let AddedComplexity = 15 in |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2623 | def : Pat<(v4i32 (movsldup VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2624 | (MOVSLDUPrr VR128:$src)>, Requires<[HasSSE3]>; |
| 2625 | let AddedComplexity = 20 in |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2626 | def : Pat<(v4i32 (movsldup (bc_v4i32 (memopv2i64 addr:$src)), (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2627 | (MOVSLDUPrm addr:$src)>, Requires<[HasSSE3]>; |
| 2628 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2629 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2630 | // SSSE3 Instructions |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2631 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2632 | |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2633 | /// 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] | 2634 | multiclass SS3I_unop_rm_int_8<bits<8> opc, string OpcodeStr, |
| 2635 | Intrinsic IntId64, Intrinsic IntId128> { |
| 2636 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), (ins VR64:$src), |
| 2637 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2638 | [(set VR64:$dst, (IntId64 VR64:$src))]>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2639 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 2640 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), (ins i64mem:$src), |
| 2641 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2642 | [(set VR64:$dst, |
| 2643 | (IntId64 (bitconvert (memopv8i8 addr:$src))))]>; |
| 2644 | |
| 2645 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2646 | (ins VR128:$src), |
| 2647 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2648 | [(set VR128:$dst, (IntId128 VR128:$src))]>, |
| 2649 | OpSize; |
| 2650 | |
| 2651 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2652 | (ins i128mem:$src), |
| 2653 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2654 | [(set VR128:$dst, |
| 2655 | (IntId128 |
| 2656 | (bitconvert (memopv16i8 addr:$src))))]>, OpSize; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2657 | } |
| 2658 | |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2659 | /// 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] | 2660 | multiclass SS3I_unop_rm_int_16<bits<8> opc, string OpcodeStr, |
| 2661 | Intrinsic IntId64, Intrinsic IntId128> { |
| 2662 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), |
| 2663 | (ins VR64:$src), |
| 2664 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2665 | [(set VR64:$dst, (IntId64 VR64:$src))]>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2666 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 2667 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), |
| 2668 | (ins i64mem:$src), |
| 2669 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2670 | [(set VR64:$dst, |
| 2671 | (IntId64 |
| 2672 | (bitconvert (memopv4i16 addr:$src))))]>; |
| 2673 | |
| 2674 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2675 | (ins VR128:$src), |
| 2676 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2677 | [(set VR128:$dst, (IntId128 VR128:$src))]>, |
| 2678 | OpSize; |
| 2679 | |
| 2680 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2681 | (ins i128mem:$src), |
| 2682 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2683 | [(set VR128:$dst, |
| 2684 | (IntId128 |
| 2685 | (bitconvert (memopv8i16 addr:$src))))]>, OpSize; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2686 | } |
| 2687 | |
| 2688 | /// 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] | 2689 | multiclass SS3I_unop_rm_int_32<bits<8> opc, string OpcodeStr, |
| 2690 | Intrinsic IntId64, Intrinsic IntId128> { |
| 2691 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), |
| 2692 | (ins VR64:$src), |
| 2693 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2694 | [(set VR64:$dst, (IntId64 VR64:$src))]>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2695 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 2696 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), |
| 2697 | (ins i64mem:$src), |
| 2698 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2699 | [(set VR64:$dst, |
| 2700 | (IntId64 |
| 2701 | (bitconvert (memopv2i32 addr:$src))))]>; |
| 2702 | |
| 2703 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2704 | (ins VR128:$src), |
| 2705 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2706 | [(set VR128:$dst, (IntId128 VR128:$src))]>, |
| 2707 | OpSize; |
| 2708 | |
| 2709 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2710 | (ins i128mem:$src), |
| 2711 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2712 | [(set VR128:$dst, |
| 2713 | (IntId128 |
| 2714 | (bitconvert (memopv4i32 addr:$src))))]>, OpSize; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2715 | } |
| 2716 | |
| 2717 | defm PABSB : SS3I_unop_rm_int_8 <0x1C, "pabsb", |
| 2718 | int_x86_ssse3_pabs_b, |
| 2719 | int_x86_ssse3_pabs_b_128>; |
| 2720 | defm PABSW : SS3I_unop_rm_int_16<0x1D, "pabsw", |
| 2721 | int_x86_ssse3_pabs_w, |
| 2722 | int_x86_ssse3_pabs_w_128>; |
| 2723 | defm PABSD : SS3I_unop_rm_int_32<0x1E, "pabsd", |
| 2724 | int_x86_ssse3_pabs_d, |
| 2725 | int_x86_ssse3_pabs_d_128>; |
| 2726 | |
| 2727 | /// 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] | 2728 | let Constraints = "$src1 = $dst" in { |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2729 | multiclass SS3I_binop_rm_int_8<bits<8> opc, string OpcodeStr, |
| 2730 | Intrinsic IntId64, Intrinsic IntId128, |
| 2731 | bit Commutable = 0> { |
| 2732 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), |
| 2733 | (ins VR64:$src1, VR64:$src2), |
| 2734 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2735 | [(set VR64:$dst, (IntId64 VR64:$src1, VR64:$src2))]> { |
| 2736 | let isCommutable = Commutable; |
| 2737 | } |
| 2738 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), |
| 2739 | (ins VR64:$src1, i64mem:$src2), |
| 2740 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2741 | [(set VR64:$dst, |
| 2742 | (IntId64 VR64:$src1, |
| 2743 | (bitconvert (memopv8i8 addr:$src2))))]>; |
| 2744 | |
| 2745 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2746 | (ins VR128:$src1, VR128:$src2), |
| 2747 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2748 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 2749 | OpSize { |
| 2750 | let isCommutable = Commutable; |
| 2751 | } |
| 2752 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2753 | (ins VR128:$src1, i128mem:$src2), |
| 2754 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2755 | [(set VR128:$dst, |
| 2756 | (IntId128 VR128:$src1, |
| 2757 | (bitconvert (memopv16i8 addr:$src2))))]>, OpSize; |
| 2758 | } |
| 2759 | } |
| 2760 | |
| 2761 | /// 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] | 2762 | let Constraints = "$src1 = $dst" in { |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2763 | multiclass SS3I_binop_rm_int_16<bits<8> opc, string OpcodeStr, |
| 2764 | Intrinsic IntId64, Intrinsic IntId128, |
| 2765 | bit Commutable = 0> { |
| 2766 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), |
| 2767 | (ins VR64:$src1, VR64:$src2), |
| 2768 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2769 | [(set VR64:$dst, (IntId64 VR64:$src1, VR64:$src2))]> { |
| 2770 | let isCommutable = Commutable; |
| 2771 | } |
| 2772 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), |
| 2773 | (ins VR64:$src1, i64mem:$src2), |
| 2774 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2775 | [(set VR64:$dst, |
| 2776 | (IntId64 VR64:$src1, |
| 2777 | (bitconvert (memopv4i16 addr:$src2))))]>; |
| 2778 | |
| 2779 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2780 | (ins VR128:$src1, VR128:$src2), |
| 2781 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2782 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 2783 | OpSize { |
| 2784 | let isCommutable = Commutable; |
| 2785 | } |
| 2786 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2787 | (ins VR128:$src1, i128mem:$src2), |
| 2788 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2789 | [(set VR128:$dst, |
| 2790 | (IntId128 VR128:$src1, |
| 2791 | (bitconvert (memopv8i16 addr:$src2))))]>, OpSize; |
| 2792 | } |
| 2793 | } |
| 2794 | |
| 2795 | /// 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] | 2796 | let Constraints = "$src1 = $dst" in { |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2797 | multiclass SS3I_binop_rm_int_32<bits<8> opc, string OpcodeStr, |
| 2798 | Intrinsic IntId64, Intrinsic IntId128, |
| 2799 | bit Commutable = 0> { |
| 2800 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), |
| 2801 | (ins VR64:$src1, VR64:$src2), |
| 2802 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2803 | [(set VR64:$dst, (IntId64 VR64:$src1, VR64:$src2))]> { |
| 2804 | let isCommutable = Commutable; |
| 2805 | } |
| 2806 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), |
| 2807 | (ins VR64:$src1, i64mem:$src2), |
| 2808 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2809 | [(set VR64:$dst, |
| 2810 | (IntId64 VR64:$src1, |
| 2811 | (bitconvert (memopv2i32 addr:$src2))))]>; |
| 2812 | |
| 2813 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2814 | (ins VR128:$src1, VR128:$src2), |
| 2815 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2816 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 2817 | OpSize { |
| 2818 | let isCommutable = Commutable; |
| 2819 | } |
| 2820 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2821 | (ins VR128:$src1, i128mem:$src2), |
| 2822 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2823 | [(set VR128:$dst, |
| 2824 | (IntId128 VR128:$src1, |
| 2825 | (bitconvert (memopv4i32 addr:$src2))))]>, OpSize; |
| 2826 | } |
| 2827 | } |
| 2828 | |
| 2829 | defm PHADDW : SS3I_binop_rm_int_16<0x01, "phaddw", |
| 2830 | int_x86_ssse3_phadd_w, |
Evan Cheng | 944e441 | 2008-06-16 21:16:24 +0000 | [diff] [blame] | 2831 | int_x86_ssse3_phadd_w_128>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2832 | defm PHADDD : SS3I_binop_rm_int_32<0x02, "phaddd", |
| 2833 | int_x86_ssse3_phadd_d, |
Evan Cheng | 944e441 | 2008-06-16 21:16:24 +0000 | [diff] [blame] | 2834 | int_x86_ssse3_phadd_d_128>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2835 | defm PHADDSW : SS3I_binop_rm_int_16<0x03, "phaddsw", |
| 2836 | int_x86_ssse3_phadd_sw, |
Evan Cheng | 944e441 | 2008-06-16 21:16:24 +0000 | [diff] [blame] | 2837 | int_x86_ssse3_phadd_sw_128>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2838 | defm PHSUBW : SS3I_binop_rm_int_16<0x05, "phsubw", |
| 2839 | int_x86_ssse3_phsub_w, |
| 2840 | int_x86_ssse3_phsub_w_128>; |
| 2841 | defm PHSUBD : SS3I_binop_rm_int_32<0x06, "phsubd", |
| 2842 | int_x86_ssse3_phsub_d, |
| 2843 | int_x86_ssse3_phsub_d_128>; |
| 2844 | defm PHSUBSW : SS3I_binop_rm_int_16<0x07, "phsubsw", |
| 2845 | int_x86_ssse3_phsub_sw, |
| 2846 | int_x86_ssse3_phsub_sw_128>; |
| 2847 | defm PMADDUBSW : SS3I_binop_rm_int_8 <0x04, "pmaddubsw", |
| 2848 | int_x86_ssse3_pmadd_ub_sw, |
Evan Cheng | 944e441 | 2008-06-16 21:16:24 +0000 | [diff] [blame] | 2849 | int_x86_ssse3_pmadd_ub_sw_128>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2850 | defm PMULHRSW : SS3I_binop_rm_int_16<0x0B, "pmulhrsw", |
| 2851 | int_x86_ssse3_pmul_hr_sw, |
| 2852 | int_x86_ssse3_pmul_hr_sw_128, 1>; |
| 2853 | defm PSHUFB : SS3I_binop_rm_int_8 <0x00, "pshufb", |
| 2854 | int_x86_ssse3_pshuf_b, |
| 2855 | int_x86_ssse3_pshuf_b_128>; |
| 2856 | defm PSIGNB : SS3I_binop_rm_int_8 <0x08, "psignb", |
| 2857 | int_x86_ssse3_psign_b, |
| 2858 | int_x86_ssse3_psign_b_128>; |
| 2859 | defm PSIGNW : SS3I_binop_rm_int_16<0x09, "psignw", |
| 2860 | int_x86_ssse3_psign_w, |
| 2861 | int_x86_ssse3_psign_w_128>; |
Evan Cheng | abfed47 | 2009-05-28 18:48:53 +0000 | [diff] [blame] | 2862 | defm PSIGND : SS3I_binop_rm_int_32<0x0A, "psignd", |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2863 | int_x86_ssse3_psign_d, |
| 2864 | int_x86_ssse3_psign_d_128>; |
| 2865 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2866 | let Constraints = "$src1 = $dst" in { |
Bill Wendling | 1dc817c | 2007-08-10 09:00:17 +0000 | [diff] [blame] | 2867 | def PALIGNR64rr : SS3AI<0x0F, MRMSrcReg, (outs VR64:$dst), |
Sean Callanan | b02aec5 | 2009-11-20 22:28:42 +0000 | [diff] [blame] | 2868 | (ins VR64:$src1, VR64:$src2, i8imm:$src3), |
Dale Johannesen | 576b27e | 2007-10-11 20:58:37 +0000 | [diff] [blame] | 2869 | "palignr\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2870 | []>; |
Dan Gohman | bcb9d46 | 2008-05-28 01:50:19 +0000 | [diff] [blame] | 2871 | def PALIGNR64rm : SS3AI<0x0F, MRMSrcMem, (outs VR64:$dst), |
Sean Callanan | b02aec5 | 2009-11-20 22:28:42 +0000 | [diff] [blame] | 2872 | (ins VR64:$src1, i64mem:$src2, i8imm:$src3), |
Dale Johannesen | 576b27e | 2007-10-11 20:58:37 +0000 | [diff] [blame] | 2873 | "palignr\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2874 | []>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2875 | |
Bill Wendling | 1dc817c | 2007-08-10 09:00:17 +0000 | [diff] [blame] | 2876 | def PALIGNR128rr : SS3AI<0x0F, MRMSrcReg, (outs VR128:$dst), |
Sean Callanan | b02aec5 | 2009-11-20 22:28:42 +0000 | [diff] [blame] | 2877 | (ins VR128:$src1, VR128:$src2, i8imm:$src3), |
Dale Johannesen | 576b27e | 2007-10-11 20:58:37 +0000 | [diff] [blame] | 2878 | "palignr\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2879 | []>, OpSize; |
Dan Gohman | bcb9d46 | 2008-05-28 01:50:19 +0000 | [diff] [blame] | 2880 | def PALIGNR128rm : SS3AI<0x0F, MRMSrcMem, (outs VR128:$dst), |
Sean Callanan | b02aec5 | 2009-11-20 22:28:42 +0000 | [diff] [blame] | 2881 | (ins VR128:$src1, i128mem:$src2, i8imm:$src3), |
Dale Johannesen | 576b27e | 2007-10-11 20:58:37 +0000 | [diff] [blame] | 2882 | "palignr\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2883 | []>, OpSize; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2884 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2885 | |
Nate Begeman | 080f8e2 | 2009-10-19 02:17:23 +0000 | [diff] [blame] | 2886 | // palignr patterns. |
Sean Callanan | b02aec5 | 2009-11-20 22:28:42 +0000 | [diff] [blame] | 2887 | def : Pat<(int_x86_ssse3_palign_r VR64:$src1, VR64:$src2, (i8 imm:$src3)), |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2888 | (PALIGNR64rr VR64:$src1, VR64:$src2, (BYTE_imm imm:$src3))>, |
| 2889 | Requires<[HasSSSE3]>; |
| 2890 | def : Pat<(int_x86_ssse3_palign_r VR64:$src1, |
| 2891 | (memop64 addr:$src2), |
Sean Callanan | b02aec5 | 2009-11-20 22:28:42 +0000 | [diff] [blame] | 2892 | (i8 imm:$src3)), |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2893 | (PALIGNR64rm VR64:$src1, addr:$src2, (BYTE_imm imm:$src3))>, |
| 2894 | Requires<[HasSSSE3]>; |
| 2895 | |
Sean Callanan | b02aec5 | 2009-11-20 22:28:42 +0000 | [diff] [blame] | 2896 | def : Pat<(int_x86_ssse3_palign_r_128 VR128:$src1, VR128:$src2, (i8 imm:$src3)), |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2897 | (PALIGNR128rr VR128:$src1, VR128:$src2, (BYTE_imm imm:$src3))>, |
| 2898 | Requires<[HasSSSE3]>; |
| 2899 | def : Pat<(int_x86_ssse3_palign_r_128 VR128:$src1, |
| 2900 | (memopv2i64 addr:$src2), |
Sean Callanan | b02aec5 | 2009-11-20 22:28:42 +0000 | [diff] [blame] | 2901 | (i8 imm:$src3)), |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2902 | (PALIGNR128rm VR128:$src1, addr:$src2, (BYTE_imm imm:$src3))>, |
| 2903 | Requires<[HasSSSE3]>; |
| 2904 | |
Nate Begeman | 080f8e2 | 2009-10-19 02:17:23 +0000 | [diff] [blame] | 2905 | let AddedComplexity = 5 in { |
| 2906 | def : Pat<(v4i32 (palign:$src3 VR128:$src1, VR128:$src2)), |
| 2907 | (PALIGNR128rr VR128:$src2, VR128:$src1, |
| 2908 | (SHUFFLE_get_palign_imm VR128:$src3))>, |
| 2909 | Requires<[HasSSSE3]>; |
| 2910 | def : Pat<(v4f32 (palign:$src3 VR128:$src1, VR128:$src2)), |
| 2911 | (PALIGNR128rr VR128:$src2, VR128:$src1, |
| 2912 | (SHUFFLE_get_palign_imm VR128:$src3))>, |
| 2913 | Requires<[HasSSSE3]>; |
| 2914 | def : Pat<(v8i16 (palign:$src3 VR128:$src1, VR128:$src2)), |
| 2915 | (PALIGNR128rr VR128:$src2, VR128:$src1, |
| 2916 | (SHUFFLE_get_palign_imm VR128:$src3))>, |
| 2917 | Requires<[HasSSSE3]>; |
| 2918 | def : Pat<(v16i8 (palign:$src3 VR128:$src1, VR128:$src2)), |
| 2919 | (PALIGNR128rr VR128:$src2, VR128:$src1, |
| 2920 | (SHUFFLE_get_palign_imm VR128:$src3))>, |
| 2921 | Requires<[HasSSSE3]>; |
Eric Christopher | f365029 | 2009-11-07 08:45:53 +0000 | [diff] [blame] | 2922 | } |
Nate Begeman | 080f8e2 | 2009-10-19 02:17:23 +0000 | [diff] [blame] | 2923 | |
Nate Begeman | 2c87c42 | 2009-02-23 08:49:38 +0000 | [diff] [blame] | 2924 | def : Pat<(X86pshufb VR128:$src, VR128:$mask), |
| 2925 | (PSHUFBrr128 VR128:$src, VR128:$mask)>, Requires<[HasSSSE3]>; |
| 2926 | def : Pat<(X86pshufb VR128:$src, (bc_v16i8 (memopv2i64 addr:$mask))), |
| 2927 | (PSHUFBrm128 VR128:$src, addr:$mask)>, Requires<[HasSSSE3]>; |
| 2928 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2929 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2930 | // Non-Instruction Patterns |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2931 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2932 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2933 | // extload f32 -> f64. This matches load+fextend because we have a hack in |
| 2934 | // the isel (PreprocessForFPConvert) that can introduce loads after dag |
| 2935 | // combine. |
Chris Lattner | dec9cb5 | 2008-01-24 08:07:48 +0000 | [diff] [blame] | 2936 | // Since these loads aren't folded into the fextend, we have to match it |
| 2937 | // explicitly here. |
| 2938 | let Predicates = [HasSSE2] in |
| 2939 | def : Pat<(fextend (loadf32 addr:$src)), |
| 2940 | (CVTSS2SDrm addr:$src)>; |
| 2941 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2942 | // bit_convert |
| 2943 | let Predicates = [HasSSE2] in { |
| 2944 | def : Pat<(v2i64 (bitconvert (v4i32 VR128:$src))), (v2i64 VR128:$src)>; |
| 2945 | def : Pat<(v2i64 (bitconvert (v8i16 VR128:$src))), (v2i64 VR128:$src)>; |
| 2946 | def : Pat<(v2i64 (bitconvert (v16i8 VR128:$src))), (v2i64 VR128:$src)>; |
| 2947 | def : Pat<(v2i64 (bitconvert (v2f64 VR128:$src))), (v2i64 VR128:$src)>; |
| 2948 | def : Pat<(v2i64 (bitconvert (v4f32 VR128:$src))), (v2i64 VR128:$src)>; |
| 2949 | def : Pat<(v4i32 (bitconvert (v2i64 VR128:$src))), (v4i32 VR128:$src)>; |
| 2950 | def : Pat<(v4i32 (bitconvert (v8i16 VR128:$src))), (v4i32 VR128:$src)>; |
| 2951 | def : Pat<(v4i32 (bitconvert (v16i8 VR128:$src))), (v4i32 VR128:$src)>; |
| 2952 | def : Pat<(v4i32 (bitconvert (v2f64 VR128:$src))), (v4i32 VR128:$src)>; |
| 2953 | def : Pat<(v4i32 (bitconvert (v4f32 VR128:$src))), (v4i32 VR128:$src)>; |
| 2954 | def : Pat<(v8i16 (bitconvert (v2i64 VR128:$src))), (v8i16 VR128:$src)>; |
| 2955 | def : Pat<(v8i16 (bitconvert (v4i32 VR128:$src))), (v8i16 VR128:$src)>; |
| 2956 | def : Pat<(v8i16 (bitconvert (v16i8 VR128:$src))), (v8i16 VR128:$src)>; |
| 2957 | def : Pat<(v8i16 (bitconvert (v2f64 VR128:$src))), (v8i16 VR128:$src)>; |
| 2958 | def : Pat<(v8i16 (bitconvert (v4f32 VR128:$src))), (v8i16 VR128:$src)>; |
| 2959 | def : Pat<(v16i8 (bitconvert (v2i64 VR128:$src))), (v16i8 VR128:$src)>; |
| 2960 | def : Pat<(v16i8 (bitconvert (v4i32 VR128:$src))), (v16i8 VR128:$src)>; |
| 2961 | def : Pat<(v16i8 (bitconvert (v8i16 VR128:$src))), (v16i8 VR128:$src)>; |
| 2962 | def : Pat<(v16i8 (bitconvert (v2f64 VR128:$src))), (v16i8 VR128:$src)>; |
| 2963 | def : Pat<(v16i8 (bitconvert (v4f32 VR128:$src))), (v16i8 VR128:$src)>; |
| 2964 | def : Pat<(v4f32 (bitconvert (v2i64 VR128:$src))), (v4f32 VR128:$src)>; |
| 2965 | def : Pat<(v4f32 (bitconvert (v4i32 VR128:$src))), (v4f32 VR128:$src)>; |
| 2966 | def : Pat<(v4f32 (bitconvert (v8i16 VR128:$src))), (v4f32 VR128:$src)>; |
| 2967 | def : Pat<(v4f32 (bitconvert (v16i8 VR128:$src))), (v4f32 VR128:$src)>; |
| 2968 | def : Pat<(v4f32 (bitconvert (v2f64 VR128:$src))), (v4f32 VR128:$src)>; |
| 2969 | def : Pat<(v2f64 (bitconvert (v2i64 VR128:$src))), (v2f64 VR128:$src)>; |
| 2970 | def : Pat<(v2f64 (bitconvert (v4i32 VR128:$src))), (v2f64 VR128:$src)>; |
| 2971 | def : Pat<(v2f64 (bitconvert (v8i16 VR128:$src))), (v2f64 VR128:$src)>; |
| 2972 | def : Pat<(v2f64 (bitconvert (v16i8 VR128:$src))), (v2f64 VR128:$src)>; |
| 2973 | def : Pat<(v2f64 (bitconvert (v4f32 VR128:$src))), (v2f64 VR128:$src)>; |
| 2974 | } |
| 2975 | |
| 2976 | // Move scalar to XMM zero-extended |
| 2977 | // movd to XMM register zero-extends |
| 2978 | let AddedComplexity = 15 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2979 | // 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] | 2980 | def : Pat<(v2f64 (X86vzmovl (v2f64 (scalar_to_vector FR64:$src)))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2981 | (MOVLSD2PDrr (V_SET0), FR64:$src)>, Requires<[HasSSE2]>; |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2982 | def : Pat<(v4f32 (X86vzmovl (v4f32 (scalar_to_vector FR32:$src)))), |
Anders Carlsson | fd7e450 | 2008-10-07 16:14:11 +0000 | [diff] [blame] | 2983 | (MOVLSS2PSrr (V_SET0), FR32:$src)>, Requires<[HasSSE1]>; |
Evan Cheng | e259e87 | 2008-05-09 23:37:55 +0000 | [diff] [blame] | 2984 | def : Pat<(v4f32 (X86vzmovl (v4f32 VR128:$src))), |
Anders Carlsson | fd7e450 | 2008-10-07 16:14:11 +0000 | [diff] [blame] | 2985 | (MOVLPSrr (V_SET0), VR128:$src)>, Requires<[HasSSE1]>; |
Evan Cheng | 7fe0ff0 | 2008-07-10 01:08:23 +0000 | [diff] [blame] | 2986 | def : Pat<(v4i32 (X86vzmovl (v4i32 VR128:$src))), |
Anders Carlsson | fd7e450 | 2008-10-07 16:14:11 +0000 | [diff] [blame] | 2987 | (MOVLPSrr (V_SET0), VR128:$src)>, Requires<[HasSSE1]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2988 | } |
| 2989 | |
| 2990 | // Splat v2f64 / v2i64 |
| 2991 | let AddedComplexity = 10 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2992 | def : Pat<(splat_lo (v2f64 VR128:$src), (undef)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2993 | (UNPCKLPDrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2994 | def : Pat<(unpckh (v2f64 VR128:$src), (undef)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2995 | (UNPCKHPDrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2996 | def : Pat<(splat_lo (v2i64 VR128:$src), (undef)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2997 | (PUNPCKLQDQrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2998 | def : Pat<(unpckh (v2i64 VR128:$src), (undef)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2999 | (PUNPCKHQDQrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
| 3000 | } |
| 3001 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3002 | // Special unary SHUFPSrri case. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3003 | def : Pat<(v4f32 (pshufd:$src3 VR128:$src1, (undef))), |
| 3004 | (SHUFPSrri VR128:$src1, VR128:$src1, |
| 3005 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3006 | Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3007 | let AddedComplexity = 5 in |
| 3008 | def : Pat<(v4f32 (pshufd:$src2 VR128:$src1, (undef))), |
| 3009 | (PSHUFDri VR128:$src1, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
| 3010 | Requires<[HasSSE2]>; |
Dan Gohman | 7dc1901 | 2007-08-02 21:17:01 +0000 | [diff] [blame] | 3011 | // Special unary SHUFPDrri case. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3012 | def : Pat<(v2i64 (pshufd:$src3 VR128:$src1, (undef))), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3013 | (SHUFPDrri VR128:$src1, VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3014 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
| 3015 | Requires<[HasSSE2]>; |
| 3016 | // Special unary SHUFPDrri case. |
| 3017 | def : Pat<(v2f64 (pshufd:$src3 VR128:$src1, (undef))), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3018 | (SHUFPDrri VR128:$src1, VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3019 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
Dan Gohman | 7dc1901 | 2007-08-02 21:17:01 +0000 | [diff] [blame] | 3020 | Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3021 | // Unary v4f32 shuffle with PSHUF* in order to fold a load. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3022 | def : Pat<(pshufd:$src2 (bc_v4i32 (memopv4f32 addr:$src1)), (undef)), |
| 3023 | (PSHUFDmi addr:$src1, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3024 | Requires<[HasSSE2]>; |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3025 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3026 | // Special binary v4i32 shuffle cases with SHUFPS. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3027 | def : Pat<(v4i32 (shufp:$src3 VR128:$src1, (v4i32 VR128:$src2))), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3028 | (SHUFPSrri VR128:$src1, VR128:$src2, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3029 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3030 | Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3031 | def : Pat<(v4i32 (shufp:$src3 VR128:$src1, (bc_v4i32 (memopv2i64 addr:$src2)))), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3032 | (SHUFPSrmi VR128:$src1, addr:$src2, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3033 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3034 | Requires<[HasSSE2]>; |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 3035 | // Special binary v2i64 shuffle cases using SHUFPDrri. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3036 | def : Pat<(v2i64 (shufp:$src3 VR128:$src1, VR128:$src2)), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3037 | (SHUFPDrri VR128:$src1, VR128:$src2, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3038 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 3039 | Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3040 | |
| 3041 | // vector_shuffle v1, <undef>, <0, 0, 1, 1, ...> |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3042 | let AddedComplexity = 15 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3043 | def : Pat<(v4i32 (unpckl_undef:$src2 VR128:$src, (undef))), |
| 3044 | (PSHUFDri VR128:$src, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3045 | Requires<[OptForSpeed, HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3046 | def : Pat<(v4f32 (unpckl_undef:$src2 VR128:$src, (undef))), |
| 3047 | (PSHUFDri VR128:$src, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3048 | Requires<[OptForSpeed, HasSSE2]>; |
| 3049 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3050 | let AddedComplexity = 10 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3051 | def : Pat<(v4f32 (unpckl_undef VR128:$src, (undef))), |
Evan Cheng | 09d4507 | 2008-09-26 21:26:30 +0000 | [diff] [blame] | 3052 | (UNPCKLPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3053 | def : Pat<(v16i8 (unpckl_undef VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3054 | (PUNPCKLBWrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3055 | def : Pat<(v8i16 (unpckl_undef VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3056 | (PUNPCKLWDrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3057 | def : Pat<(v4i32 (unpckl_undef VR128:$src, (undef))), |
Evan Cheng | 09d4507 | 2008-09-26 21:26:30 +0000 | [diff] [blame] | 3058 | (PUNPCKLDQrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3059 | } |
| 3060 | |
| 3061 | // vector_shuffle v1, <undef>, <2, 2, 3, 3, ...> |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3062 | let AddedComplexity = 15 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3063 | def : Pat<(v4i32 (unpckh_undef:$src2 VR128:$src, (undef))), |
| 3064 | (PSHUFDri VR128:$src, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3065 | Requires<[OptForSpeed, HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3066 | def : Pat<(v4f32 (unpckh_undef:$src2 VR128:$src, (undef))), |
| 3067 | (PSHUFDri VR128:$src, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3068 | Requires<[OptForSpeed, HasSSE2]>; |
| 3069 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3070 | let AddedComplexity = 10 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3071 | def : Pat<(v4f32 (unpckh_undef VR128:$src, (undef))), |
Evan Cheng | 09d4507 | 2008-09-26 21:26:30 +0000 | [diff] [blame] | 3072 | (UNPCKHPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3073 | def : Pat<(v16i8 (unpckh_undef VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3074 | (PUNPCKHBWrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3075 | def : Pat<(v8i16 (unpckh_undef VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3076 | (PUNPCKHWDrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3077 | def : Pat<(v4i32 (unpckh_undef VR128:$src, (undef))), |
Evan Cheng | 09d4507 | 2008-09-26 21:26:30 +0000 | [diff] [blame] | 3078 | (PUNPCKHDQrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3079 | } |
| 3080 | |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3081 | let AddedComplexity = 20 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3082 | // vector_shuffle v1, v2 <0, 1, 4, 5> using MOVLHPS |
Nate Begeman | b13034d | 2009-11-07 23:17:15 +0000 | [diff] [blame] | 3083 | def : Pat<(v4i32 (movlhps VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3084 | (MOVLHPSrr VR128:$src1, VR128:$src2)>; |
| 3085 | |
| 3086 | // vector_shuffle v1, v2 <6, 7, 2, 3> using MOVHLPS |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3087 | def : Pat<(v4i32 (movhlps VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3088 | (MOVHLPSrr VR128:$src1, VR128:$src2)>; |
| 3089 | |
| 3090 | // vector_shuffle v1, undef <2, ?, ?, ?> using MOVHLPS |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3091 | def : Pat<(v4f32 (movhlps_undef VR128:$src1, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3092 | (MOVHLPSrr VR128:$src1, VR128:$src1)>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3093 | def : Pat<(v4i32 (movhlps_undef VR128:$src1, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3094 | (MOVHLPSrr VR128:$src1, VR128:$src1)>; |
| 3095 | } |
| 3096 | |
| 3097 | let AddedComplexity = 20 in { |
| 3098 | // vector_shuffle v1, (load v2) <4, 5, 2, 3> using MOVLPS |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3099 | def : Pat<(v4f32 (movlp VR128:$src1, (load addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3100 | (MOVLPSrm VR128:$src1, addr:$src2)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3101 | def : Pat<(v2f64 (movlp VR128:$src1, (load addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3102 | (MOVLPDrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3103 | def : Pat<(v4i32 (movlp VR128:$src1, (load addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3104 | (MOVLPSrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3105 | def : Pat<(v2i64 (movlp VR128:$src1, (load addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3106 | (MOVLPDrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3107 | } |
| 3108 | |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3109 | // (store (vector_shuffle (load addr), v2, <4, 5, 2, 3>), addr) using MOVLPS |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3110 | def : Pat<(store (v4f32 (movlp (load addr:$src1), VR128:$src2)), addr:$src1), |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3111 | (MOVLPSmr addr:$src1, VR128:$src2)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3112 | def : Pat<(store (v2f64 (movlp (load addr:$src1), VR128:$src2)), addr:$src1), |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3113 | (MOVLPDmr addr:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3114 | def : Pat<(store (v4i32 (movlp (bc_v4i32 (loadv2i64 addr:$src1)), VR128:$src2)), |
| 3115 | addr:$src1), |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3116 | (MOVLPSmr addr:$src1, VR128:$src2)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3117 | def : Pat<(store (v2i64 (movlp (load addr:$src1), VR128:$src2)), addr:$src1), |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3118 | (MOVLPDmr addr:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3119 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3120 | let AddedComplexity = 15 in { |
| 3121 | // Setting the lowest element in the vector. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3122 | def : Pat<(v4i32 (movl VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3123 | (MOVLPSrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3124 | def : Pat<(v2i64 (movl VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3125 | (MOVLPDrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
| 3126 | |
| 3127 | // vector_shuffle v1, v2 <4, 5, 2, 3> using MOVLPDrr (movsd) |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3128 | def : Pat<(v4f32 (movlp VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3129 | (MOVLPDrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3130 | def : Pat<(v4i32 (movlp VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3131 | (MOVLPDrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
| 3132 | } |
| 3133 | |
Eli Friedman | 27d1974 | 2009-06-19 07:00:55 +0000 | [diff] [blame] | 3134 | // vector_shuffle v1, v2 <4, 5, 2, 3> using SHUFPSrri (we prefer movsd, but |
| 3135 | // fall back to this for SSE1) |
| 3136 | def : Pat<(v4f32 (movlp:$src3 VR128:$src1, (v4f32 VR128:$src2))), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3137 | (SHUFPSrri VR128:$src2, VR128:$src1, |
Eli Friedman | 27d1974 | 2009-06-19 07:00:55 +0000 | [diff] [blame] | 3138 | (SHUFFLE_get_shuf_imm VR128:$src3))>, Requires<[HasSSE1]>; |
| 3139 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3140 | // Set lowest element and zero upper elements. |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 3141 | let AddedComplexity = 15 in |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3142 | def : Pat<(v2f64 (movl immAllZerosV_bc, VR128:$src)), |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 3143 | (MOVZPQILo2PQIrr VR128:$src)>, Requires<[HasSSE2]>; |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 3144 | def : Pat<(v2f64 (X86vzmovl (v2f64 VR128:$src))), |
Evan Cheng | d09a8a0 | 2008-05-08 22:35:02 +0000 | [diff] [blame] | 3145 | (MOVZPQILo2PQIrr VR128:$src)>, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3146 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3147 | // Some special case pandn patterns. |
| 3148 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v4i32 immAllOnesV))), |
| 3149 | VR128:$src2)), |
| 3150 | (PANDNrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
| 3151 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v8i16 immAllOnesV))), |
| 3152 | VR128:$src2)), |
| 3153 | (PANDNrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
| 3154 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v16i8 immAllOnesV))), |
| 3155 | VR128:$src2)), |
| 3156 | (PANDNrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
| 3157 | |
| 3158 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v4i32 immAllOnesV))), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3159 | (memop addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3160 | (PANDNrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
| 3161 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v8i16 immAllOnesV))), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3162 | (memop addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3163 | (PANDNrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
| 3164 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v16i8 immAllOnesV))), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3165 | (memop addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3166 | (PANDNrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
| 3167 | |
Nate Begeman | 78246ca | 2007-11-17 03:58:34 +0000 | [diff] [blame] | 3168 | // vector -> vector casts |
| 3169 | def : Pat<(v4f32 (sint_to_fp (v4i32 VR128:$src))), |
| 3170 | (Int_CVTDQ2PSrr VR128:$src)>, Requires<[HasSSE2]>; |
| 3171 | def : Pat<(v4i32 (fp_to_sint (v4f32 VR128:$src))), |
| 3172 | (Int_CVTTPS2DQrr VR128:$src)>, Requires<[HasSSE2]>; |
Eli Friedman | 7fa52ca | 2008-09-05 23:07:03 +0000 | [diff] [blame] | 3173 | def : Pat<(v2f64 (sint_to_fp (v2i32 VR64:$src))), |
| 3174 | (Int_CVTPI2PDrr VR64:$src)>, Requires<[HasSSE2]>; |
| 3175 | def : Pat<(v2i32 (fp_to_sint (v2f64 VR128:$src))), |
| 3176 | (Int_CVTTPD2PIrr VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 78246ca | 2007-11-17 03:58:34 +0000 | [diff] [blame] | 3177 | |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 3178 | // Use movaps / movups for SSE integer load / store (one byte shorter). |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 3179 | def : Pat<(alignedloadv4i32 addr:$src), |
| 3180 | (MOVAPSrm addr:$src)>, Requires<[HasSSE1]>; |
| 3181 | def : Pat<(loadv4i32 addr:$src), |
| 3182 | (MOVUPSrm addr:$src)>, Requires<[HasSSE1]>; |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 3183 | def : Pat<(alignedloadv2i64 addr:$src), |
| 3184 | (MOVAPSrm addr:$src)>, Requires<[HasSSE2]>; |
| 3185 | def : Pat<(loadv2i64 addr:$src), |
| 3186 | (MOVUPSrm addr:$src)>, Requires<[HasSSE2]>; |
| 3187 | |
| 3188 | def : Pat<(alignedstore (v2i64 VR128:$src), addr:$dst), |
| 3189 | (MOVAPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3190 | def : Pat<(alignedstore (v4i32 VR128:$src), addr:$dst), |
| 3191 | (MOVAPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3192 | def : Pat<(alignedstore (v8i16 VR128:$src), addr:$dst), |
| 3193 | (MOVAPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3194 | def : Pat<(alignedstore (v16i8 VR128:$src), addr:$dst), |
| 3195 | (MOVAPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3196 | def : Pat<(store (v2i64 VR128:$src), addr:$dst), |
| 3197 | (MOVUPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3198 | def : Pat<(store (v4i32 VR128:$src), addr:$dst), |
| 3199 | (MOVUPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3200 | def : Pat<(store (v8i16 VR128:$src), addr:$dst), |
| 3201 | (MOVUPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3202 | def : Pat<(store (v16i8 VR128:$src), addr:$dst), |
| 3203 | (MOVUPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3204 | |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3205 | //===----------------------------------------------------------------------===// |
| 3206 | // SSE4.1 Instructions |
| 3207 | //===----------------------------------------------------------------------===// |
| 3208 | |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3209 | multiclass sse41_fp_unop_rm<bits<8> opcps, bits<8> opcpd, |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3210 | string OpcodeStr, |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3211 | Intrinsic V4F32Int, |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3212 | Intrinsic V2F64Int> { |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3213 | // Intrinsic operation, reg. |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3214 | // Vector intrinsic operation, reg |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3215 | def PSr_Int : SS4AIi8<opcps, MRMSrcReg, |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3216 | (outs VR128:$dst), (ins VR128:$src1, i32i8imm:$src2), |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3217 | !strconcat(OpcodeStr, |
| 3218 | "ps\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3219 | [(set VR128:$dst, (V4F32Int VR128:$src1, imm:$src2))]>, |
| 3220 | OpSize; |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3221 | |
| 3222 | // Vector intrinsic operation, mem |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3223 | def PSm_Int : SS4AIi8<opcps, MRMSrcMem, |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3224 | (outs VR128:$dst), (ins f128mem:$src1, i32i8imm:$src2), |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3225 | !strconcat(OpcodeStr, |
| 3226 | "ps\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3227 | [(set VR128:$dst, |
| 3228 | (V4F32Int (memopv4f32 addr:$src1),imm:$src2))]>, |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3229 | OpSize; |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3230 | |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3231 | // Vector intrinsic operation, reg |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3232 | def PDr_Int : SS4AIi8<opcpd, MRMSrcReg, |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3233 | (outs VR128:$dst), (ins VR128:$src1, i32i8imm:$src2), |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3234 | !strconcat(OpcodeStr, |
| 3235 | "pd\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3236 | [(set VR128:$dst, (V2F64Int VR128:$src1, imm:$src2))]>, |
| 3237 | OpSize; |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3238 | |
| 3239 | // Vector intrinsic operation, mem |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3240 | def PDm_Int : SS4AIi8<opcpd, MRMSrcMem, |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3241 | (outs VR128:$dst), (ins f128mem:$src1, i32i8imm:$src2), |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3242 | !strconcat(OpcodeStr, |
| 3243 | "pd\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3244 | [(set VR128:$dst, |
| 3245 | (V2F64Int (memopv2f64 addr:$src1),imm:$src2))]>, |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3246 | OpSize; |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3247 | } |
| 3248 | |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3249 | let Constraints = "$src1 = $dst" in { |
| 3250 | multiclass sse41_fp_binop_rm<bits<8> opcss, bits<8> opcsd, |
| 3251 | string OpcodeStr, |
| 3252 | Intrinsic F32Int, |
| 3253 | Intrinsic F64Int> { |
| 3254 | // Intrinsic operation, reg. |
| 3255 | def SSr_Int : SS4AIi8<opcss, MRMSrcReg, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3256 | (outs VR128:$dst), |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3257 | (ins VR128:$src1, VR128:$src2, i32i8imm:$src3), |
| 3258 | !strconcat(OpcodeStr, |
| 3259 | "ss\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3260 | [(set VR128:$dst, |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3261 | (F32Int VR128:$src1, VR128:$src2, imm:$src3))]>, |
| 3262 | OpSize; |
| 3263 | |
| 3264 | // Intrinsic operation, mem. |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3265 | def SSm_Int : SS4AIi8<opcss, MRMSrcMem, |
| 3266 | (outs VR128:$dst), |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3267 | (ins VR128:$src1, ssmem:$src2, i32i8imm:$src3), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3268 | !strconcat(OpcodeStr, |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3269 | "ss\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3270 | [(set VR128:$dst, |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3271 | (F32Int VR128:$src1, sse_load_f32:$src2, imm:$src3))]>, |
| 3272 | OpSize; |
| 3273 | |
| 3274 | // Intrinsic operation, reg. |
| 3275 | def SDr_Int : SS4AIi8<opcsd, MRMSrcReg, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3276 | (outs VR128:$dst), |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3277 | (ins VR128:$src1, VR128:$src2, i32i8imm:$src3), |
| 3278 | !strconcat(OpcodeStr, |
| 3279 | "sd\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3280 | [(set VR128:$dst, |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3281 | (F64Int VR128:$src1, VR128:$src2, imm:$src3))]>, |
| 3282 | OpSize; |
| 3283 | |
| 3284 | // Intrinsic operation, mem. |
| 3285 | def SDm_Int : SS4AIi8<opcsd, MRMSrcMem, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3286 | (outs VR128:$dst), |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3287 | (ins VR128:$src1, sdmem:$src2, i32i8imm:$src3), |
| 3288 | !strconcat(OpcodeStr, |
| 3289 | "sd\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3290 | [(set VR128:$dst, |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3291 | (F64Int VR128:$src1, sse_load_f64:$src2, imm:$src3))]>, |
| 3292 | OpSize; |
| 3293 | } |
| 3294 | } |
| 3295 | |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3296 | // FP round - roundss, roundps, roundsd, roundpd |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3297 | defm ROUND : sse41_fp_unop_rm<0x08, 0x09, "round", |
| 3298 | int_x86_sse41_round_ps, int_x86_sse41_round_pd>; |
| 3299 | defm ROUND : sse41_fp_binop_rm<0x0A, 0x0B, "round", |
| 3300 | int_x86_sse41_round_ss, int_x86_sse41_round_sd>; |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3301 | |
| 3302 | // SS41I_unop_rm_int_v16 - SSE 4.1 unary operator whose type is v8i16. |
| 3303 | multiclass SS41I_unop_rm_int_v16<bits<8> opc, string OpcodeStr, |
| 3304 | Intrinsic IntId128> { |
| 3305 | def rr128 : SS48I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3306 | (ins VR128:$src), |
| 3307 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 3308 | [(set VR128:$dst, (IntId128 VR128:$src))]>, OpSize; |
| 3309 | def rm128 : SS48I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3310 | (ins i128mem:$src), |
| 3311 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 3312 | [(set VR128:$dst, |
| 3313 | (IntId128 |
| 3314 | (bitconvert (memopv8i16 addr:$src))))]>, OpSize; |
| 3315 | } |
| 3316 | |
| 3317 | defm PHMINPOSUW : SS41I_unop_rm_int_v16 <0x41, "phminposuw", |
| 3318 | int_x86_sse41_phminposuw>; |
| 3319 | |
| 3320 | /// SS41I_binop_rm_int - Simple SSE 4.1 binary operator |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3321 | let Constraints = "$src1 = $dst" in { |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3322 | multiclass SS41I_binop_rm_int<bits<8> opc, string OpcodeStr, |
| 3323 | Intrinsic IntId128, bit Commutable = 0> { |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3324 | def rr : SS48I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3325 | (ins VR128:$src1, VR128:$src2), |
| 3326 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3327 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 3328 | OpSize { |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3329 | let isCommutable = Commutable; |
| 3330 | } |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3331 | def rm : SS48I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3332 | (ins VR128:$src1, i128mem:$src2), |
| 3333 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3334 | [(set VR128:$dst, |
| 3335 | (IntId128 VR128:$src1, |
| 3336 | (bitconvert (memopv16i8 addr:$src2))))]>, OpSize; |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3337 | } |
| 3338 | } |
| 3339 | |
| 3340 | defm PCMPEQQ : SS41I_binop_rm_int<0x29, "pcmpeqq", |
| 3341 | int_x86_sse41_pcmpeqq, 1>; |
| 3342 | defm PACKUSDW : SS41I_binop_rm_int<0x2B, "packusdw", |
| 3343 | int_x86_sse41_packusdw, 0>; |
| 3344 | defm PMINSB : SS41I_binop_rm_int<0x38, "pminsb", |
| 3345 | int_x86_sse41_pminsb, 1>; |
| 3346 | defm PMINSD : SS41I_binop_rm_int<0x39, "pminsd", |
| 3347 | int_x86_sse41_pminsd, 1>; |
| 3348 | defm PMINUD : SS41I_binop_rm_int<0x3B, "pminud", |
| 3349 | int_x86_sse41_pminud, 1>; |
| 3350 | defm PMINUW : SS41I_binop_rm_int<0x3A, "pminuw", |
| 3351 | int_x86_sse41_pminuw, 1>; |
| 3352 | defm PMAXSB : SS41I_binop_rm_int<0x3C, "pmaxsb", |
| 3353 | int_x86_sse41_pmaxsb, 1>; |
| 3354 | defm PMAXSD : SS41I_binop_rm_int<0x3D, "pmaxsd", |
| 3355 | int_x86_sse41_pmaxsd, 1>; |
| 3356 | defm PMAXUD : SS41I_binop_rm_int<0x3F, "pmaxud", |
| 3357 | int_x86_sse41_pmaxud, 1>; |
| 3358 | defm PMAXUW : SS41I_binop_rm_int<0x3E, "pmaxuw", |
| 3359 | int_x86_sse41_pmaxuw, 1>; |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3360 | |
Mon P Wang | 14edb09 | 2008-12-18 21:42:19 +0000 | [diff] [blame] | 3361 | defm PMULDQ : SS41I_binop_rm_int<0x28, "pmuldq", int_x86_sse41_pmuldq, 1>; |
| 3362 | |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 3363 | def : Pat<(v2i64 (X86pcmpeqq VR128:$src1, VR128:$src2)), |
| 3364 | (PCMPEQQrr VR128:$src1, VR128:$src2)>; |
| 3365 | def : Pat<(v2i64 (X86pcmpeqq VR128:$src1, (memop addr:$src2))), |
| 3366 | (PCMPEQQrm VR128:$src1, addr:$src2)>; |
| 3367 | |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3368 | /// SS41I_binop_rm_int - Simple SSE 4.1 binary operator |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3369 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | e3731f5 | 2008-05-23 17:49:40 +0000 | [diff] [blame] | 3370 | multiclass SS41I_binop_patint<bits<8> opc, string OpcodeStr, ValueType OpVT, |
| 3371 | SDNode OpNode, Intrinsic IntId128, |
| 3372 | bit Commutable = 0> { |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3373 | def rr : SS48I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3374 | (ins VR128:$src1, VR128:$src2), |
| 3375 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | e3731f5 | 2008-05-23 17:49:40 +0000 | [diff] [blame] | 3376 | [(set VR128:$dst, (OpNode (OpVT VR128:$src1), |
| 3377 | VR128:$src2))]>, OpSize { |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3378 | let isCommutable = Commutable; |
| 3379 | } |
| 3380 | def rr_int : SS48I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3381 | (ins VR128:$src1, VR128:$src2), |
| 3382 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3383 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 3384 | OpSize { |
| 3385 | let isCommutable = Commutable; |
| 3386 | } |
| 3387 | def rm : SS48I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3388 | (ins VR128:$src1, i128mem:$src2), |
| 3389 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3390 | [(set VR128:$dst, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3391 | (OpNode VR128:$src1, (memop addr:$src2)))]>, OpSize; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3392 | def rm_int : SS48I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3393 | (ins VR128:$src1, i128mem:$src2), |
| 3394 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3395 | [(set VR128:$dst, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3396 | (IntId128 VR128:$src1, (memop addr:$src2)))]>, |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3397 | OpSize; |
| 3398 | } |
| 3399 | } |
Dan Gohman | e3731f5 | 2008-05-23 17:49:40 +0000 | [diff] [blame] | 3400 | defm PMULLD : SS41I_binop_patint<0x40, "pmulld", v4i32, mul, |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3401 | int_x86_sse41_pmulld, 1>; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3402 | |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3403 | /// 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] | 3404 | let Constraints = "$src1 = $dst" in { |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3405 | multiclass SS41I_binop_rmi_int<bits<8> opc, string OpcodeStr, |
| 3406 | Intrinsic IntId128, bit Commutable = 0> { |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3407 | def rri : SS4AIi8<opc, MRMSrcReg, (outs VR128:$dst), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3408 | (ins VR128:$src1, VR128:$src2, i32i8imm:$src3), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3409 | !strconcat(OpcodeStr, |
Nate Begeman | b4e9a04 | 2008-02-10 18:47:57 +0000 | [diff] [blame] | 3410 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3411 | [(set VR128:$dst, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3412 | (IntId128 VR128:$src1, VR128:$src2, imm:$src3))]>, |
| 3413 | OpSize { |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3414 | let isCommutable = Commutable; |
| 3415 | } |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3416 | def rmi : SS4AIi8<opc, MRMSrcMem, (outs VR128:$dst), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3417 | (ins VR128:$src1, i128mem:$src2, i32i8imm:$src3), |
| 3418 | !strconcat(OpcodeStr, |
Nate Begeman | b4e9a04 | 2008-02-10 18:47:57 +0000 | [diff] [blame] | 3419 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3420 | [(set VR128:$dst, |
| 3421 | (IntId128 VR128:$src1, |
| 3422 | (bitconvert (memopv16i8 addr:$src2)), imm:$src3))]>, |
| 3423 | OpSize; |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3424 | } |
| 3425 | } |
| 3426 | |
| 3427 | defm BLENDPS : SS41I_binop_rmi_int<0x0C, "blendps", |
| 3428 | int_x86_sse41_blendps, 0>; |
| 3429 | defm BLENDPD : SS41I_binop_rmi_int<0x0D, "blendpd", |
| 3430 | int_x86_sse41_blendpd, 0>; |
| 3431 | defm PBLENDW : SS41I_binop_rmi_int<0x0E, "pblendw", |
| 3432 | int_x86_sse41_pblendw, 0>; |
| 3433 | defm DPPS : SS41I_binop_rmi_int<0x40, "dpps", |
| 3434 | int_x86_sse41_dpps, 1>; |
| 3435 | defm DPPD : SS41I_binop_rmi_int<0x41, "dppd", |
| 3436 | int_x86_sse41_dppd, 1>; |
| 3437 | defm MPSADBW : SS41I_binop_rmi_int<0x42, "mpsadbw", |
Evan Cheng | 81ed985 | 2008-06-16 20:25:59 +0000 | [diff] [blame] | 3438 | int_x86_sse41_mpsadbw, 1>; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3439 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3440 | |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3441 | /// SS41I_ternary_int - SSE 4.1 ternary operator |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3442 | let Uses = [XMM0], Constraints = "$src1 = $dst" in { |
Nate Begeman | b4e9a04 | 2008-02-10 18:47:57 +0000 | [diff] [blame] | 3443 | multiclass SS41I_ternary_int<bits<8> opc, string OpcodeStr, Intrinsic IntId> { |
| 3444 | def rr0 : SS48I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3445 | (ins VR128:$src1, VR128:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3446 | !strconcat(OpcodeStr, |
Nate Begeman | b4e9a04 | 2008-02-10 18:47:57 +0000 | [diff] [blame] | 3447 | "\t{%xmm0, $src2, $dst|$dst, $src2, %xmm0}"), |
| 3448 | [(set VR128:$dst, (IntId VR128:$src1, VR128:$src2, XMM0))]>, |
| 3449 | OpSize; |
| 3450 | |
| 3451 | def rm0 : SS48I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3452 | (ins VR128:$src1, i128mem:$src2), |
| 3453 | !strconcat(OpcodeStr, |
| 3454 | "\t{%xmm0, $src2, $dst|$dst, $src2, %xmm0}"), |
| 3455 | [(set VR128:$dst, |
| 3456 | (IntId VR128:$src1, |
| 3457 | (bitconvert (memopv16i8 addr:$src2)), XMM0))]>, OpSize; |
| 3458 | } |
| 3459 | } |
| 3460 | |
| 3461 | defm BLENDVPD : SS41I_ternary_int<0x15, "blendvpd", int_x86_sse41_blendvpd>; |
| 3462 | defm BLENDVPS : SS41I_ternary_int<0x14, "blendvps", int_x86_sse41_blendvps>; |
| 3463 | defm PBLENDVB : SS41I_ternary_int<0x10, "pblendvb", int_x86_sse41_pblendvb>; |
| 3464 | |
| 3465 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3466 | multiclass SS41I_binop_rm_int8<bits<8> opc, string OpcodeStr, Intrinsic IntId> { |
| 3467 | def rr : SS48I<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 3468 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 3469 | [(set VR128:$dst, (IntId VR128:$src))]>, OpSize; |
| 3470 | |
| 3471 | def rm : SS48I<opc, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), |
| 3472 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3473 | [(set VR128:$dst, |
| 3474 | (IntId (bitconvert (v2i64 (scalar_to_vector (loadi64 addr:$src))))))]>, |
| 3475 | OpSize; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3476 | } |
| 3477 | |
| 3478 | defm PMOVSXBW : SS41I_binop_rm_int8<0x20, "pmovsxbw", int_x86_sse41_pmovsxbw>; |
| 3479 | defm PMOVSXWD : SS41I_binop_rm_int8<0x23, "pmovsxwd", int_x86_sse41_pmovsxwd>; |
| 3480 | defm PMOVSXDQ : SS41I_binop_rm_int8<0x25, "pmovsxdq", int_x86_sse41_pmovsxdq>; |
| 3481 | defm PMOVZXBW : SS41I_binop_rm_int8<0x30, "pmovzxbw", int_x86_sse41_pmovzxbw>; |
| 3482 | defm PMOVZXWD : SS41I_binop_rm_int8<0x33, "pmovzxwd", int_x86_sse41_pmovzxwd>; |
| 3483 | defm PMOVZXDQ : SS41I_binop_rm_int8<0x35, "pmovzxdq", int_x86_sse41_pmovzxdq>; |
| 3484 | |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3485 | // Common patterns involving scalar load. |
| 3486 | def : Pat<(int_x86_sse41_pmovsxbw (vzmovl_v2i64 addr:$src)), |
| 3487 | (PMOVSXBWrm addr:$src)>, Requires<[HasSSE41]>; |
| 3488 | def : Pat<(int_x86_sse41_pmovsxbw (vzload_v2i64 addr:$src)), |
| 3489 | (PMOVSXBWrm addr:$src)>, Requires<[HasSSE41]>; |
| 3490 | |
| 3491 | def : Pat<(int_x86_sse41_pmovsxwd (vzmovl_v2i64 addr:$src)), |
| 3492 | (PMOVSXWDrm addr:$src)>, Requires<[HasSSE41]>; |
| 3493 | def : Pat<(int_x86_sse41_pmovsxwd (vzload_v2i64 addr:$src)), |
| 3494 | (PMOVSXWDrm addr:$src)>, Requires<[HasSSE41]>; |
| 3495 | |
| 3496 | def : Pat<(int_x86_sse41_pmovsxdq (vzmovl_v2i64 addr:$src)), |
| 3497 | (PMOVSXDQrm addr:$src)>, Requires<[HasSSE41]>; |
| 3498 | def : Pat<(int_x86_sse41_pmovsxdq (vzload_v2i64 addr:$src)), |
| 3499 | (PMOVSXDQrm addr:$src)>, Requires<[HasSSE41]>; |
| 3500 | |
| 3501 | def : Pat<(int_x86_sse41_pmovzxbw (vzmovl_v2i64 addr:$src)), |
| 3502 | (PMOVZXBWrm addr:$src)>, Requires<[HasSSE41]>; |
| 3503 | def : Pat<(int_x86_sse41_pmovzxbw (vzload_v2i64 addr:$src)), |
| 3504 | (PMOVZXBWrm addr:$src)>, Requires<[HasSSE41]>; |
| 3505 | |
| 3506 | def : Pat<(int_x86_sse41_pmovzxwd (vzmovl_v2i64 addr:$src)), |
| 3507 | (PMOVZXWDrm addr:$src)>, Requires<[HasSSE41]>; |
| 3508 | def : Pat<(int_x86_sse41_pmovzxwd (vzload_v2i64 addr:$src)), |
| 3509 | (PMOVZXWDrm addr:$src)>, Requires<[HasSSE41]>; |
| 3510 | |
| 3511 | def : Pat<(int_x86_sse41_pmovzxdq (vzmovl_v2i64 addr:$src)), |
| 3512 | (PMOVZXDQrm addr:$src)>, Requires<[HasSSE41]>; |
| 3513 | def : Pat<(int_x86_sse41_pmovzxdq (vzload_v2i64 addr:$src)), |
| 3514 | (PMOVZXDQrm addr:$src)>, Requires<[HasSSE41]>; |
| 3515 | |
| 3516 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3517 | multiclass SS41I_binop_rm_int4<bits<8> opc, string OpcodeStr, Intrinsic IntId> { |
| 3518 | def rr : SS48I<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 3519 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 3520 | [(set VR128:$dst, (IntId VR128:$src))]>, OpSize; |
| 3521 | |
| 3522 | def rm : SS48I<opc, MRMSrcMem, (outs VR128:$dst), (ins i32mem:$src), |
| 3523 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3524 | [(set VR128:$dst, |
| 3525 | (IntId (bitconvert (v4i32 (scalar_to_vector (loadi32 addr:$src))))))]>, |
| 3526 | OpSize; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3527 | } |
| 3528 | |
| 3529 | defm PMOVSXBD : SS41I_binop_rm_int4<0x21, "pmovsxbd", int_x86_sse41_pmovsxbd>; |
| 3530 | defm PMOVSXWQ : SS41I_binop_rm_int4<0x24, "pmovsxwq", int_x86_sse41_pmovsxwq>; |
| 3531 | defm PMOVZXBD : SS41I_binop_rm_int4<0x31, "pmovzxbd", int_x86_sse41_pmovzxbd>; |
| 3532 | defm PMOVZXWQ : SS41I_binop_rm_int4<0x34, "pmovzxwq", int_x86_sse41_pmovzxwq>; |
| 3533 | |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3534 | // Common patterns involving scalar load |
| 3535 | def : Pat<(int_x86_sse41_pmovsxbd (vzmovl_v4i32 addr:$src)), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3536 | (PMOVSXBDrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3537 | def : Pat<(int_x86_sse41_pmovsxwq (vzmovl_v4i32 addr:$src)), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3538 | (PMOVSXWQrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3539 | |
| 3540 | def : Pat<(int_x86_sse41_pmovzxbd (vzmovl_v4i32 addr:$src)), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3541 | (PMOVZXBDrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3542 | def : Pat<(int_x86_sse41_pmovzxwq (vzmovl_v4i32 addr:$src)), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3543 | (PMOVZXWQrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3544 | |
| 3545 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3546 | multiclass SS41I_binop_rm_int2<bits<8> opc, string OpcodeStr, Intrinsic IntId> { |
| 3547 | def rr : SS48I<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 3548 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 3549 | [(set VR128:$dst, (IntId VR128:$src))]>, OpSize; |
| 3550 | |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3551 | // Expecting a i16 load any extended to i32 value. |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3552 | def rm : SS48I<opc, MRMSrcMem, (outs VR128:$dst), (ins i16mem:$src), |
| 3553 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3554 | [(set VR128:$dst, (IntId (bitconvert |
| 3555 | (v4i32 (scalar_to_vector (loadi16_anyext addr:$src))))))]>, |
| 3556 | OpSize; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3557 | } |
| 3558 | |
| 3559 | defm PMOVSXBQ : SS41I_binop_rm_int2<0x22, "pmovsxbq", int_x86_sse41_pmovsxbq>; |
Eli Friedman | 75a89d6 | 2009-06-06 05:55:37 +0000 | [diff] [blame] | 3560 | defm PMOVZXBQ : SS41I_binop_rm_int2<0x32, "pmovzxbq", int_x86_sse41_pmovzxbq>; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3561 | |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3562 | // Common patterns involving scalar load |
| 3563 | def : Pat<(int_x86_sse41_pmovsxbq |
| 3564 | (bitconvert (v4i32 (X86vzmovl |
| 3565 | (v4i32 (scalar_to_vector (loadi32 addr:$src))))))), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3566 | (PMOVSXBQrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3567 | |
| 3568 | def : Pat<(int_x86_sse41_pmovzxbq |
| 3569 | (bitconvert (v4i32 (X86vzmovl |
| 3570 | (v4i32 (scalar_to_vector (loadi32 addr:$src))))))), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3571 | (PMOVZXBQrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3572 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3573 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3574 | /// SS41I_binop_ext8 - SSE 4.1 extract 8 bits to 32 bit reg or 8 bit mem |
| 3575 | multiclass SS41I_extract8<bits<8> opc, string OpcodeStr> { |
Evan Cheng | c2054be | 2008-03-26 08:11:49 +0000 | [diff] [blame] | 3576 | def rr : SS4AIi8<opc, MRMDestReg, (outs GR32:$dst), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3577 | (ins VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3578 | !strconcat(OpcodeStr, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3579 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3580 | [(set GR32:$dst, (X86pextrb (v16i8 VR128:$src1), imm:$src2))]>, |
| 3581 | OpSize; |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3582 | def mr : SS4AIi8<opc, MRMDestMem, (outs), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3583 | (ins i8mem:$dst, VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3584 | !strconcat(OpcodeStr, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3585 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3586 | []>, OpSize; |
| 3587 | // FIXME: |
| 3588 | // There's an AssertZext in the way of writing the store pattern |
| 3589 | // (store (i8 (trunc (X86pextrb (v16i8 VR128:$src1), imm:$src2))), addr:$dst) |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3590 | } |
| 3591 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3592 | defm PEXTRB : SS41I_extract8<0x14, "pextrb">; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3593 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3594 | |
| 3595 | /// SS41I_extract16 - SSE 4.1 extract 16 bits to memory destination |
| 3596 | multiclass SS41I_extract16<bits<8> opc, string OpcodeStr> { |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3597 | def mr : SS4AIi8<opc, MRMDestMem, (outs), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3598 | (ins i16mem:$dst, VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3599 | !strconcat(OpcodeStr, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3600 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
| 3601 | []>, OpSize; |
| 3602 | // FIXME: |
| 3603 | // There's an AssertZext in the way of writing the store pattern |
| 3604 | // (store (i16 (trunc (X86pextrw (v16i8 VR128:$src1), imm:$src2))), addr:$dst) |
| 3605 | } |
| 3606 | |
| 3607 | defm PEXTRW : SS41I_extract16<0x15, "pextrw">; |
| 3608 | |
| 3609 | |
| 3610 | /// SS41I_extract32 - SSE 4.1 extract 32 bits to int reg or memory destination |
| 3611 | multiclass SS41I_extract32<bits<8> opc, string OpcodeStr> { |
Evan Cheng | c2054be | 2008-03-26 08:11:49 +0000 | [diff] [blame] | 3612 | def rr : SS4AIi8<opc, MRMDestReg, (outs GR32:$dst), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3613 | (ins 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}"), |
| 3616 | [(set GR32:$dst, |
| 3617 | (extractelt (v4i32 VR128:$src1), imm:$src2))]>, OpSize; |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3618 | def mr : SS4AIi8<opc, MRMDestMem, (outs), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3619 | (ins i32mem:$dst, VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3620 | !strconcat(OpcodeStr, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3621 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
| 3622 | [(store (extractelt (v4i32 VR128:$src1), imm:$src2), |
| 3623 | addr:$dst)]>, OpSize; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3624 | } |
| 3625 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3626 | defm PEXTRD : SS41I_extract32<0x16, "pextrd">; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3627 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3628 | |
Evan Cheng | 6c24933 | 2008-03-24 21:52:23 +0000 | [diff] [blame] | 3629 | /// SS41I_extractf32 - SSE 4.1 extract 32 bits fp value to int reg or memory |
| 3630 | /// destination |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3631 | multiclass SS41I_extractf32<bits<8> opc, string OpcodeStr> { |
Evan Cheng | c2054be | 2008-03-26 08:11:49 +0000 | [diff] [blame] | 3632 | def rr : SS4AIi8<opc, MRMDestReg, (outs GR32:$dst), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3633 | (ins VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3634 | !strconcat(OpcodeStr, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3635 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Dan Gohman | 788db59 | 2008-04-16 02:32:24 +0000 | [diff] [blame] | 3636 | [(set GR32:$dst, |
| 3637 | (extractelt (bc_v4i32 (v4f32 VR128:$src1)), imm:$src2))]>, |
Evan Cheng | 6c24933 | 2008-03-24 21:52:23 +0000 | [diff] [blame] | 3638 | OpSize; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3639 | def mr : SS4AIi8<opc, MRMDestMem, (outs), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3640 | (ins f32mem:$dst, VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3641 | !strconcat(OpcodeStr, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3642 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Evan Cheng | 6c24933 | 2008-03-24 21:52:23 +0000 | [diff] [blame] | 3643 | [(store (extractelt (bc_v4i32 (v4f32 VR128:$src1)), imm:$src2), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3644 | addr:$dst)]>, OpSize; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3645 | } |
| 3646 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3647 | defm EXTRACTPS : SS41I_extractf32<0x17, "extractps">; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3648 | |
Dan Gohman | a41862a | 2008-08-08 18:30:21 +0000 | [diff] [blame] | 3649 | // Also match an EXTRACTPS store when the store is done as f32 instead of i32. |
| 3650 | def : Pat<(store (f32 (bitconvert (extractelt (bc_v4i32 (v4f32 VR128:$src1)), |
| 3651 | imm:$src2))), |
| 3652 | addr:$dst), |
| 3653 | (EXTRACTPSmr addr:$dst, VR128:$src1, imm:$src2)>, |
| 3654 | Requires<[HasSSE41]>; |
| 3655 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3656 | let Constraints = "$src1 = $dst" in { |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3657 | multiclass SS41I_insert8<bits<8> opc, string OpcodeStr> { |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3658 | def rr : SS4AIi8<opc, MRMSrcReg, (outs VR128:$dst), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3659 | (ins VR128:$src1, GR32:$src2, i32i8imm:$src3), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3660 | !strconcat(OpcodeStr, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 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 | (X86pinsrb VR128:$src1, GR32:$src2, imm:$src3))]>, OpSize; |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3664 | def rm : SS4AIi8<opc, MRMSrcMem, (outs VR128:$dst), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3665 | (ins VR128:$src1, i8mem:$src2, i32i8imm:$src3), |
| 3666 | !strconcat(OpcodeStr, |
| 3667 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3668 | [(set VR128:$dst, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3669 | (X86pinsrb VR128:$src1, (extloadi8 addr:$src2), |
| 3670 | imm:$src3))]>, OpSize; |
| 3671 | } |
| 3672 | } |
| 3673 | |
| 3674 | defm PINSRB : SS41I_insert8<0x20, "pinsrb">; |
| 3675 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3676 | let Constraints = "$src1 = $dst" in { |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3677 | multiclass SS41I_insert32<bits<8> opc, string OpcodeStr> { |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3678 | def rr : SS4AIi8<opc, MRMSrcReg, (outs VR128:$dst), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3679 | (ins VR128:$src1, GR32:$src2, i32i8imm:$src3), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3680 | !strconcat(OpcodeStr, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3681 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3682 | [(set VR128:$dst, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3683 | (v4i32 (insertelt VR128:$src1, GR32:$src2, imm:$src3)))]>, |
| 3684 | OpSize; |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3685 | def rm : SS4AIi8<opc, MRMSrcMem, (outs VR128:$dst), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3686 | (ins VR128:$src1, i32mem:$src2, i32i8imm:$src3), |
| 3687 | !strconcat(OpcodeStr, |
| 3688 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3689 | [(set VR128:$dst, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3690 | (v4i32 (insertelt VR128:$src1, (loadi32 addr:$src2), |
| 3691 | imm:$src3)))]>, OpSize; |
| 3692 | } |
| 3693 | } |
| 3694 | |
| 3695 | defm PINSRD : SS41I_insert32<0x22, "pinsrd">; |
| 3696 | |
Eric Christopher | a044360 | 2009-07-23 02:22:41 +0000 | [diff] [blame] | 3697 | // insertps has a few different modes, there's the first two here below which |
| 3698 | // are optimized inserts that won't zero arbitrary elements in the destination |
| 3699 | // vector. The next one matches the intrinsic and could zero arbitrary elements |
| 3700 | // in the target vector. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3701 | let Constraints = "$src1 = $dst" in { |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3702 | multiclass SS41I_insertf32<bits<8> opc, string OpcodeStr> { |
Eric Christopher | efb657e | 2009-07-24 00:33:09 +0000 | [diff] [blame] | 3703 | def rr : SS4AIi8<opc, MRMSrcReg, (outs VR128:$dst), |
| 3704 | (ins VR128:$src1, VR128:$src2, i32i8imm:$src3), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3705 | !strconcat(OpcodeStr, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3706 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3707 | [(set VR128:$dst, |
| 3708 | (X86insrtps VR128:$src1, VR128:$src2, imm:$src3))]>, |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3709 | OpSize; |
Eric Christopher | efb657e | 2009-07-24 00:33:09 +0000 | [diff] [blame] | 3710 | def rm : SS4AIi8<opc, MRMSrcMem, (outs VR128:$dst), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3711 | (ins VR128:$src1, f32mem:$src2, i32i8imm:$src3), |
| 3712 | !strconcat(OpcodeStr, |
| 3713 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3714 | [(set VR128:$dst, |
Eric Christopher | efb657e | 2009-07-24 00:33:09 +0000 | [diff] [blame] | 3715 | (X86insrtps VR128:$src1, |
| 3716 | (v4f32 (scalar_to_vector (loadf32 addr:$src2))), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3717 | imm:$src3))]>, OpSize; |
| 3718 | } |
| 3719 | } |
| 3720 | |
Evan Cheng | c2054be | 2008-03-26 08:11:49 +0000 | [diff] [blame] | 3721 | defm INSERTPS : SS41I_insertf32<0x21, "insertps">; |
Nate Begeman | 0dd3cb5 | 2008-03-16 21:14:46 +0000 | [diff] [blame] | 3722 | |
Eric Christopher | efb657e | 2009-07-24 00:33:09 +0000 | [diff] [blame] | 3723 | def : Pat<(int_x86_sse41_insertps VR128:$src1, VR128:$src2, imm:$src3), |
| 3724 | (INSERTPSrr VR128:$src1, VR128:$src2, imm:$src3)>; |
| 3725 | |
Eric Christopher | 95d7926 | 2009-07-29 00:28:05 +0000 | [diff] [blame] | 3726 | // ptest instruction we'll lower to this in X86ISelLowering primarily from |
| 3727 | // the intel intrinsic that corresponds to this. |
Nate Begeman | 0dd3cb5 | 2008-03-16 21:14:46 +0000 | [diff] [blame] | 3728 | let Defs = [EFLAGS] in { |
| 3729 | def PTESTrr : SS48I<0x17, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
Eric Christopher | 95d7926 | 2009-07-29 00:28:05 +0000 | [diff] [blame] | 3730 | "ptest \t{$src2, $src1|$src1, $src2}", |
| 3731 | [(X86ptest VR128:$src1, VR128:$src2), |
| 3732 | (implicit EFLAGS)]>, OpSize; |
Nate Begeman | 0dd3cb5 | 2008-03-16 21:14:46 +0000 | [diff] [blame] | 3733 | def PTESTrm : SS48I<0x17, MRMSrcMem, (outs), (ins VR128:$src1, i128mem:$src2), |
Eric Christopher | 95d7926 | 2009-07-29 00:28:05 +0000 | [diff] [blame] | 3734 | "ptest \t{$src2, $src1|$src1, $src2}", |
| 3735 | [(X86ptest VR128:$src1, (load addr:$src2)), |
| 3736 | (implicit EFLAGS)]>, OpSize; |
Nate Begeman | 0dd3cb5 | 2008-03-16 21:14:46 +0000 | [diff] [blame] | 3737 | } |
| 3738 | |
| 3739 | def MOVNTDQArm : SS48I<0x2A, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
| 3740 | "movntdqa\t{$src, $dst|$dst, $src}", |
| 3741 | [(set VR128:$dst, (int_x86_sse41_movntdqa addr:$src))]>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 3742 | |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3743 | |
| 3744 | //===----------------------------------------------------------------------===// |
| 3745 | // SSE4.2 Instructions |
| 3746 | //===----------------------------------------------------------------------===// |
| 3747 | |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 3748 | /// SS42I_binop_rm_int - Simple SSE 4.2 binary operator |
| 3749 | let Constraints = "$src1 = $dst" in { |
| 3750 | multiclass SS42I_binop_rm_int<bits<8> opc, string OpcodeStr, |
| 3751 | Intrinsic IntId128, bit Commutable = 0> { |
| 3752 | def rr : SS428I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3753 | (ins VR128:$src1, VR128:$src2), |
| 3754 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3755 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 3756 | OpSize { |
| 3757 | let isCommutable = Commutable; |
| 3758 | } |
| 3759 | def rm : SS428I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3760 | (ins VR128:$src1, i128mem:$src2), |
| 3761 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3762 | [(set VR128:$dst, |
| 3763 | (IntId128 VR128:$src1, |
| 3764 | (bitconvert (memopv16i8 addr:$src2))))]>, OpSize; |
| 3765 | } |
| 3766 | } |
| 3767 | |
Nate Begeman | 235666b | 2008-07-17 17:04:58 +0000 | [diff] [blame] | 3768 | defm PCMPGTQ : SS42I_binop_rm_int<0x37, "pcmpgtq", int_x86_sse42_pcmpgtq>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 3769 | |
| 3770 | def : Pat<(v2i64 (X86pcmpgtq VR128:$src1, VR128:$src2)), |
| 3771 | (PCMPGTQrr VR128:$src1, VR128:$src2)>; |
| 3772 | def : Pat<(v2i64 (X86pcmpgtq VR128:$src1, (memop addr:$src2))), |
| 3773 | (PCMPGTQrm VR128:$src1, addr:$src2)>; |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3774 | |
| 3775 | // crc intrinsic instruction |
| 3776 | // This set of instructions are only rm, the only difference is the size |
| 3777 | // of r and m. |
| 3778 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3779 | def CRC32m8 : SS42FI<0xF0, MRMSrcMem, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3780 | (ins GR32:$src1, i8mem:$src2), |
| 3781 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3782 | [(set GR32:$dst, |
| 3783 | (int_x86_sse42_crc32_8 GR32:$src1, |
| 3784 | (load addr:$src2)))]>, OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3785 | def CRC32r8 : SS42FI<0xF0, MRMSrcReg, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3786 | (ins GR32:$src1, GR8:$src2), |
| 3787 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3788 | [(set GR32:$dst, |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3789 | (int_x86_sse42_crc32_8 GR32:$src1, GR8:$src2))]>, |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3790 | OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3791 | def CRC32m16 : SS42FI<0xF1, MRMSrcMem, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3792 | (ins GR32:$src1, i16mem:$src2), |
| 3793 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3794 | [(set GR32:$dst, |
| 3795 | (int_x86_sse42_crc32_16 GR32:$src1, |
| 3796 | (load addr:$src2)))]>, |
| 3797 | OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3798 | def CRC32r16 : SS42FI<0xF1, MRMSrcReg, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3799 | (ins GR32:$src1, GR16:$src2), |
| 3800 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3801 | [(set GR32:$dst, |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3802 | (int_x86_sse42_crc32_16 GR32:$src1, GR16:$src2))]>, |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3803 | OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3804 | def CRC32m32 : SS42FI<0xF1, MRMSrcMem, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3805 | (ins GR32:$src1, i32mem:$src2), |
| 3806 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3807 | [(set GR32:$dst, |
| 3808 | (int_x86_sse42_crc32_32 GR32:$src1, |
| 3809 | (load addr:$src2)))]>, OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3810 | def CRC32r32 : SS42FI<0xF1, MRMSrcReg, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3811 | (ins GR32:$src1, GR32:$src2), |
| 3812 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3813 | [(set GR32:$dst, |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3814 | (int_x86_sse42_crc32_32 GR32:$src1, GR32:$src2))]>, |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3815 | OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3816 | def CRC64m64 : SS42FI<0xF0, MRMSrcMem, (outs GR64:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3817 | (ins GR64:$src1, i64mem:$src2), |
| 3818 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3819 | [(set GR64:$dst, |
| 3820 | (int_x86_sse42_crc32_64 GR64:$src1, |
| 3821 | (load addr:$src2)))]>, |
| 3822 | OpSize, REX_W; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3823 | def CRC64r64 : SS42FI<0xF0, MRMSrcReg, (outs GR64:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3824 | (ins GR64:$src1, GR64:$src2), |
| 3825 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3826 | [(set GR64:$dst, |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3827 | (int_x86_sse42_crc32_64 GR64:$src1, GR64:$src2))]>, |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3828 | OpSize, REX_W; |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3829 | } |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3830 | |
| 3831 | // String/text processing instructions. |
Dan Gohman | 30afe01 | 2009-10-29 18:10:34 +0000 | [diff] [blame] | 3832 | let Defs = [EFLAGS], usesCustomInserter = 1 in { |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3833 | def PCMPISTRM128REG : SS42AI<0, Pseudo, (outs VR128:$dst), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3834 | (ins VR128:$src1, VR128:$src2, i8imm:$src3), |
| 3835 | "#PCMPISTRM128rr PSEUDO!", |
| 3836 | [(set VR128:$dst, (int_x86_sse42_pcmpistrm128 VR128:$src1, VR128:$src2, |
| 3837 | imm:$src3))]>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3838 | def PCMPISTRM128MEM : SS42AI<0, Pseudo, (outs VR128:$dst), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3839 | (ins VR128:$src1, i128mem:$src2, i8imm:$src3), |
| 3840 | "#PCMPISTRM128rm PSEUDO!", |
| 3841 | [(set VR128:$dst, (int_x86_sse42_pcmpistrm128 VR128:$src1, (load addr:$src2), |
| 3842 | imm:$src3))]>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3843 | } |
| 3844 | |
| 3845 | let Defs = [XMM0, EFLAGS] in { |
| 3846 | def PCMPISTRM128rr : SS42AI<0x62, MRMSrcReg, (outs), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3847 | (ins VR128:$src1, VR128:$src2, i8imm:$src3), |
| 3848 | "pcmpistrm\t{$src3, $src2, $src1|$src1, $src2, $src3}", []>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3849 | def PCMPISTRM128rm : SS42AI<0x62, MRMSrcMem, (outs), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3850 | (ins VR128:$src1, i128mem:$src2, i8imm:$src3), |
| 3851 | "pcmpistrm\t{$src3, $src2, $src1|$src1, $src2, $src3}", []>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3852 | } |
| 3853 | |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3854 | let Defs = [EFLAGS], Uses = [EAX, EDX], usesCustomInserter = 1 in { |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3855 | def PCMPESTRM128REG : SS42AI<0, Pseudo, (outs VR128:$dst), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3856 | (ins VR128:$src1, VR128:$src3, i8imm:$src5), |
| 3857 | "#PCMPESTRM128rr PSEUDO!", |
| 3858 | [(set VR128:$dst, |
| 3859 | (int_x86_sse42_pcmpestrm128 |
| 3860 | VR128:$src1, EAX, VR128:$src3, EDX, imm:$src5))]>, OpSize; |
| 3861 | |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3862 | def PCMPESTRM128MEM : SS42AI<0, Pseudo, (outs VR128:$dst), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3863 | (ins VR128:$src1, i128mem:$src3, i8imm:$src5), |
| 3864 | "#PCMPESTRM128rm PSEUDO!", |
| 3865 | [(set VR128:$dst, (int_x86_sse42_pcmpestrm128 |
| 3866 | VR128:$src1, EAX, (load addr:$src3), EDX, imm:$src5))]>, |
| 3867 | OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3868 | } |
| 3869 | |
| 3870 | let Defs = [XMM0, EFLAGS], Uses = [EAX, EDX] in { |
Sean Callanan | c5a05b7 | 2009-08-20 18:24:27 +0000 | [diff] [blame] | 3871 | def PCMPESTRM128rr : SS42AI<0x60, MRMSrcReg, (outs), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3872 | (ins VR128:$src1, VR128:$src3, i8imm:$src5), |
| 3873 | "pcmpestrm\t{$src5, $src3, $src1|$src1, $src3, $src5}", []>, OpSize; |
Sean Callanan | c5a05b7 | 2009-08-20 18:24:27 +0000 | [diff] [blame] | 3874 | def PCMPESTRM128rm : SS42AI<0x60, MRMSrcMem, (outs), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3875 | (ins VR128:$src1, i128mem:$src3, i8imm:$src5), |
| 3876 | "pcmpestrm\t{$src5, $src3, $src1|$src1, $src3, $src5}", []>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3877 | } |
| 3878 | |
| 3879 | let Defs = [ECX, EFLAGS] in { |
| 3880 | multiclass SS42AI_pcmpistri<Intrinsic IntId128> { |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3881 | def rr : SS42AI<0x63, MRMSrcReg, (outs), |
| 3882 | (ins VR128:$src1, VR128:$src2, i8imm:$src3), |
| 3883 | "pcmpistri\t{$src3, $src2, $src1|$src1, $src2, $src3}", |
| 3884 | [(set ECX, (IntId128 VR128:$src1, VR128:$src2, imm:$src3)), |
| 3885 | (implicit EFLAGS)]>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3886 | def rm : SS42AI<0x63, MRMSrcMem, (outs), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3887 | (ins VR128:$src1, i128mem:$src2, i8imm:$src3), |
| 3888 | "pcmpistri\t{$src3, $src2, $src1|$src1, $src2, $src3}", |
| 3889 | [(set ECX, (IntId128 VR128:$src1, (load addr:$src2), imm:$src3)), |
| 3890 | (implicit EFLAGS)]>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3891 | } |
| 3892 | } |
| 3893 | |
| 3894 | defm PCMPISTRI : SS42AI_pcmpistri<int_x86_sse42_pcmpistri128>; |
| 3895 | defm PCMPISTRIA : SS42AI_pcmpistri<int_x86_sse42_pcmpistria128>; |
| 3896 | defm PCMPISTRIC : SS42AI_pcmpistri<int_x86_sse42_pcmpistric128>; |
| 3897 | defm PCMPISTRIO : SS42AI_pcmpistri<int_x86_sse42_pcmpistrio128>; |
| 3898 | defm PCMPISTRIS : SS42AI_pcmpistri<int_x86_sse42_pcmpistris128>; |
| 3899 | defm PCMPISTRIZ : SS42AI_pcmpistri<int_x86_sse42_pcmpistriz128>; |
| 3900 | |
| 3901 | let Defs = [ECX, EFLAGS] in { |
| 3902 | let Uses = [EAX, EDX] in { |
| 3903 | multiclass SS42AI_pcmpestri<Intrinsic IntId128> { |
| 3904 | def rr : SS42AI<0x61, MRMSrcReg, (outs), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3905 | (ins VR128:$src1, VR128:$src3, i8imm:$src5), |
| 3906 | "pcmpestri\t{$src5, $src3, $src1|$src1, $src3, $src5}", |
| 3907 | [(set ECX, (IntId128 VR128:$src1, EAX, VR128:$src3, EDX, imm:$src5)), |
| 3908 | (implicit EFLAGS)]>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3909 | def rm : SS42AI<0x61, MRMSrcMem, (outs), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3910 | (ins VR128:$src1, i128mem:$src3, i8imm:$src5), |
| 3911 | "pcmpestri\t{$src5, $src3, $src1|$src1, $src3, $src5}", |
| 3912 | [(set ECX, |
| 3913 | (IntId128 VR128:$src1, EAX, (load addr:$src3), EDX, imm:$src5)), |
| 3914 | (implicit EFLAGS)]>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3915 | } |
| 3916 | } |
| 3917 | } |
| 3918 | |
| 3919 | defm PCMPESTRI : SS42AI_pcmpestri<int_x86_sse42_pcmpestri128>; |
| 3920 | defm PCMPESTRIA : SS42AI_pcmpestri<int_x86_sse42_pcmpestria128>; |
| 3921 | defm PCMPESTRIC : SS42AI_pcmpestri<int_x86_sse42_pcmpestric128>; |
| 3922 | defm PCMPESTRIO : SS42AI_pcmpestri<int_x86_sse42_pcmpestrio128>; |
| 3923 | defm PCMPESTRIS : SS42AI_pcmpestri<int_x86_sse42_pcmpestris128>; |
| 3924 | defm PCMPESTRIZ : SS42AI_pcmpestri<int_x86_sse42_pcmpestriz128>; |