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 |
David Greene | 5235d41 | 2010-01-11 16:29:42 +0000 | [diff] [blame] | 134 | // be naturally aligned on some targets but not on others. If the subtarget |
| 135 | // allows unaligned accesses, match any load, though this may require |
| 136 | // setting a feature bit in the processor (on startup, for example). |
| 137 | // Opteron 10h and later implement such a feature. |
Dan Gohman | 2a17412 | 2008-10-15 06:50:19 +0000 | [diff] [blame] | 138 | def memop : PatFrag<(ops node:$ptr), (load node:$ptr), [{ |
David Greene | 5235d41 | 2010-01-11 16:29:42 +0000 | [diff] [blame] | 139 | return Subtarget->hasVectorUAMem() |
| 140 | || cast<LoadSDNode>(N)->getAlignment() >= 16; |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 141 | }]>; |
| 142 | |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 143 | def memopfsf32 : PatFrag<(ops node:$ptr), (f32 (memop node:$ptr))>; |
| 144 | def memopfsf64 : PatFrag<(ops node:$ptr), (f64 (memop node:$ptr))>; |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 145 | def memopv4f32 : PatFrag<(ops node:$ptr), (v4f32 (memop node:$ptr))>; |
| 146 | def memopv2f64 : PatFrag<(ops node:$ptr), (v2f64 (memop node:$ptr))>; |
| 147 | def memopv4i32 : PatFrag<(ops node:$ptr), (v4i32 (memop node:$ptr))>; |
| 148 | def memopv2i64 : PatFrag<(ops node:$ptr), (v2i64 (memop node:$ptr))>; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 149 | def memopv16i8 : PatFrag<(ops node:$ptr), (v16i8 (memop node:$ptr))>; |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 150 | |
Bill Wendling | 3b15d72 | 2007-08-11 09:52:53 +0000 | [diff] [blame] | 151 | // SSSE3 uses MMX registers for some instructions. They aren't aligned on a |
| 152 | // 16-byte boundary. |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 153 | // FIXME: 8 byte alignment for mmx reads is not required |
Dan Gohman | 61efc5a | 2008-10-16 00:03:00 +0000 | [diff] [blame] | 154 | def memop64 : PatFrag<(ops node:$ptr), (load node:$ptr), [{ |
Dan Gohman | 2a17412 | 2008-10-15 06:50:19 +0000 | [diff] [blame] | 155 | return cast<LoadSDNode>(N)->getAlignment() >= 8; |
Bill Wendling | 3b15d72 | 2007-08-11 09:52:53 +0000 | [diff] [blame] | 156 | }]>; |
| 157 | |
| 158 | def memopv8i8 : PatFrag<(ops node:$ptr), (v8i8 (memop64 node:$ptr))>; |
Bill Wendling | 3b15d72 | 2007-08-11 09:52:53 +0000 | [diff] [blame] | 159 | def memopv4i16 : PatFrag<(ops node:$ptr), (v4i16 (memop64 node:$ptr))>; |
| 160 | def memopv8i16 : PatFrag<(ops node:$ptr), (v8i16 (memop64 node:$ptr))>; |
| 161 | def memopv2i32 : PatFrag<(ops node:$ptr), (v2i32 (memop64 node:$ptr))>; |
| 162 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 163 | def bc_v4f32 : PatFrag<(ops node:$in), (v4f32 (bitconvert node:$in))>; |
| 164 | def bc_v2f64 : PatFrag<(ops node:$in), (v2f64 (bitconvert node:$in))>; |
| 165 | def bc_v16i8 : PatFrag<(ops node:$in), (v16i8 (bitconvert node:$in))>; |
| 166 | def bc_v8i16 : PatFrag<(ops node:$in), (v8i16 (bitconvert node:$in))>; |
| 167 | def bc_v4i32 : PatFrag<(ops node:$in), (v4i32 (bitconvert node:$in))>; |
| 168 | def bc_v2i64 : PatFrag<(ops node:$in), (v2i64 (bitconvert node:$in))>; |
| 169 | |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 170 | def vzmovl_v2i64 : PatFrag<(ops node:$src), |
| 171 | (bitconvert (v2i64 (X86vzmovl |
| 172 | (v2i64 (scalar_to_vector (loadi64 node:$src))))))>; |
| 173 | def vzmovl_v4i32 : PatFrag<(ops node:$src), |
| 174 | (bitconvert (v4i32 (X86vzmovl |
| 175 | (v4i32 (scalar_to_vector (loadi32 node:$src))))))>; |
| 176 | |
| 177 | def vzload_v2i64 : PatFrag<(ops node:$src), |
| 178 | (bitconvert (v2i64 (X86vzload node:$src)))>; |
| 179 | |
| 180 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 181 | def fp32imm0 : PatLeaf<(f32 fpimm), [{ |
| 182 | return N->isExactlyValue(+0.0); |
| 183 | }]>; |
| 184 | |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 185 | // BYTE_imm - Transform bit immediates into byte immediates. |
| 186 | def BYTE_imm : SDNodeXForm<imm, [{ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 187 | // Transformation function: imm >> 3 |
Dan Gohman | faeb4a3 | 2008-09-12 16:56:44 +0000 | [diff] [blame] | 188 | return getI32Imm(N->getZExtValue() >> 3); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 189 | }]>; |
| 190 | |
| 191 | // SHUFFLE_get_shuf_imm xform function: convert vector_shuffle mask to PSHUF*, |
| 192 | // SHUFP* etc. imm. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 193 | def SHUFFLE_get_shuf_imm : SDNodeXForm<vector_shuffle, [{ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 194 | return getI8Imm(X86::getShuffleSHUFImmediate(N)); |
| 195 | }]>; |
| 196 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 197 | // SHUFFLE_get_pshufhw_imm xform function: convert vector_shuffle mask to |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 198 | // PSHUFHW imm. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 199 | def SHUFFLE_get_pshufhw_imm : SDNodeXForm<vector_shuffle, [{ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 200 | return getI8Imm(X86::getShufflePSHUFHWImmediate(N)); |
| 201 | }]>; |
| 202 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 203 | // SHUFFLE_get_pshuflw_imm xform function: convert vector_shuffle mask to |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 204 | // PSHUFLW imm. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 205 | def SHUFFLE_get_pshuflw_imm : SDNodeXForm<vector_shuffle, [{ |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 206 | return getI8Imm(X86::getShufflePSHUFLWImmediate(N)); |
| 207 | }]>; |
| 208 | |
Nate Begeman | 080f8e2 | 2009-10-19 02:17:23 +0000 | [diff] [blame] | 209 | // SHUFFLE_get_palign_imm xform function: convert vector_shuffle mask to |
| 210 | // a PALIGNR imm. |
| 211 | def SHUFFLE_get_palign_imm : SDNodeXForm<vector_shuffle, [{ |
| 212 | return getI8Imm(X86::getShufflePALIGNRImmediate(N)); |
| 213 | }]>; |
| 214 | |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 215 | def splat_lo : PatFrag<(ops node:$lhs, node:$rhs), |
| 216 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 217 | ShuffleVectorSDNode *SVOp = cast<ShuffleVectorSDNode>(N); |
| 218 | return SVOp->isSplat() && SVOp->getSplatIndex() == 0; |
| 219 | }]>; |
| 220 | |
| 221 | def movddup : PatFrag<(ops node:$lhs, node:$rhs), |
| 222 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 223 | return X86::isMOVDDUPMask(cast<ShuffleVectorSDNode>(N)); |
| 224 | }]>; |
| 225 | |
| 226 | def movhlps : PatFrag<(ops node:$lhs, node:$rhs), |
| 227 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 228 | return X86::isMOVHLPSMask(cast<ShuffleVectorSDNode>(N)); |
| 229 | }]>; |
| 230 | |
| 231 | def movhlps_undef : PatFrag<(ops node:$lhs, node:$rhs), |
| 232 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 233 | return X86::isMOVHLPS_v_undef_Mask(cast<ShuffleVectorSDNode>(N)); |
| 234 | }]>; |
| 235 | |
Nate Begeman | b13034d | 2009-11-07 23:17:15 +0000 | [diff] [blame] | 236 | def movlhps : PatFrag<(ops node:$lhs, node:$rhs), |
| 237 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 238 | return X86::isMOVLHPSMask(cast<ShuffleVectorSDNode>(N)); |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 239 | }]>; |
| 240 | |
| 241 | def movlp : PatFrag<(ops node:$lhs, node:$rhs), |
| 242 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 243 | return X86::isMOVLPMask(cast<ShuffleVectorSDNode>(N)); |
| 244 | }]>; |
| 245 | |
| 246 | def movl : PatFrag<(ops node:$lhs, node:$rhs), |
| 247 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 248 | return X86::isMOVLMask(cast<ShuffleVectorSDNode>(N)); |
| 249 | }]>; |
| 250 | |
| 251 | def movshdup : PatFrag<(ops node:$lhs, node:$rhs), |
| 252 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 253 | return X86::isMOVSHDUPMask(cast<ShuffleVectorSDNode>(N)); |
| 254 | }]>; |
| 255 | |
| 256 | def movsldup : PatFrag<(ops node:$lhs, node:$rhs), |
| 257 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 258 | return X86::isMOVSLDUPMask(cast<ShuffleVectorSDNode>(N)); |
| 259 | }]>; |
| 260 | |
| 261 | def unpckl : PatFrag<(ops node:$lhs, node:$rhs), |
| 262 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 263 | return X86::isUNPCKLMask(cast<ShuffleVectorSDNode>(N)); |
| 264 | }]>; |
| 265 | |
| 266 | def unpckh : PatFrag<(ops node:$lhs, node:$rhs), |
| 267 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 268 | return X86::isUNPCKHMask(cast<ShuffleVectorSDNode>(N)); |
| 269 | }]>; |
| 270 | |
| 271 | def unpckl_undef : PatFrag<(ops node:$lhs, node:$rhs), |
| 272 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 273 | return X86::isUNPCKL_v_undef_Mask(cast<ShuffleVectorSDNode>(N)); |
| 274 | }]>; |
| 275 | |
| 276 | def unpckh_undef : PatFrag<(ops node:$lhs, node:$rhs), |
| 277 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 278 | return X86::isUNPCKH_v_undef_Mask(cast<ShuffleVectorSDNode>(N)); |
| 279 | }]>; |
| 280 | |
| 281 | def pshufd : PatFrag<(ops node:$lhs, node:$rhs), |
| 282 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 283 | return X86::isPSHUFDMask(cast<ShuffleVectorSDNode>(N)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 284 | }], SHUFFLE_get_shuf_imm>; |
| 285 | |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 286 | def shufp : PatFrag<(ops node:$lhs, node:$rhs), |
| 287 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 288 | return X86::isSHUFPMask(cast<ShuffleVectorSDNode>(N)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 289 | }], SHUFFLE_get_shuf_imm>; |
| 290 | |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 291 | def pshufhw : PatFrag<(ops node:$lhs, node:$rhs), |
| 292 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 293 | return X86::isPSHUFHWMask(cast<ShuffleVectorSDNode>(N)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 294 | }], SHUFFLE_get_pshufhw_imm>; |
| 295 | |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 296 | def pshuflw : PatFrag<(ops node:$lhs, node:$rhs), |
| 297 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 298 | return X86::isPSHUFLWMask(cast<ShuffleVectorSDNode>(N)); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 299 | }], SHUFFLE_get_pshuflw_imm>; |
| 300 | |
Nate Begeman | 080f8e2 | 2009-10-19 02:17:23 +0000 | [diff] [blame] | 301 | def palign : PatFrag<(ops node:$lhs, node:$rhs), |
| 302 | (vector_shuffle node:$lhs, node:$rhs), [{ |
| 303 | return X86::isPALIGNRMask(cast<ShuffleVectorSDNode>(N)); |
| 304 | }], SHUFFLE_get_palign_imm>; |
| 305 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 306 | //===----------------------------------------------------------------------===// |
| 307 | // SSE scalar FP Instructions |
| 308 | //===----------------------------------------------------------------------===// |
| 309 | |
Dan Gohman | 30afe01 | 2009-10-29 18:10:34 +0000 | [diff] [blame] | 310 | // CMOV* - Used to implement the SSE SELECT DAG operation. Expanded after |
| 311 | // instruction selection into a branch sequence. |
| 312 | let Uses = [EFLAGS], usesCustomInserter = 1 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 313 | def CMOV_FR32 : I<0, Pseudo, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 314 | (outs FR32:$dst), (ins FR32:$t, FR32:$f, i8imm:$cond), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 315 | "#CMOV_FR32 PSEUDO!", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 316 | [(set FR32:$dst, (X86cmov FR32:$t, FR32:$f, imm:$cond, |
| 317 | EFLAGS))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 318 | def CMOV_FR64 : I<0, Pseudo, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 319 | (outs FR64:$dst), (ins FR64:$t, FR64:$f, i8imm:$cond), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 320 | "#CMOV_FR64 PSEUDO!", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 321 | [(set FR64:$dst, (X86cmov FR64:$t, FR64:$f, imm:$cond, |
| 322 | EFLAGS))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 323 | def CMOV_V4F32 : I<0, Pseudo, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 324 | (outs VR128:$dst), (ins VR128:$t, VR128:$f, i8imm:$cond), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 325 | "#CMOV_V4F32 PSEUDO!", |
| 326 | [(set VR128:$dst, |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 327 | (v4f32 (X86cmov VR128:$t, VR128:$f, imm:$cond, |
| 328 | EFLAGS)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 329 | def CMOV_V2F64 : I<0, Pseudo, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 330 | (outs VR128:$dst), (ins VR128:$t, VR128:$f, i8imm:$cond), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 331 | "#CMOV_V2F64 PSEUDO!", |
| 332 | [(set VR128:$dst, |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 333 | (v2f64 (X86cmov VR128:$t, VR128:$f, imm:$cond, |
| 334 | EFLAGS)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 335 | def CMOV_V2I64 : I<0, Pseudo, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 336 | (outs VR128:$dst), (ins VR128:$t, VR128:$f, i8imm:$cond), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 337 | "#CMOV_V2I64 PSEUDO!", |
| 338 | [(set VR128:$dst, |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 339 | (v2i64 (X86cmov VR128:$t, VR128:$f, imm:$cond, |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 340 | EFLAGS)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 341 | } |
| 342 | |
| 343 | //===----------------------------------------------------------------------===// |
| 344 | // SSE1 Instructions |
| 345 | //===----------------------------------------------------------------------===// |
| 346 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 347 | // Move Instructions |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 348 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 349 | def MOVSSrr : SSI<0x10, MRMSrcReg, (outs FR32:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 350 | "movss\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 351 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 352 | def MOVSSrm : SSI<0x10, MRMSrcMem, (outs FR32:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 353 | "movss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 354 | [(set FR32:$dst, (loadf32 addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 355 | def MOVSSmr : SSI<0x11, MRMDestMem, (outs), (ins f32mem:$dst, FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 356 | "movss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 357 | [(store FR32:$src, addr:$dst)]>; |
| 358 | |
| 359 | // Conversion instructions |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 360 | def CVTTSS2SIrr : SSI<0x2C, MRMSrcReg, (outs GR32:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 361 | "cvttss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 362 | [(set GR32:$dst, (fp_to_sint FR32:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 363 | def CVTTSS2SIrm : SSI<0x2C, MRMSrcMem, (outs GR32:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 364 | "cvttss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 365 | [(set GR32:$dst, (fp_to_sint (loadf32 addr:$src)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 366 | def CVTSI2SSrr : SSI<0x2A, MRMSrcReg, (outs FR32:$dst), (ins GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 367 | "cvtsi2ss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 368 | [(set FR32:$dst, (sint_to_fp GR32:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 369 | def CVTSI2SSrm : SSI<0x2A, MRMSrcMem, (outs FR32:$dst), (ins i32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 370 | "cvtsi2ss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 371 | [(set FR32:$dst, (sint_to_fp (loadi32 addr:$src)))]>; |
| 372 | |
| 373 | // Match intrinsics which expect XMM operand(s). |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 374 | def CVTSS2SIrr: SSI<0x2D, MRMSrcReg, (outs GR32:$dst), (ins FR32:$src), |
| 375 | "cvtss2si{l}\t{$src, $dst|$dst, $src}", []>; |
| 376 | def CVTSS2SIrm: SSI<0x2D, MRMSrcMem, (outs GR32:$dst), (ins f32mem:$src), |
| 377 | "cvtss2si{l}\t{$src, $dst|$dst, $src}", []>; |
| 378 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 379 | def Int_CVTSS2SIrr : SSI<0x2D, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 380 | "cvtss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 381 | [(set GR32:$dst, (int_x86_sse_cvtss2si VR128:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 382 | def Int_CVTSS2SIrm : SSI<0x2D, MRMSrcMem, (outs GR32:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 383 | "cvtss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 384 | [(set GR32:$dst, (int_x86_sse_cvtss2si |
| 385 | (load addr:$src)))]>; |
| 386 | |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 387 | // Match intrinisics which expect MM and XMM operand(s). |
| 388 | def Int_CVTPS2PIrr : PSI<0x2D, MRMSrcReg, (outs VR64:$dst), (ins VR128:$src), |
| 389 | "cvtps2pi\t{$src, $dst|$dst, $src}", |
| 390 | [(set VR64:$dst, (int_x86_sse_cvtps2pi VR128:$src))]>; |
| 391 | def Int_CVTPS2PIrm : PSI<0x2D, MRMSrcMem, (outs VR64:$dst), (ins f64mem:$src), |
| 392 | "cvtps2pi\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 393 | [(set VR64:$dst, (int_x86_sse_cvtps2pi |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 394 | (load addr:$src)))]>; |
| 395 | def Int_CVTTPS2PIrr: PSI<0x2C, MRMSrcReg, (outs VR64:$dst), (ins VR128:$src), |
| 396 | "cvttps2pi\t{$src, $dst|$dst, $src}", |
| 397 | [(set VR64:$dst, (int_x86_sse_cvttps2pi VR128:$src))]>; |
| 398 | def Int_CVTTPS2PIrm: PSI<0x2C, MRMSrcMem, (outs VR64:$dst), (ins f64mem:$src), |
| 399 | "cvttps2pi\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 400 | [(set VR64:$dst, (int_x86_sse_cvttps2pi |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 401 | (load addr:$src)))]>; |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 402 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 403 | def Int_CVTPI2PSrr : PSI<0x2A, MRMSrcReg, |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 404 | (outs VR128:$dst), (ins VR128:$src1, VR64:$src2), |
| 405 | "cvtpi2ps\t{$src2, $dst|$dst, $src2}", |
| 406 | [(set VR128:$dst, (int_x86_sse_cvtpi2ps VR128:$src1, |
| 407 | VR64:$src2))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 408 | def Int_CVTPI2PSrm : PSI<0x2A, MRMSrcMem, |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 409 | (outs VR128:$dst), (ins VR128:$src1, i64mem:$src2), |
| 410 | "cvtpi2ps\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 411 | [(set VR128:$dst, (int_x86_sse_cvtpi2ps VR128:$src1, |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 412 | (load addr:$src2)))]>; |
| 413 | } |
| 414 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 415 | // Aliases for intrinsics |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 416 | def Int_CVTTSS2SIrr : SSI<0x2C, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 417 | "cvttss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 418 | [(set GR32:$dst, |
| 419 | (int_x86_sse_cvttss2si VR128:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 420 | def Int_CVTTSS2SIrm : SSI<0x2C, MRMSrcMem, (outs GR32:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 421 | "cvttss2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 422 | [(set GR32:$dst, |
| 423 | (int_x86_sse_cvttss2si(load addr:$src)))]>; |
| 424 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 425 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 426 | def Int_CVTSI2SSrr : SSI<0x2A, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 427 | (outs VR128:$dst), (ins VR128:$src1, GR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 428 | "cvtsi2ss\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 429 | [(set VR128:$dst, (int_x86_sse_cvtsi2ss VR128:$src1, |
| 430 | GR32:$src2))]>; |
| 431 | def Int_CVTSI2SSrm : SSI<0x2A, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 432 | (outs VR128:$dst), (ins VR128:$src1, i32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 433 | "cvtsi2ss\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 434 | [(set VR128:$dst, (int_x86_sse_cvtsi2ss VR128:$src1, |
| 435 | (loadi32 addr:$src2)))]>; |
| 436 | } |
| 437 | |
| 438 | // Comparison instructions |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 439 | let Constraints = "$src1 = $dst", neverHasSideEffects = 1 in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 440 | def CMPSSrr : SSIi8<0xC2, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 441 | (outs FR32:$dst), (ins FR32:$src1, FR32:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 442 | "cmp${cc}ss\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 443 | let mayLoad = 1 in |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 444 | def CMPSSrm : SSIi8<0xC2, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 445 | (outs FR32:$dst), (ins FR32:$src1, f32mem:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 446 | "cmp${cc}ss\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 447 | } |
| 448 | |
Evan Cheng | 5568707 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 449 | let Defs = [EFLAGS] in { |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 450 | def UCOMISSrr: PSI<0x2E, MRMSrcReg, (outs), (ins FR32:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 451 | "ucomiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 452 | [(X86cmp FR32:$src1, FR32:$src2), (implicit EFLAGS)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 453 | def UCOMISSrm: PSI<0x2E, MRMSrcMem, (outs), (ins FR32:$src1, f32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 454 | "ucomiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 455 | [(X86cmp FR32:$src1, (loadf32 addr:$src2)), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 456 | (implicit EFLAGS)]>; |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 457 | |
| 458 | def COMISSrr: PSI<0x2F, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
| 459 | "comiss\t{$src2, $src1|$src1, $src2}", []>; |
| 460 | def COMISSrm: PSI<0x2F, MRMSrcMem, (outs), (ins VR128:$src1, f128mem:$src2), |
| 461 | "comiss\t{$src2, $src1|$src1, $src2}", []>; |
| 462 | |
Evan Cheng | 5568707 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 463 | } // Defs = [EFLAGS] |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 464 | |
| 465 | // Aliases to match intrinsics which expect XMM operand(s). |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 466 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 467 | def Int_CMPSSrr : SSIi8<0xC2, MRMSrcReg, |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 468 | (outs VR128:$dst), |
| 469 | (ins VR128:$src1, VR128:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 470 | "cmp${cc}ss\t{$src, $dst|$dst, $src}", |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 471 | [(set VR128:$dst, (int_x86_sse_cmp_ss |
| 472 | VR128:$src1, |
| 473 | VR128:$src, imm:$cc))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 474 | def Int_CMPSSrm : SSIi8<0xC2, MRMSrcMem, |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 475 | (outs VR128:$dst), |
| 476 | (ins VR128:$src1, f32mem:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 477 | "cmp${cc}ss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 478 | [(set VR128:$dst, (int_x86_sse_cmp_ss VR128:$src1, |
| 479 | (load addr:$src), imm:$cc))]>; |
| 480 | } |
| 481 | |
Evan Cheng | 5568707 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 482 | let Defs = [EFLAGS] in { |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 483 | def Int_UCOMISSrr: PSI<0x2E, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 484 | "ucomiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 485 | [(X86ucomi (v4f32 VR128:$src1), VR128:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 486 | (implicit EFLAGS)]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 487 | def Int_UCOMISSrm: PSI<0x2E, MRMSrcMem, (outs),(ins VR128:$src1, f128mem:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 488 | "ucomiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 489 | [(X86ucomi (v4f32 VR128:$src1), (load addr:$src2)), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 490 | (implicit EFLAGS)]>; |
| 491 | |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 492 | def Int_COMISSrr: PSI<0x2F, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 493 | "comiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 494 | [(X86comi (v4f32 VR128:$src1), VR128:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 495 | (implicit EFLAGS)]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 496 | def Int_COMISSrm: PSI<0x2F, MRMSrcMem, (outs), (ins VR128:$src1, f128mem:$src2), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 497 | "comiss\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 498 | [(X86comi (v4f32 VR128:$src1), (load addr:$src2)), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 499 | (implicit EFLAGS)]>; |
Evan Cheng | 5568707 | 2007-09-14 21:48:26 +0000 | [diff] [blame] | 500 | } // Defs = [EFLAGS] |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 501 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 502 | // Aliases of packed SSE1 instructions for scalar use. These all have names |
| 503 | // that start with 'Fs'. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 504 | |
| 505 | // Alias instructions that map fld0 to pxor for sse. |
Dan Gohman | 51dbce6 | 2009-09-21 18:30:38 +0000 | [diff] [blame] | 506 | let isReMaterializable = 1, isAsCheapAsAMove = 1, isCodeGenOnly = 1, |
| 507 | canFoldAsLoad = 1 in |
Chris Lattner | cb521fb | 2010-02-05 21:30:49 +0000 | [diff] [blame^] | 508 | // FIXME: Set encoding to pseudo! |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 509 | def FsFLD0SS : I<0xEF, MRMInitReg, (outs FR32:$dst), (ins), |
Chris Lattner | cb521fb | 2010-02-05 21:30:49 +0000 | [diff] [blame^] | 510 | "", [(set FR32:$dst, fp32imm0)]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 511 | Requires<[HasSSE1]>, TB, OpSize; |
| 512 | |
| 513 | // Alias instruction to do FR32 reg-to-reg copy using movaps. Upper bits are |
| 514 | // disregarded. |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 515 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 516 | def FsMOVAPSrr : PSI<0x28, MRMSrcReg, (outs FR32:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 517 | "movaps\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 518 | |
| 519 | // Alias instruction to load FR32 from f128mem using movaps. Upper bits are |
| 520 | // disregarded. |
Evan Cheng | 8e66471 | 2009-11-17 09:51:18 +0000 | [diff] [blame] | 521 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 522 | def FsMOVAPSrm : PSI<0x28, MRMSrcMem, (outs FR32:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 523 | "movaps\t{$src, $dst|$dst, $src}", |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 524 | [(set FR32:$dst, (alignedloadfsf32 addr:$src))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 525 | |
| 526 | // Alias bitwise logical operations using SSE logical ops on packed FP values. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 527 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 528 | let isCommutable = 1 in { |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 529 | def FsANDPSrr : PSI<0x54, MRMSrcReg, (outs FR32:$dst), |
| 530 | (ins FR32:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 531 | "andps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 532 | [(set FR32:$dst, (X86fand FR32:$src1, FR32:$src2))]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 533 | def FsORPSrr : PSI<0x56, MRMSrcReg, (outs FR32:$dst), |
| 534 | (ins FR32:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 535 | "orps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 536 | [(set FR32:$dst, (X86for FR32:$src1, FR32:$src2))]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 537 | def FsXORPSrr : PSI<0x57, MRMSrcReg, (outs FR32:$dst), |
| 538 | (ins FR32:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 539 | "xorps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 540 | [(set FR32:$dst, (X86fxor FR32:$src1, FR32:$src2))]>; |
| 541 | } |
| 542 | |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 543 | def FsANDPSrm : PSI<0x54, MRMSrcMem, (outs FR32:$dst), |
| 544 | (ins FR32:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 545 | "andps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 546 | [(set FR32:$dst, (X86fand FR32:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 547 | (memopfsf32 addr:$src2)))]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 548 | def FsORPSrm : PSI<0x56, MRMSrcMem, (outs FR32:$dst), |
| 549 | (ins FR32:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 550 | "orps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 551 | [(set FR32:$dst, (X86for FR32:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 552 | (memopfsf32 addr:$src2)))]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 553 | def FsXORPSrm : PSI<0x57, MRMSrcMem, (outs FR32:$dst), |
| 554 | (ins FR32:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 555 | "xorps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 556 | [(set FR32:$dst, (X86fxor FR32:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 557 | (memopfsf32 addr:$src2)))]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 558 | |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 559 | let neverHasSideEffects = 1 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 560 | def FsANDNPSrr : PSI<0x55, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 561 | (outs FR32:$dst), (ins FR32:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 562 | "andnps\t{$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 563 | let mayLoad = 1 in |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 564 | def FsANDNPSrm : PSI<0x55, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 565 | (outs FR32:$dst), (ins FR32:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 566 | "andnps\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 567 | } |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 568 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 569 | |
| 570 | /// basic_sse1_fp_binop_rm - SSE1 binops come in both scalar and vector forms. |
| 571 | /// |
| 572 | /// In addition, we also have a special variant of the scalar form here to |
| 573 | /// represent the associated intrinsic operation. This form is unlike the |
| 574 | /// 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] | 575 | /// and leaves the top elements unmodified (therefore these cannot be commuted). |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 576 | /// |
| 577 | /// These three forms can each be reg+reg or reg+mem, so there are a total of |
| 578 | /// six "instructions". |
| 579 | /// |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 580 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 581 | multiclass basic_sse1_fp_binop_rm<bits<8> opc, string OpcodeStr, |
| 582 | SDNode OpNode, Intrinsic F32Int, |
| 583 | bit Commutable = 0> { |
| 584 | // Scalar operation, reg+reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 585 | 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] | 586 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 587 | [(set FR32:$dst, (OpNode FR32:$src1, FR32:$src2))]> { |
| 588 | let isCommutable = Commutable; |
| 589 | } |
| 590 | |
| 591 | // Scalar operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 592 | def SSrm : SSI<opc, MRMSrcMem, (outs FR32:$dst), |
| 593 | (ins FR32:$src1, f32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 594 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 595 | [(set FR32:$dst, (OpNode FR32:$src1, (load addr:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 596 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 597 | // Vector operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 598 | def PSrr : PSI<opc, MRMSrcReg, (outs VR128:$dst), |
| 599 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 600 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 601 | [(set VR128:$dst, (v4f32 (OpNode VR128:$src1, VR128:$src2)))]> { |
| 602 | let isCommutable = Commutable; |
| 603 | } |
| 604 | |
| 605 | // Vector operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 606 | def PSrm : PSI<opc, MRMSrcMem, (outs VR128:$dst), |
| 607 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 608 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 609 | [(set VR128:$dst, (OpNode VR128:$src1, (memopv4f32 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 610 | |
| 611 | // Intrinsic operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 612 | def SSrr_Int : SSI<opc, MRMSrcReg, (outs VR128:$dst), |
| 613 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 614 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 5d5dbbc | 2009-02-26 03:12:02 +0000 | [diff] [blame] | 615 | [(set VR128:$dst, (F32Int VR128:$src1, VR128:$src2))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 616 | |
| 617 | // Intrinsic operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 618 | def SSrm_Int : SSI<opc, MRMSrcMem, (outs VR128:$dst), |
| 619 | (ins VR128:$src1, ssmem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 620 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 621 | [(set VR128:$dst, (F32Int VR128:$src1, |
| 622 | sse_load_f32:$src2))]>; |
| 623 | } |
| 624 | } |
| 625 | |
| 626 | // Arithmetic instructions |
| 627 | defm ADD : basic_sse1_fp_binop_rm<0x58, "add", fadd, int_x86_sse_add_ss, 1>; |
| 628 | defm MUL : basic_sse1_fp_binop_rm<0x59, "mul", fmul, int_x86_sse_mul_ss, 1>; |
| 629 | defm SUB : basic_sse1_fp_binop_rm<0x5C, "sub", fsub, int_x86_sse_sub_ss>; |
| 630 | defm DIV : basic_sse1_fp_binop_rm<0x5E, "div", fdiv, int_x86_sse_div_ss>; |
| 631 | |
| 632 | /// sse1_fp_binop_rm - Other SSE1 binops |
| 633 | /// |
| 634 | /// This multiclass is like basic_sse1_fp_binop_rm, with the addition of |
| 635 | /// instructions for a full-vector intrinsic form. Operations that map |
| 636 | /// onto C operators don't use this form since they just use the plain |
| 637 | /// vector form instead of having a separate vector intrinsic form. |
| 638 | /// |
| 639 | /// This provides a total of eight "instructions". |
| 640 | /// |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 641 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 642 | multiclass sse1_fp_binop_rm<bits<8> opc, string OpcodeStr, |
| 643 | SDNode OpNode, |
| 644 | Intrinsic F32Int, |
| 645 | Intrinsic V4F32Int, |
| 646 | bit Commutable = 0> { |
| 647 | |
| 648 | // Scalar operation, reg+reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 649 | 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] | 650 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 651 | [(set FR32:$dst, (OpNode FR32:$src1, FR32:$src2))]> { |
| 652 | let isCommutable = Commutable; |
| 653 | } |
| 654 | |
| 655 | // Scalar operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 656 | def SSrm : SSI<opc, MRMSrcMem, (outs FR32:$dst), |
| 657 | (ins FR32:$src1, f32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 658 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 659 | [(set FR32:$dst, (OpNode FR32:$src1, (load addr:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 660 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 661 | // Vector operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 662 | def PSrr : PSI<opc, MRMSrcReg, (outs VR128:$dst), |
| 663 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 664 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 665 | [(set VR128:$dst, (v4f32 (OpNode VR128:$src1, VR128:$src2)))]> { |
| 666 | let isCommutable = Commutable; |
| 667 | } |
| 668 | |
| 669 | // Vector operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 670 | def PSrm : PSI<opc, MRMSrcMem, (outs VR128:$dst), |
| 671 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 672 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 673 | [(set VR128:$dst, (OpNode VR128:$src1, (memopv4f32 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 674 | |
| 675 | // Intrinsic operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 676 | def SSrr_Int : SSI<opc, MRMSrcReg, (outs VR128:$dst), |
| 677 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 678 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 679 | [(set VR128:$dst, (F32Int VR128:$src1, VR128:$src2))]> { |
| 680 | let isCommutable = Commutable; |
| 681 | } |
| 682 | |
| 683 | // Intrinsic operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 684 | def SSrm_Int : SSI<opc, MRMSrcMem, (outs VR128:$dst), |
| 685 | (ins VR128:$src1, ssmem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 686 | !strconcat(OpcodeStr, "ss\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 687 | [(set VR128:$dst, (F32Int VR128:$src1, |
| 688 | sse_load_f32:$src2))]>; |
| 689 | |
| 690 | // Vector intrinsic operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 691 | def PSrr_Int : PSI<opc, MRMSrcReg, (outs VR128:$dst), |
| 692 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 693 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 694 | [(set VR128:$dst, (V4F32Int VR128:$src1, VR128:$src2))]> { |
| 695 | let isCommutable = Commutable; |
| 696 | } |
| 697 | |
| 698 | // Vector intrinsic operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 699 | def PSrm_Int : PSI<opc, MRMSrcMem, (outs VR128:$dst), |
| 700 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 701 | !strconcat(OpcodeStr, "ps\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 702 | [(set VR128:$dst, (V4F32Int VR128:$src1, (memopv4f32 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 703 | } |
| 704 | } |
| 705 | |
| 706 | defm MAX : sse1_fp_binop_rm<0x5F, "max", X86fmax, |
| 707 | int_x86_sse_max_ss, int_x86_sse_max_ps>; |
| 708 | defm MIN : sse1_fp_binop_rm<0x5D, "min", X86fmin, |
| 709 | int_x86_sse_min_ss, int_x86_sse_min_ps>; |
| 710 | |
| 711 | //===----------------------------------------------------------------------===// |
| 712 | // SSE packed FP Instructions |
| 713 | |
| 714 | // Move Instructions |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 715 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 716 | def MOVAPSrr : PSI<0x28, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 717 | "movaps\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 718 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 719 | def MOVAPSrm : PSI<0x28, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 720 | "movaps\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 721 | [(set VR128:$dst, (alignedloadv4f32 addr:$src))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 722 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 723 | def MOVAPSmr : PSI<0x29, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 724 | "movaps\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 725 | [(alignedstore (v4f32 VR128:$src), addr:$dst)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 726 | |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 727 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 728 | def MOVUPSrr : PSI<0x10, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 729 | "movups\t{$src, $dst|$dst, $src}", []>; |
Evan Cheng | 9d7cd4e | 2009-11-16 21:56:03 +0000 | [diff] [blame] | 730 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 731 | def MOVUPSrm : PSI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$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 | [(set VR128:$dst, (loadv4f32 addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 734 | def MOVUPSmr : PSI<0x11, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 735 | "movups\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 736 | [(store (v4f32 VR128:$src), addr:$dst)]>; |
| 737 | |
| 738 | // Intrinsic forms of MOVUPS load and store |
Evan Cheng | 8e66471 | 2009-11-17 09:51:18 +0000 | [diff] [blame] | 739 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 740 | def MOVUPSrm_Int : PSI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$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 | [(set VR128:$dst, (int_x86_sse_loadu_ps addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 743 | def MOVUPSmr_Int : PSI<0x11, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 744 | "movups\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 745 | [(int_x86_sse_storeu_ps addr:$dst, VR128:$src)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 746 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 747 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 748 | let AddedComplexity = 20 in { |
| 749 | def MOVLPSrm : PSI<0x12, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 750 | (outs VR128:$dst), (ins VR128:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 751 | "movlps\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 752 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 753 | (movlp VR128:$src1, |
| 754 | (bc_v4f32 (v2f64 (scalar_to_vector (loadf64 addr:$src2))))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 755 | def MOVHPSrm : PSI<0x16, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 756 | (outs VR128:$dst), (ins VR128:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 757 | "movhps\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 758 | [(set VR128:$dst, |
Nate Begeman | b13034d | 2009-11-07 23:17:15 +0000 | [diff] [blame] | 759 | (movlhps VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 760 | (bc_v4f32 (v2f64 (scalar_to_vector (loadf64 addr:$src2))))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 761 | } // AddedComplexity |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 762 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 763 | |
Evan Cheng | d743a5f | 2008-05-10 00:59:18 +0000 | [diff] [blame] | 764 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 765 | def MOVLPSmr : PSI<0x13, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 766 | "movlps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 767 | [(store (f64 (vector_extract (bc_v2f64 (v4f32 VR128:$src)), |
| 768 | (iPTR 0))), addr:$dst)]>; |
| 769 | |
| 770 | // v2f64 extract element 1 is always custom lowered to unpack high to low |
| 771 | // 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] | 772 | def MOVHPSmr : PSI<0x17, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 773 | "movhps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 774 | [(store (f64 (vector_extract |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 775 | (unpckh (bc_v2f64 (v4f32 VR128:$src)), |
| 776 | (undef)), (iPTR 0))), addr:$dst)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 777 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 778 | let Constraints = "$src1 = $dst" in { |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 779 | let AddedComplexity = 20 in { |
Evan Cheng | 7581a82 | 2009-05-12 20:17:52 +0000 | [diff] [blame] | 780 | def MOVLHPSrr : PSI<0x16, MRMSrcReg, (outs VR128:$dst), |
| 781 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 782 | "movlhps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 783 | [(set VR128:$dst, |
Nate Begeman | b13034d | 2009-11-07 23:17:15 +0000 | [diff] [blame] | 784 | (v4f32 (movlhps VR128:$src1, VR128:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 785 | |
Evan Cheng | 7581a82 | 2009-05-12 20:17:52 +0000 | [diff] [blame] | 786 | def MOVHLPSrr : PSI<0x12, MRMSrcReg, (outs VR128:$dst), |
| 787 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 788 | "movhlps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 789 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 790 | (v4f32 (movhlps VR128:$src1, VR128:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 791 | } // AddedComplexity |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 792 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 793 | |
Nate Begeman | b44aad7 | 2009-04-29 22:47:44 +0000 | [diff] [blame] | 794 | let AddedComplexity = 20 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 795 | def : Pat<(v4f32 (movddup VR128:$src, (undef))), |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 796 | (MOVLHPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>; |
Nate Begeman | b44aad7 | 2009-04-29 22:47:44 +0000 | [diff] [blame] | 797 | def : Pat<(v2i64 (movddup VR128:$src, (undef))), |
| 798 | (MOVLHPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>; |
| 799 | } |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 800 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 801 | |
| 802 | |
| 803 | // Arithmetic |
| 804 | |
| 805 | /// sse1_fp_unop_rm - SSE1 unops come in both scalar and vector forms. |
| 806 | /// |
| 807 | /// In addition, we also have a special variant of the scalar form here to |
| 808 | /// represent the associated intrinsic operation. This form is unlike the |
| 809 | /// plain scalar form, in that it takes an entire vector (instead of a |
| 810 | /// scalar) and leaves the top elements undefined. |
| 811 | /// |
| 812 | /// And, we have a special variant form for a full-vector intrinsic form. |
| 813 | /// |
| 814 | /// These four forms can each have a reg or a mem operand, so there are a |
| 815 | /// total of eight "instructions". |
| 816 | /// |
| 817 | multiclass sse1_fp_unop_rm<bits<8> opc, string OpcodeStr, |
| 818 | SDNode OpNode, |
| 819 | Intrinsic F32Int, |
| 820 | Intrinsic V4F32Int, |
| 821 | bit Commutable = 0> { |
| 822 | // Scalar operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 823 | def SSr : SSI<opc, MRMSrcReg, (outs FR32:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 824 | !strconcat(OpcodeStr, "ss\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 825 | [(set FR32:$dst, (OpNode FR32:$src))]> { |
| 826 | let isCommutable = Commutable; |
| 827 | } |
| 828 | |
| 829 | // Scalar operation, mem. |
Evan Cheng | d3f27fb | 2009-12-18 07:40:29 +0000 | [diff] [blame] | 830 | def SSm : I<opc, MRMSrcMem, (outs FR32:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 831 | !strconcat(OpcodeStr, "ss\t{$src, $dst|$dst, $src}"), |
Evan Cheng | d3f27fb | 2009-12-18 07:40:29 +0000 | [diff] [blame] | 832 | [(set FR32:$dst, (OpNode (load addr:$src)))]>, XS, |
Evan Cheng | d53fca1 | 2009-12-22 17:47:23 +0000 | [diff] [blame] | 833 | Requires<[HasSSE1, OptForSize]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 834 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 835 | // Vector operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 836 | def PSr : PSI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 837 | !strconcat(OpcodeStr, "ps\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 838 | [(set VR128:$dst, (v4f32 (OpNode VR128:$src)))]> { |
| 839 | let isCommutable = Commutable; |
| 840 | } |
| 841 | |
| 842 | // Vector operation, mem. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 843 | def PSm : PSI<opc, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 844 | !strconcat(OpcodeStr, "ps\t{$src, $dst|$dst, $src}"), |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 845 | [(set VR128:$dst, (OpNode (memopv4f32 addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 846 | |
| 847 | // Intrinsic operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 848 | def SSr_Int : SSI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 849 | !strconcat(OpcodeStr, "ss\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 850 | [(set VR128:$dst, (F32Int VR128:$src))]> { |
| 851 | let isCommutable = Commutable; |
| 852 | } |
| 853 | |
| 854 | // Intrinsic operation, mem. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 855 | def SSm_Int : SSI<opc, MRMSrcMem, (outs VR128:$dst), (ins ssmem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 856 | !strconcat(OpcodeStr, "ss\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 857 | [(set VR128:$dst, (F32Int sse_load_f32:$src))]>; |
| 858 | |
| 859 | // Vector intrinsic operation, reg |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 860 | def PSr_Int : PSI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 861 | !strconcat(OpcodeStr, "ps\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 862 | [(set VR128:$dst, (V4F32Int VR128:$src))]> { |
| 863 | let isCommutable = Commutable; |
| 864 | } |
| 865 | |
| 866 | // Vector intrinsic operation, mem |
Dan Gohman | c747be5 | 2007-08-02 21:06:40 +0000 | [diff] [blame] | 867 | def PSm_Int : PSI<opc, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 868 | !strconcat(OpcodeStr, "ps\t{$src, $dst|$dst, $src}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 869 | [(set VR128:$dst, (V4F32Int (memopv4f32 addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 870 | } |
| 871 | |
| 872 | // Square root. |
| 873 | defm SQRT : sse1_fp_unop_rm<0x51, "sqrt", fsqrt, |
| 874 | int_x86_sse_sqrt_ss, int_x86_sse_sqrt_ps>; |
| 875 | |
| 876 | // Reciprocal approximations. Note that these typically require refinement |
| 877 | // in order to obtain suitable precision. |
| 878 | defm RSQRT : sse1_fp_unop_rm<0x52, "rsqrt", X86frsqrt, |
| 879 | int_x86_sse_rsqrt_ss, int_x86_sse_rsqrt_ps>; |
| 880 | defm RCP : sse1_fp_unop_rm<0x53, "rcp", X86frcp, |
| 881 | int_x86_sse_rcp_ss, int_x86_sse_rcp_ps>; |
| 882 | |
| 883 | // Logical |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 884 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 885 | let isCommutable = 1 in { |
| 886 | def ANDPSrr : PSI<0x54, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 887 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 888 | "andps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 889 | [(set VR128:$dst, (v2i64 |
| 890 | (and VR128:$src1, VR128:$src2)))]>; |
| 891 | def ORPSrr : PSI<0x56, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 892 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 893 | "orps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 894 | [(set VR128:$dst, (v2i64 |
| 895 | (or VR128:$src1, VR128:$src2)))]>; |
| 896 | def XORPSrr : PSI<0x57, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 897 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 898 | "xorps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 899 | [(set VR128:$dst, (v2i64 |
| 900 | (xor VR128:$src1, VR128:$src2)))]>; |
| 901 | } |
| 902 | |
| 903 | def ANDPSrm : PSI<0x54, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 904 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 905 | "andps\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 906 | [(set VR128:$dst, (and (bc_v2i64 (v4f32 VR128:$src1)), |
| 907 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 908 | def ORPSrm : PSI<0x56, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 909 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 910 | "orps\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 911 | [(set VR128:$dst, (or (bc_v2i64 (v4f32 VR128:$src1)), |
| 912 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 913 | def XORPSrm : PSI<0x57, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 914 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 915 | "xorps\t{$src2, $dst|$dst, $src2}", |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 916 | [(set VR128:$dst, (xor (bc_v2i64 (v4f32 VR128:$src1)), |
| 917 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 918 | def ANDNPSrr : PSI<0x55, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 919 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 920 | "andnps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 921 | [(set VR128:$dst, |
| 922 | (v2i64 (and (xor VR128:$src1, |
| 923 | (bc_v2i64 (v4i32 immAllOnesV))), |
| 924 | VR128:$src2)))]>; |
| 925 | def ANDNPSrm : PSI<0x55, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 926 | (outs VR128:$dst), (ins VR128:$src1,f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 927 | "andnps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 928 | [(set VR128:$dst, |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 929 | (v2i64 (and (xor (bc_v2i64 (v4f32 VR128:$src1)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 930 | (bc_v2i64 (v4i32 immAllOnesV))), |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 931 | (memopv2i64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 932 | } |
| 933 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 934 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 935 | def CMPPSrri : PSIi8<0xC2, MRMSrcReg, |
Nate Begeman | 061db5f | 2008-05-12 20:34:32 +0000 | [diff] [blame] | 936 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src, SSECC:$cc), |
| 937 | "cmp${cc}ps\t{$src, $dst|$dst, $src}", |
| 938 | [(set VR128:$dst, (int_x86_sse_cmp_ps VR128:$src1, |
| 939 | VR128:$src, imm:$cc))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 940 | def CMPPSrmi : PSIi8<0xC2, MRMSrcMem, |
Nate Begeman | 061db5f | 2008-05-12 20:34:32 +0000 | [diff] [blame] | 941 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src, SSECC:$cc), |
| 942 | "cmp${cc}ps\t{$src, $dst|$dst, $src}", |
| 943 | [(set VR128:$dst, (int_x86_sse_cmp_ps VR128:$src1, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 944 | (memop addr:$src), imm:$cc))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 945 | } |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 946 | def : Pat<(v4i32 (X86cmpps (v4f32 VR128:$src1), VR128:$src2, imm:$cc)), |
| 947 | (CMPPSrri VR128:$src1, VR128:$src2, imm:$cc)>; |
| 948 | def : Pat<(v4i32 (X86cmpps (v4f32 VR128:$src1), (memop addr:$src2), imm:$cc)), |
| 949 | (CMPPSrmi VR128:$src1, addr:$src2, imm:$cc)>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 950 | |
| 951 | // Shuffle and unpack instructions |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 952 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 953 | let isConvertibleToThreeAddress = 1 in // Convert to pshufd |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 954 | def SHUFPSrri : PSIi8<0xC6, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 955 | (outs VR128:$dst), (ins VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 956 | VR128:$src2, i8imm:$src3), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 957 | "shufps\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 958 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 959 | (v4f32 (shufp:$src3 VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 960 | def SHUFPSrmi : PSIi8<0xC6, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 961 | (outs VR128:$dst), (ins VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 962 | f128mem:$src2, i8imm:$src3), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 963 | "shufps\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 964 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 965 | (v4f32 (shufp:$src3 |
| 966 | VR128:$src1, (memopv4f32 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 967 | |
| 968 | let AddedComplexity = 10 in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 969 | def UNPCKHPSrr : PSI<0x15, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 970 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 971 | "unpckhps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 972 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 973 | (v4f32 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 974 | def UNPCKHPSrm : PSI<0x15, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 975 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 976 | "unpckhps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 977 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 978 | (v4f32 (unpckh VR128:$src1, |
| 979 | (memopv4f32 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 980 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 981 | def UNPCKLPSrr : PSI<0x14, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 982 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 983 | "unpcklps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 984 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 985 | (v4f32 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 986 | def UNPCKLPSrm : PSI<0x14, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 987 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 988 | "unpcklps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 989 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 990 | (unpckl VR128:$src1, (memopv4f32 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 991 | } // AddedComplexity |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 992 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 993 | |
| 994 | // Mask creation |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 995 | def MOVMSKPSrr : PSI<0x50, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 996 | "movmskps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 997 | [(set GR32:$dst, (int_x86_sse_movmsk_ps VR128:$src))]>; |
Evan Cheng | d8296b8 | 2009-05-28 18:55:28 +0000 | [diff] [blame] | 998 | def MOVMSKPDrr : PDI<0x50, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 999 | "movmskpd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1000 | [(set GR32:$dst, (int_x86_sse2_movmsk_pd VR128:$src))]>; |
| 1001 | |
Evan Cheng | d1d6807 | 2008-03-08 00:58:38 +0000 | [diff] [blame] | 1002 | // Prefetch intrinsic. |
| 1003 | def PREFETCHT0 : PSI<0x18, MRM1m, (outs), (ins i8mem:$src), |
| 1004 | "prefetcht0\t$src", [(prefetch addr:$src, imm, (i32 3))]>; |
| 1005 | def PREFETCHT1 : PSI<0x18, MRM2m, (outs), (ins i8mem:$src), |
| 1006 | "prefetcht1\t$src", [(prefetch addr:$src, imm, (i32 2))]>; |
| 1007 | def PREFETCHT2 : PSI<0x18, MRM3m, (outs), (ins i8mem:$src), |
| 1008 | "prefetcht2\t$src", [(prefetch addr:$src, imm, (i32 1))]>; |
| 1009 | def PREFETCHNTA : PSI<0x18, MRM0m, (outs), (ins i8mem:$src), |
| 1010 | "prefetchnta\t$src", [(prefetch addr:$src, imm, (i32 0))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1011 | |
| 1012 | // Non-temporal stores |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1013 | def MOVNTPSmr : PSI<0x2B, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1014 | "movntps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1015 | [(int_x86_sse_movnt_ps addr:$dst, VR128:$src)]>; |
| 1016 | |
| 1017 | // Load, store, and memory fence |
Evan Cheng | 68cca15 | 2009-05-27 18:38:01 +0000 | [diff] [blame] | 1018 | def SFENCE : PSI<0xAE, MRM7r, (outs), (ins), "sfence", [(int_x86_sse_sfence)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1019 | |
| 1020 | // MXCSR register |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1021 | def LDMXCSR : PSI<0xAE, MRM2m, (outs), (ins i32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1022 | "ldmxcsr\t$src", [(int_x86_sse_ldmxcsr addr:$src)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1023 | def STMXCSR : PSI<0xAE, MRM3m, (outs), (ins i32mem:$dst), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1024 | "stmxcsr\t$dst", [(int_x86_sse_stmxcsr addr:$dst)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1025 | |
| 1026 | // Alias instructions that map zero vector to pxor / xorp* for sse. |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1027 | // We set canFoldAsLoad because this can be converted to a constant-pool |
Dan Gohman | 37eb6c8 | 2008-12-03 05:21:24 +0000 | [diff] [blame] | 1028 | // load of an all-zeros value if folding it would be beneficial. |
Chris Lattner | cb521fb | 2010-02-05 21:30:49 +0000 | [diff] [blame^] | 1029 | // FIXME: Change encoding to pseudo! |
Daniel Dunbar | a0e6200 | 2009-08-11 22:17:52 +0000 | [diff] [blame] | 1030 | let isReMaterializable = 1, isAsCheapAsAMove = 1, canFoldAsLoad = 1, |
| 1031 | isCodeGenOnly = 1 in |
Chris Lattner | cb521fb | 2010-02-05 21:30:49 +0000 | [diff] [blame^] | 1032 | def V_SET0 : PSI<0x57, MRMInitReg, (outs VR128:$dst), (ins), "", |
Chris Lattner | e6aa386 | 2007-11-25 00:24:49 +0000 | [diff] [blame] | 1033 | [(set VR128:$dst, (v4i32 immAllZerosV))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1034 | |
Evan Cheng | a15896e | 2008-03-12 07:02:50 +0000 | [diff] [blame] | 1035 | let Predicates = [HasSSE1] in { |
| 1036 | def : Pat<(v2i64 immAllZerosV), (V_SET0)>; |
| 1037 | def : Pat<(v8i16 immAllZerosV), (V_SET0)>; |
| 1038 | def : Pat<(v16i8 immAllZerosV), (V_SET0)>; |
| 1039 | def : Pat<(v2f64 immAllZerosV), (V_SET0)>; |
| 1040 | def : Pat<(v4f32 immAllZerosV), (V_SET0)>; |
| 1041 | } |
| 1042 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1043 | // FR32 to 128-bit vector conversion. |
Evan Cheng | bd0ca9c | 2009-02-05 08:42:55 +0000 | [diff] [blame] | 1044 | let isAsCheapAsAMove = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1045 | def MOVSS2PSrr : SSI<0x10, MRMSrcReg, (outs VR128:$dst), (ins FR32:$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 FR32:$src)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1049 | def MOVSS2PSrm : SSI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1050 | "movss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1051 | [(set VR128:$dst, |
| 1052 | (v4f32 (scalar_to_vector (loadf32 addr:$src))))]>; |
| 1053 | |
| 1054 | // FIXME: may not be able to eliminate this movss with coalescing the src and |
| 1055 | // dest register classes are different. We really want to write this pattern |
| 1056 | // like this: |
| 1057 | // def : Pat<(f32 (vector_extract (v4f32 VR128:$src), (iPTR 0))), |
| 1058 | // (f32 FR32:$src)>; |
Evan Cheng | bd0ca9c | 2009-02-05 08:42:55 +0000 | [diff] [blame] | 1059 | let isAsCheapAsAMove = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1060 | def MOVPS2SSrr : SSI<0x10, MRMSrcReg, (outs FR32:$dst), (ins 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 | [(set FR32:$dst, (vector_extract (v4f32 VR128:$src), |
| 1063 | (iPTR 0)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1064 | def MOVPS2SSmr : SSI<0x11, MRMDestMem, (outs), (ins f32mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1065 | "movss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1066 | [(store (f32 (vector_extract (v4f32 VR128:$src), |
| 1067 | (iPTR 0))), addr:$dst)]>; |
| 1068 | |
| 1069 | |
| 1070 | // Move to lower bits of a VR128, leaving upper bits alone. |
| 1071 | // Three operand (but two address) aliases. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1072 | let Constraints = "$src1 = $dst" in { |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1073 | let neverHasSideEffects = 1 in |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1074 | def MOVLSS2PSrr : SSI<0x10, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1075 | (outs VR128:$dst), (ins VR128:$src1, FR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1076 | "movss\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1077 | |
| 1078 | let AddedComplexity = 15 in |
| 1079 | def MOVLPSrr : SSI<0x10, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1080 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1081 | "movss\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1082 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1083 | (v4f32 (movl VR128:$src1, VR128:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1084 | } |
| 1085 | |
| 1086 | // Move to lower bits of a VR128 and zeroing upper bits. |
| 1087 | // Loading from memory automatically zeroing upper bits. |
| 1088 | let AddedComplexity = 20 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1089 | def MOVZSS2PSrm : SSI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1090 | "movss\t{$src, $dst|$dst, $src}", |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 1091 | [(set VR128:$dst, (v4f32 (X86vzmovl (v4f32 (scalar_to_vector |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1092 | (loadf32 addr:$src))))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1093 | |
Evan Cheng | 056afe1 | 2008-05-20 18:24:47 +0000 | [diff] [blame] | 1094 | def : Pat<(v4f32 (X86vzmovl (loadv4f32 addr:$src))), |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 1095 | (MOVZSS2PSrm addr:$src)>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1096 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1097 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1098 | // SSE2 Instructions |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1099 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1100 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1101 | // Move Instructions |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1102 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1103 | def MOVSDrr : SDI<0x10, MRMSrcReg, (outs FR64:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1104 | "movsd\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1105 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1106 | def MOVSDrm : SDI<0x10, MRMSrcMem, (outs FR64:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1107 | "movsd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1108 | [(set FR64:$dst, (loadf64 addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1109 | def MOVSDmr : SDI<0x11, MRMDestMem, (outs), (ins f64mem:$dst, FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1110 | "movsd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1111 | [(store FR64:$src, addr:$dst)]>; |
| 1112 | |
| 1113 | // Conversion instructions |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1114 | def CVTTSD2SIrr : SDI<0x2C, MRMSrcReg, (outs GR32:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1115 | "cvttsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1116 | [(set GR32:$dst, (fp_to_sint FR64:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1117 | def CVTTSD2SIrm : SDI<0x2C, MRMSrcMem, (outs GR32:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1118 | "cvttsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1119 | [(set GR32:$dst, (fp_to_sint (loadf64 addr:$src)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1120 | def CVTSD2SSrr : SDI<0x5A, MRMSrcReg, (outs FR32:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1121 | "cvtsd2ss\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1122 | [(set FR32:$dst, (fround FR64:$src))]>; |
Evan Cheng | d3f27fb | 2009-12-18 07:40:29 +0000 | [diff] [blame] | 1123 | def CVTSD2SSrm : I<0x5A, MRMSrcMem, (outs FR32:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1124 | "cvtsd2ss\t{$src, $dst|$dst, $src}", |
Evan Cheng | d3f27fb | 2009-12-18 07:40:29 +0000 | [diff] [blame] | 1125 | [(set FR32:$dst, (fround (loadf64 addr:$src)))]>, XD, |
Evan Cheng | d53fca1 | 2009-12-22 17:47:23 +0000 | [diff] [blame] | 1126 | Requires<[HasSSE2, OptForSize]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1127 | def CVTSI2SDrr : SDI<0x2A, MRMSrcReg, (outs FR64:$dst), (ins GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1128 | "cvtsi2sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1129 | [(set FR64:$dst, (sint_to_fp GR32:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1130 | def CVTSI2SDrm : SDI<0x2A, MRMSrcMem, (outs FR64:$dst), (ins i32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1131 | "cvtsi2sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1132 | [(set FR64:$dst, (sint_to_fp (loadi32 addr:$src)))]>; |
| 1133 | |
Sean Callanan | 3d5824c | 2009-09-16 01:13:52 +0000 | [diff] [blame] | 1134 | def CVTPD2DQrm : S3DI<0xE6, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
| 1135 | "cvtpd2dq\t{$src, $dst|$dst, $src}", []>; |
| 1136 | def CVTPD2DQrr : S3DI<0xE6, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1137 | "cvtpd2dq\t{$src, $dst|$dst, $src}", []>; |
| 1138 | def CVTDQ2PDrm : S3SI<0xE6, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
| 1139 | "cvtdq2pd\t{$src, $dst|$dst, $src}", []>; |
| 1140 | def CVTDQ2PDrr : S3SI<0xE6, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1141 | "cvtdq2pd\t{$src, $dst|$dst, $src}", []>; |
| 1142 | def CVTPS2DQrr : PDI<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1143 | "cvtps2dq\t{$src, $dst|$dst, $src}", []>; |
| 1144 | def CVTPS2DQrm : PDI<0x5B, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
| 1145 | "cvtps2dq\t{$src, $dst|$dst, $src}", []>; |
| 1146 | def CVTDQ2PSrr : PSI<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1147 | "cvtdq2ps\t{$src, $dst|$dst, $src}", []>; |
| 1148 | def CVTDQ2PSrm : PSI<0x5B, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
| 1149 | "cvtdq2ps\t{$src, $dst|$dst, $src}", []>; |
| 1150 | def COMISDrr: PDI<0x2F, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
| 1151 | "comisd\t{$src2, $src1|$src1, $src2}", []>; |
| 1152 | def COMISDrm: PDI<0x2F, MRMSrcMem, (outs), (ins VR128:$src1, f128mem:$src2), |
| 1153 | "comisd\t{$src2, $src1|$src1, $src2}", []>; |
| 1154 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1155 | // SSE2 instructions with XS prefix |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1156 | def CVTSS2SDrr : I<0x5A, MRMSrcReg, (outs FR64:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1157 | "cvtss2sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1158 | [(set FR64:$dst, (fextend FR32:$src))]>, XS, |
| 1159 | Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1160 | def CVTSS2SDrm : I<0x5A, MRMSrcMem, (outs FR64:$dst), (ins f32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1161 | "cvtss2sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1162 | [(set FR64:$dst, (extloadf32 addr:$src))]>, XS, |
Evan Cheng | d53fca1 | 2009-12-22 17:47:23 +0000 | [diff] [blame] | 1163 | Requires<[HasSSE2, OptForSize]>; |
Evan Cheng | d3f27fb | 2009-12-18 07:40:29 +0000 | [diff] [blame] | 1164 | |
| 1165 | def : Pat<(extloadf32 addr:$src), |
Evan Cheng | d53fca1 | 2009-12-22 17:47:23 +0000 | [diff] [blame] | 1166 | (CVTSS2SDrr (MOVSSrm addr:$src))>, Requires<[HasSSE2, OptForSpeed]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1167 | |
| 1168 | // Match intrinsics which expect XMM operand(s). |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1169 | def Int_CVTSD2SIrr : SDI<0x2D, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1170 | "cvtsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1171 | [(set GR32:$dst, (int_x86_sse2_cvtsd2si VR128:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1172 | def Int_CVTSD2SIrm : SDI<0x2D, MRMSrcMem, (outs GR32:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1173 | "cvtsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1174 | [(set GR32:$dst, (int_x86_sse2_cvtsd2si |
| 1175 | (load addr:$src)))]>; |
| 1176 | |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 1177 | // Match intrinisics which expect MM and XMM operand(s). |
| 1178 | def Int_CVTPD2PIrr : PDI<0x2D, MRMSrcReg, (outs VR64:$dst), (ins VR128:$src), |
| 1179 | "cvtpd2pi\t{$src, $dst|$dst, $src}", |
| 1180 | [(set VR64:$dst, (int_x86_sse_cvtpd2pi VR128:$src))]>; |
| 1181 | def Int_CVTPD2PIrm : PDI<0x2D, MRMSrcMem, (outs VR64:$dst), (ins f128mem:$src), |
| 1182 | "cvtpd2pi\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1183 | [(set VR64:$dst, (int_x86_sse_cvtpd2pi |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1184 | (memop addr:$src)))]>; |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 1185 | def Int_CVTTPD2PIrr: PDI<0x2C, MRMSrcReg, (outs VR64:$dst), (ins VR128:$src), |
| 1186 | "cvttpd2pi\t{$src, $dst|$dst, $src}", |
| 1187 | [(set VR64:$dst, (int_x86_sse_cvttpd2pi VR128:$src))]>; |
| 1188 | def Int_CVTTPD2PIrm: PDI<0x2C, MRMSrcMem, (outs VR64:$dst), (ins f128mem:$src), |
| 1189 | "cvttpd2pi\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1190 | [(set VR64:$dst, (int_x86_sse_cvttpd2pi |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1191 | (memop addr:$src)))]>; |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 1192 | def Int_CVTPI2PDrr : PDI<0x2A, MRMSrcReg, (outs VR128:$dst), (ins VR64:$src), |
| 1193 | "cvtpi2pd\t{$src, $dst|$dst, $src}", |
| 1194 | [(set VR128:$dst, (int_x86_sse_cvtpi2pd VR64:$src))]>; |
| 1195 | def Int_CVTPI2PDrm : PDI<0x2A, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), |
| 1196 | "cvtpi2pd\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1197 | [(set VR128:$dst, (int_x86_sse_cvtpi2pd |
Dale Johannesen | 1fbb4a5 | 2007-10-30 22:15:38 +0000 | [diff] [blame] | 1198 | (load addr:$src)))]>; |
| 1199 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1200 | // Aliases for intrinsics |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1201 | def Int_CVTTSD2SIrr : SDI<0x2C, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1202 | "cvttsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1203 | [(set GR32:$dst, |
| 1204 | (int_x86_sse2_cvttsd2si VR128:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1205 | def Int_CVTTSD2SIrm : SDI<0x2C, MRMSrcMem, (outs GR32:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1206 | "cvttsd2si\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1207 | [(set GR32:$dst, (int_x86_sse2_cvttsd2si |
| 1208 | (load addr:$src)))]>; |
| 1209 | |
| 1210 | // Comparison instructions |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1211 | let Constraints = "$src1 = $dst", neverHasSideEffects = 1 in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1212 | def CMPSDrr : SDIi8<0xC2, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1213 | (outs FR64:$dst), (ins FR64:$src1, FR64:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1214 | "cmp${cc}sd\t{$src, $dst|$dst, $src}", []>; |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1215 | let mayLoad = 1 in |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1216 | def CMPSDrm : SDIi8<0xC2, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1217 | (outs FR64:$dst), (ins FR64:$src1, f64mem:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1218 | "cmp${cc}sd\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1219 | } |
| 1220 | |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1221 | let Defs = [EFLAGS] in { |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1222 | def UCOMISDrr: PDI<0x2E, MRMSrcReg, (outs), (ins FR64:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1223 | "ucomisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1224 | [(X86cmp FR64:$src1, FR64:$src2), (implicit EFLAGS)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1225 | def UCOMISDrm: PDI<0x2E, MRMSrcMem, (outs), (ins FR64:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1226 | "ucomisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1227 | [(X86cmp FR64:$src1, (loadf64 addr:$src2)), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1228 | (implicit EFLAGS)]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1229 | } // Defs = [EFLAGS] |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1230 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1231 | // Aliases to match intrinsics which expect XMM operand(s). |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1232 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1233 | def Int_CMPSDrr : SDIi8<0xC2, MRMSrcReg, |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1234 | (outs VR128:$dst), |
| 1235 | (ins VR128:$src1, VR128:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1236 | "cmp${cc}sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1237 | [(set VR128:$dst, (int_x86_sse2_cmp_sd VR128:$src1, |
| 1238 | VR128:$src, imm:$cc))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1239 | def Int_CMPSDrm : SDIi8<0xC2, MRMSrcMem, |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1240 | (outs VR128:$dst), |
| 1241 | (ins VR128:$src1, f64mem:$src, SSECC:$cc), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1242 | "cmp${cc}sd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1243 | [(set VR128:$dst, (int_x86_sse2_cmp_sd VR128:$src1, |
| 1244 | (load addr:$src), imm:$cc))]>; |
| 1245 | } |
| 1246 | |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1247 | let Defs = [EFLAGS] in { |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1248 | def Int_UCOMISDrr: PDI<0x2E, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1249 | "ucomisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1250 | [(X86ucomi (v2f64 VR128:$src1), (v2f64 VR128:$src2)), |
| 1251 | (implicit EFLAGS)]>; |
| 1252 | def Int_UCOMISDrm: PDI<0x2E, MRMSrcMem, (outs),(ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1253 | "ucomisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1254 | [(X86ucomi (v2f64 VR128:$src1), (load addr:$src2)), |
| 1255 | (implicit EFLAGS)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1256 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1257 | def Int_COMISDrr: PDI<0x2F, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1258 | "comisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1259 | [(X86comi (v2f64 VR128:$src1), (v2f64 VR128:$src2)), |
| 1260 | (implicit EFLAGS)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1261 | def Int_COMISDrm: PDI<0x2F, MRMSrcMem, (outs), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1262 | "comisd\t{$src2, $src1|$src1, $src2}", |
Evan Cheng | 621216e | 2007-09-29 00:00:36 +0000 | [diff] [blame] | 1263 | [(X86comi (v2f64 VR128:$src1), (load addr:$src2)), |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1264 | (implicit EFLAGS)]>; |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1265 | } // Defs = [EFLAGS] |
Evan Cheng | 950aac0 | 2007-09-25 01:57:46 +0000 | [diff] [blame] | 1266 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1267 | // Aliases of packed SSE2 instructions for scalar use. These all have names |
| 1268 | // that start with 'Fs'. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1269 | |
| 1270 | // Alias instructions that map fld0 to pxor for sse. |
Dan Gohman | 51dbce6 | 2009-09-21 18:30:38 +0000 | [diff] [blame] | 1271 | let isReMaterializable = 1, isAsCheapAsAMove = 1, isCodeGenOnly = 1, |
| 1272 | canFoldAsLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1273 | def FsFLD0SD : I<0xEF, MRMInitReg, (outs FR64:$dst), (ins), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1274 | "pxor\t$dst, $dst", [(set FR64:$dst, fpimm0)]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1275 | Requires<[HasSSE2]>, TB, OpSize; |
| 1276 | |
| 1277 | // Alias instruction to do FR64 reg-to-reg copy using movapd. Upper bits are |
| 1278 | // disregarded. |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1279 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1280 | def FsMOVAPDrr : PDI<0x28, MRMSrcReg, (outs FR64:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1281 | "movapd\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1282 | |
| 1283 | // Alias instruction to load FR64 from f128mem using movapd. Upper bits are |
| 1284 | // disregarded. |
Evan Cheng | 8e66471 | 2009-11-17 09:51:18 +0000 | [diff] [blame] | 1285 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1286 | def FsMOVAPDrm : PDI<0x28, MRMSrcMem, (outs FR64:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1287 | "movapd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 1288 | [(set FR64:$dst, (alignedloadfsf64 addr:$src))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1289 | |
| 1290 | // Alias bitwise logical operations using SSE logical ops on packed FP values. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1291 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1292 | let isCommutable = 1 in { |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1293 | def FsANDPDrr : PDI<0x54, MRMSrcReg, (outs FR64:$dst), |
| 1294 | (ins FR64:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1295 | "andpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1296 | [(set FR64:$dst, (X86fand FR64:$src1, FR64:$src2))]>; |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1297 | def FsORPDrr : PDI<0x56, MRMSrcReg, (outs FR64:$dst), |
| 1298 | (ins FR64:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1299 | "orpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1300 | [(set FR64:$dst, (X86for FR64:$src1, FR64:$src2))]>; |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1301 | def FsXORPDrr : PDI<0x57, MRMSrcReg, (outs FR64:$dst), |
| 1302 | (ins FR64:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1303 | "xorpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1304 | [(set FR64:$dst, (X86fxor FR64:$src1, FR64:$src2))]>; |
| 1305 | } |
| 1306 | |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1307 | def FsANDPDrm : PDI<0x54, MRMSrcMem, (outs FR64:$dst), |
| 1308 | (ins FR64:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1309 | "andpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1310 | [(set FR64:$dst, (X86fand FR64:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 1311 | (memopfsf64 addr:$src2)))]>; |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1312 | def FsORPDrm : PDI<0x56, MRMSrcMem, (outs FR64:$dst), |
| 1313 | (ins FR64:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1314 | "orpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1315 | [(set FR64:$dst, (X86for FR64:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 1316 | (memopfsf64 addr:$src2)))]>; |
Evan Cheng | 0e3e01d | 2008-05-02 07:53:32 +0000 | [diff] [blame] | 1317 | def FsXORPDrm : PDI<0x57, MRMSrcMem, (outs FR64:$dst), |
| 1318 | (ins FR64:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1319 | "xorpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1320 | [(set FR64:$dst, (X86fxor FR64:$src1, |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 1321 | (memopfsf64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1322 | |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1323 | let neverHasSideEffects = 1 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1324 | def FsANDNPDrr : PDI<0x55, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1325 | (outs FR64:$dst), (ins FR64:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1326 | "andnpd\t{$src2, $dst|$dst, $src2}", []>; |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1327 | let mayLoad = 1 in |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1328 | def FsANDNPDrm : PDI<0x55, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1329 | (outs FR64:$dst), (ins FR64:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1330 | "andnpd\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1331 | } |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1332 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1333 | |
| 1334 | /// basic_sse2_fp_binop_rm - SSE2 binops come in both scalar and vector forms. |
| 1335 | /// |
| 1336 | /// In addition, we also have a special variant of the scalar form here to |
| 1337 | /// represent the associated intrinsic operation. This form is unlike the |
| 1338 | /// 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] | 1339 | /// and leaves the top elements unmodified (therefore these cannot be commuted). |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1340 | /// |
| 1341 | /// These three forms can each be reg+reg or reg+mem, so there are a total of |
| 1342 | /// six "instructions". |
| 1343 | /// |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1344 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1345 | multiclass basic_sse2_fp_binop_rm<bits<8> opc, string OpcodeStr, |
| 1346 | SDNode OpNode, Intrinsic F64Int, |
| 1347 | bit Commutable = 0> { |
| 1348 | // Scalar operation, reg+reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1349 | 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] | 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, FR64:$src2))]> { |
| 1352 | let isCommutable = Commutable; |
| 1353 | } |
| 1354 | |
| 1355 | // Scalar operation, reg+mem. |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1356 | def SDrm : SDI<opc, MRMSrcMem, (outs FR64:$dst), |
| 1357 | (ins FR64:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1358 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1359 | [(set FR64:$dst, (OpNode FR64:$src1, (load addr:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1360 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1361 | // Vector operation, reg+reg. |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1362 | def PDrr : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1363 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1364 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1365 | [(set VR128:$dst, (v2f64 (OpNode VR128:$src1, VR128:$src2)))]> { |
| 1366 | let isCommutable = Commutable; |
| 1367 | } |
| 1368 | |
| 1369 | // Vector operation, reg+mem. |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1370 | def PDrm : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1371 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1372 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1373 | [(set VR128:$dst, (OpNode VR128:$src1, (memopv2f64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1374 | |
| 1375 | // Intrinsic operation, reg+reg. |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1376 | def SDrr_Int : SDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1377 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1378 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 5d5dbbc | 2009-02-26 03:12:02 +0000 | [diff] [blame] | 1379 | [(set VR128:$dst, (F64Int VR128:$src1, VR128:$src2))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1380 | |
| 1381 | // Intrinsic operation, reg+mem. |
Dan Gohman | f221da1 | 2009-01-09 02:27:34 +0000 | [diff] [blame] | 1382 | def SDrm_Int : SDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1383 | (ins VR128:$src1, sdmem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1384 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1385 | [(set VR128:$dst, (F64Int VR128:$src1, |
| 1386 | sse_load_f64:$src2))]>; |
| 1387 | } |
| 1388 | } |
| 1389 | |
| 1390 | // Arithmetic instructions |
| 1391 | defm ADD : basic_sse2_fp_binop_rm<0x58, "add", fadd, int_x86_sse2_add_sd, 1>; |
| 1392 | defm MUL : basic_sse2_fp_binop_rm<0x59, "mul", fmul, int_x86_sse2_mul_sd, 1>; |
| 1393 | defm SUB : basic_sse2_fp_binop_rm<0x5C, "sub", fsub, int_x86_sse2_sub_sd>; |
| 1394 | defm DIV : basic_sse2_fp_binop_rm<0x5E, "div", fdiv, int_x86_sse2_div_sd>; |
| 1395 | |
| 1396 | /// sse2_fp_binop_rm - Other SSE2 binops |
| 1397 | /// |
| 1398 | /// This multiclass is like basic_sse2_fp_binop_rm, with the addition of |
| 1399 | /// instructions for a full-vector intrinsic form. Operations that map |
| 1400 | /// onto C operators don't use this form since they just use the plain |
| 1401 | /// vector form instead of having a separate vector intrinsic form. |
| 1402 | /// |
| 1403 | /// This provides a total of eight "instructions". |
| 1404 | /// |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1405 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1406 | multiclass sse2_fp_binop_rm<bits<8> opc, string OpcodeStr, |
| 1407 | SDNode OpNode, |
| 1408 | Intrinsic F64Int, |
| 1409 | Intrinsic V2F64Int, |
| 1410 | bit Commutable = 0> { |
| 1411 | |
| 1412 | // Scalar operation, reg+reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1413 | 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] | 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, FR64:$src2))]> { |
| 1416 | let isCommutable = Commutable; |
| 1417 | } |
| 1418 | |
| 1419 | // Scalar operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1420 | def SDrm : SDI<opc, MRMSrcMem, (outs FR64:$dst), |
| 1421 | (ins FR64:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1422 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1423 | [(set FR64:$dst, (OpNode FR64:$src1, (load addr:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1424 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1425 | // Vector operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1426 | def PDrr : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1427 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1428 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1429 | [(set VR128:$dst, (v2f64 (OpNode VR128:$src1, VR128:$src2)))]> { |
| 1430 | let isCommutable = Commutable; |
| 1431 | } |
| 1432 | |
| 1433 | // Vector operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1434 | def PDrm : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1435 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1436 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1437 | [(set VR128:$dst, (OpNode VR128:$src1, (memopv2f64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1438 | |
| 1439 | // Intrinsic operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1440 | def SDrr_Int : SDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1441 | (ins VR128:$src1, VR128:$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, VR128:$src2))]> { |
| 1444 | let isCommutable = Commutable; |
| 1445 | } |
| 1446 | |
| 1447 | // Intrinsic operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1448 | def SDrm_Int : SDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1449 | (ins VR128:$src1, sdmem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1450 | !strconcat(OpcodeStr, "sd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1451 | [(set VR128:$dst, (F64Int VR128:$src1, |
| 1452 | sse_load_f64:$src2))]>; |
| 1453 | |
| 1454 | // Vector intrinsic operation, reg+reg. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1455 | def PDrr_Int : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1456 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1457 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1458 | [(set VR128:$dst, (V2F64Int VR128:$src1, VR128:$src2))]> { |
| 1459 | let isCommutable = Commutable; |
| 1460 | } |
| 1461 | |
| 1462 | // Vector intrinsic operation, reg+mem. |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1463 | def PDrm_Int : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1464 | (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1465 | !strconcat(OpcodeStr, "pd\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1466 | [(set VR128:$dst, (V2F64Int VR128:$src1, |
| 1467 | (memopv2f64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1468 | } |
| 1469 | } |
| 1470 | |
| 1471 | defm MAX : sse2_fp_binop_rm<0x5F, "max", X86fmax, |
| 1472 | int_x86_sse2_max_sd, int_x86_sse2_max_pd>; |
| 1473 | defm MIN : sse2_fp_binop_rm<0x5D, "min", X86fmin, |
| 1474 | int_x86_sse2_min_sd, int_x86_sse2_min_pd>; |
| 1475 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1476 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1477 | // SSE packed FP Instructions |
| 1478 | |
| 1479 | // Move Instructions |
Chris Lattner | c90ee9c | 2008-01-10 07:59:24 +0000 | [diff] [blame] | 1480 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1481 | def MOVAPDrr : PDI<0x28, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1482 | "movapd\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1483 | let canFoldAsLoad = 1, isReMaterializable = 1, mayHaveSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1484 | def MOVAPDrm : PDI<0x28, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1485 | "movapd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1486 | [(set VR128:$dst, (alignedloadv2f64 addr:$src))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1487 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1488 | def MOVAPDmr : PDI<0x29, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1489 | "movapd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1490 | [(alignedstore (v2f64 VR128:$src), addr:$dst)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1491 | |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1492 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1493 | def MOVUPDrr : PDI<0x10, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1494 | "movupd\t{$src, $dst|$dst, $src}", []>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1495 | let canFoldAsLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1496 | def MOVUPDrm : 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, (loadv2f64 addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1499 | def MOVUPDmr : 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 | [(store (v2f64 VR128:$src), addr:$dst)]>; |
| 1502 | |
| 1503 | // Intrinsic forms of MOVUPD load and store |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1504 | def MOVUPDrm_Int : PDI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1505 | "movupd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1506 | [(set VR128:$dst, (int_x86_sse2_loadu_pd addr:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1507 | def MOVUPDmr_Int : PDI<0x11, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1508 | "movupd\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1509 | [(int_x86_sse2_storeu_pd addr:$dst, VR128:$src)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1510 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1511 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1512 | let AddedComplexity = 20 in { |
| 1513 | def MOVLPDrm : PDI<0x12, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1514 | (outs VR128:$dst), (ins VR128:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1515 | "movlpd\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1516 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1517 | (v2f64 (movlp VR128:$src1, |
| 1518 | (scalar_to_vector (loadf64 addr:$src2)))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1519 | def MOVHPDrm : PDI<0x16, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1520 | (outs VR128:$dst), (ins VR128:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1521 | "movhpd\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1522 | [(set VR128:$dst, |
Nate Begeman | b13034d | 2009-11-07 23:17:15 +0000 | [diff] [blame] | 1523 | (v2f64 (movlhps VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1524 | (scalar_to_vector (loadf64 addr:$src2)))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1525 | } // AddedComplexity |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1526 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1527 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1528 | def MOVLPDmr : PDI<0x13, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1529 | "movlpd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1530 | [(store (f64 (vector_extract (v2f64 VR128:$src), |
| 1531 | (iPTR 0))), addr:$dst)]>; |
| 1532 | |
| 1533 | // v2f64 extract element 1 is always custom lowered to unpack high to low |
| 1534 | // 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] | 1535 | def MOVHPDmr : PDI<0x17, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1536 | "movhpd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1537 | [(store (f64 (vector_extract |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1538 | (v2f64 (unpckh VR128:$src, (undef))), |
| 1539 | (iPTR 0))), addr:$dst)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1540 | |
| 1541 | // SSE2 instructions without OpSize prefix |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1542 | def Int_CVTDQ2PSrr : I<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1543 | "cvtdq2ps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1544 | [(set VR128:$dst, (int_x86_sse2_cvtdq2ps VR128:$src))]>, |
| 1545 | TB, Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1546 | def Int_CVTDQ2PSrm : I<0x5B, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1547 | "cvtdq2ps\t{$src, $dst|$dst, $src}", |
| 1548 | [(set VR128:$dst, (int_x86_sse2_cvtdq2ps |
| 1549 | (bitconvert (memopv2i64 addr:$src))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1550 | TB, Requires<[HasSSE2]>; |
| 1551 | |
| 1552 | // SSE2 instructions with XS prefix |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1553 | def Int_CVTDQ2PDrr : I<0xE6, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1554 | "cvtdq2pd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1555 | [(set VR128:$dst, (int_x86_sse2_cvtdq2pd VR128:$src))]>, |
| 1556 | XS, Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1557 | def Int_CVTDQ2PDrm : I<0xE6, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1558 | "cvtdq2pd\t{$src, $dst|$dst, $src}", |
| 1559 | [(set VR128:$dst, (int_x86_sse2_cvtdq2pd |
| 1560 | (bitconvert (memopv2i64 addr:$src))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1561 | XS, Requires<[HasSSE2]>; |
| 1562 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1563 | def Int_CVTPS2DQrr : PDI<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1564 | "cvtps2dq\t{$src, $dst|$dst, $src}", |
| 1565 | [(set VR128:$dst, (int_x86_sse2_cvtps2dq VR128:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1566 | def Int_CVTPS2DQrm : PDI<0x5B, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1567 | "cvtps2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1568 | [(set VR128:$dst, (int_x86_sse2_cvtps2dq |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1569 | (memop addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1570 | // SSE2 packed instructions with XS prefix |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1571 | def CVTTPS2DQrr : SSI<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1572 | "cvttps2dq\t{$src, $dst|$dst, $src}", []>; |
| 1573 | def CVTTPS2DQrm : SSI<0x5B, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
| 1574 | "cvttps2dq\t{$src, $dst|$dst, $src}", []>; |
| 1575 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1576 | def Int_CVTTPS2DQrr : I<0x5B, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1577 | "cvttps2dq\t{$src, $dst|$dst, $src}", |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1578 | [(set VR128:$dst, |
| 1579 | (int_x86_sse2_cvttps2dq VR128:$src))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1580 | XS, Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1581 | def Int_CVTTPS2DQrm : I<0x5B, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1582 | "cvttps2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1583 | [(set VR128:$dst, (int_x86_sse2_cvttps2dq |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1584 | (memop addr:$src)))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1585 | XS, Requires<[HasSSE2]>; |
| 1586 | |
| 1587 | // SSE2 packed instructions with XD prefix |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1588 | def Int_CVTPD2DQrr : I<0xE6, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1589 | "cvtpd2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1590 | [(set VR128:$dst, (int_x86_sse2_cvtpd2dq VR128:$src))]>, |
| 1591 | XD, Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1592 | def Int_CVTPD2DQrm : I<0xE6, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1593 | "cvtpd2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1594 | [(set VR128:$dst, (int_x86_sse2_cvtpd2dq |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1595 | (memop addr:$src)))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1596 | XD, Requires<[HasSSE2]>; |
| 1597 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1598 | def Int_CVTTPD2DQrr : PDI<0xE6, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1599 | "cvttpd2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1600 | [(set VR128:$dst, (int_x86_sse2_cvttpd2dq VR128:$src))]>; |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1601 | def Int_CVTTPD2DQrm : PDI<0xE6, MRMSrcMem, (outs VR128:$dst),(ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1602 | "cvttpd2dq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1603 | [(set VR128:$dst, (int_x86_sse2_cvttpd2dq |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1604 | (memop addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1605 | |
| 1606 | // SSE2 instructions without OpSize prefix |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1607 | def CVTPS2PDrr : I<0x5A, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1608 | "cvtps2pd\t{$src, $dst|$dst, $src}", []>, TB; |
| 1609 | def CVTPS2PDrm : I<0x5A, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src), |
| 1610 | "cvtps2pd\t{$src, $dst|$dst, $src}", []>, TB; |
| 1611 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1612 | def Int_CVTPS2PDrr : I<0x5A, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1613 | "cvtps2pd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1614 | [(set VR128:$dst, (int_x86_sse2_cvtps2pd VR128:$src))]>, |
| 1615 | TB, Requires<[HasSSE2]>; |
Mon P Wang | aa3f266 | 2008-05-28 00:42:27 +0000 | [diff] [blame] | 1616 | def Int_CVTPS2PDrm : I<0x5A, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1617 | "cvtps2pd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1618 | [(set VR128:$dst, (int_x86_sse2_cvtps2pd |
| 1619 | (load addr:$src)))]>, |
| 1620 | TB, Requires<[HasSSE2]>; |
| 1621 | |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1622 | def CVTPD2PSrr : PDI<0x5A, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 1623 | "cvtpd2ps\t{$src, $dst|$dst, $src}", []>; |
| 1624 | def CVTPD2PSrm : PDI<0x5A, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
| 1625 | "cvtpd2ps\t{$src, $dst|$dst, $src}", []>; |
| 1626 | |
| 1627 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1628 | def Int_CVTPD2PSrr : PDI<0x5A, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1629 | "cvtpd2ps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1630 | [(set VR128:$dst, (int_x86_sse2_cvtpd2ps VR128:$src))]>; |
Mon P Wang | aa3f266 | 2008-05-28 00:42:27 +0000 | [diff] [blame] | 1631 | def Int_CVTPD2PSrm : PDI<0x5A, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1632 | "cvtpd2ps\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1633 | [(set VR128:$dst, (int_x86_sse2_cvtpd2ps |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1634 | (memop addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1635 | |
| 1636 | // Match intrinsics which expect XMM operand(s). |
| 1637 | // Aliases for intrinsics |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1638 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1639 | def Int_CVTSI2SDrr: SDI<0x2A, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1640 | (outs VR128:$dst), (ins VR128:$src1, GR32:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1641 | "cvtsi2sd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1642 | [(set VR128:$dst, (int_x86_sse2_cvtsi2sd VR128:$src1, |
| 1643 | GR32:$src2))]>; |
| 1644 | def Int_CVTSI2SDrm: SDI<0x2A, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1645 | (outs VR128:$dst), (ins VR128:$src1, i32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1646 | "cvtsi2sd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1647 | [(set VR128:$dst, (int_x86_sse2_cvtsi2sd VR128:$src1, |
| 1648 | (loadi32 addr:$src2)))]>; |
| 1649 | def Int_CVTSD2SSrr: SDI<0x5A, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1650 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1651 | "cvtsd2ss\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1652 | [(set VR128:$dst, (int_x86_sse2_cvtsd2ss VR128:$src1, |
| 1653 | VR128:$src2))]>; |
| 1654 | def Int_CVTSD2SSrm: SDI<0x5A, MRMSrcMem, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1655 | (outs VR128:$dst), (ins VR128:$src1, f64mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1656 | "cvtsd2ss\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1657 | [(set VR128:$dst, (int_x86_sse2_cvtsd2ss VR128:$src1, |
| 1658 | (load addr:$src2)))]>; |
| 1659 | def Int_CVTSS2SDrr: I<0x5A, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1660 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1661 | "cvtss2sd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1662 | [(set VR128:$dst, (int_x86_sse2_cvtss2sd VR128:$src1, |
| 1663 | VR128:$src2))]>, XS, |
| 1664 | Requires<[HasSSE2]>; |
| 1665 | def Int_CVTSS2SDrm: I<0x5A, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1666 | (outs VR128:$dst), (ins VR128:$src1, f32mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1667 | "cvtss2sd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1668 | [(set VR128:$dst, (int_x86_sse2_cvtss2sd VR128:$src1, |
| 1669 | (load addr:$src2)))]>, XS, |
| 1670 | Requires<[HasSSE2]>; |
| 1671 | } |
| 1672 | |
| 1673 | // Arithmetic |
| 1674 | |
| 1675 | /// sse2_fp_unop_rm - SSE2 unops come in both scalar and vector forms. |
| 1676 | /// |
| 1677 | /// In addition, we also have a special variant of the scalar form here to |
| 1678 | /// represent the associated intrinsic operation. This form is unlike the |
| 1679 | /// plain scalar form, in that it takes an entire vector (instead of a |
| 1680 | /// scalar) and leaves the top elements undefined. |
| 1681 | /// |
| 1682 | /// And, we have a special variant form for a full-vector intrinsic form. |
| 1683 | /// |
| 1684 | /// These four forms can each have a reg or a mem operand, so there are a |
| 1685 | /// total of eight "instructions". |
| 1686 | /// |
| 1687 | multiclass sse2_fp_unop_rm<bits<8> opc, string OpcodeStr, |
| 1688 | SDNode OpNode, |
| 1689 | Intrinsic F64Int, |
| 1690 | Intrinsic V2F64Int, |
| 1691 | bit Commutable = 0> { |
| 1692 | // Scalar operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1693 | def SDr : SDI<opc, MRMSrcReg, (outs FR64:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1694 | !strconcat(OpcodeStr, "sd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1695 | [(set FR64:$dst, (OpNode FR64:$src))]> { |
| 1696 | let isCommutable = Commutable; |
| 1697 | } |
| 1698 | |
| 1699 | // Scalar operation, mem. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1700 | def SDm : SDI<opc, MRMSrcMem, (outs FR64:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1701 | !strconcat(OpcodeStr, "sd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1702 | [(set FR64:$dst, (OpNode (load addr:$src)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1703 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1704 | // Vector operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1705 | def PDr : PDI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1706 | !strconcat(OpcodeStr, "pd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1707 | [(set VR128:$dst, (v2f64 (OpNode VR128:$src)))]> { |
| 1708 | let isCommutable = Commutable; |
| 1709 | } |
| 1710 | |
| 1711 | // Vector operation, mem. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1712 | def PDm : PDI<opc, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1713 | !strconcat(OpcodeStr, "pd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1714 | [(set VR128:$dst, (OpNode (memopv2f64 addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1715 | |
| 1716 | // Intrinsic operation, reg. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1717 | def SDr_Int : SDI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1718 | !strconcat(OpcodeStr, "sd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1719 | [(set VR128:$dst, (F64Int VR128:$src))]> { |
| 1720 | let isCommutable = Commutable; |
| 1721 | } |
| 1722 | |
| 1723 | // Intrinsic operation, mem. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1724 | def SDm_Int : SDI<opc, MRMSrcMem, (outs VR128:$dst), (ins sdmem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1725 | !strconcat(OpcodeStr, "sd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1726 | [(set VR128:$dst, (F64Int sse_load_f64:$src))]>; |
| 1727 | |
| 1728 | // Vector intrinsic operation, reg |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1729 | def PDr_Int : PDI<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1730 | !strconcat(OpcodeStr, "pd\t{$src, $dst|$dst, $src}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1731 | [(set VR128:$dst, (V2F64Int VR128:$src))]> { |
| 1732 | let isCommutable = Commutable; |
| 1733 | } |
| 1734 | |
| 1735 | // Vector intrinsic operation, mem |
Dan Gohman | c747be5 | 2007-08-02 21:06:40 +0000 | [diff] [blame] | 1736 | def PDm_Int : PDI<opc, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1737 | !strconcat(OpcodeStr, "pd\t{$src, $dst|$dst, $src}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1738 | [(set VR128:$dst, (V2F64Int (memopv2f64 addr:$src)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1739 | } |
| 1740 | |
| 1741 | // Square root. |
| 1742 | defm SQRT : sse2_fp_unop_rm<0x51, "sqrt", fsqrt, |
| 1743 | int_x86_sse2_sqrt_sd, int_x86_sse2_sqrt_pd>; |
| 1744 | |
| 1745 | // There is no f64 version of the reciprocal approximation instructions. |
| 1746 | |
| 1747 | // Logical |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1748 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1749 | let isCommutable = 1 in { |
| 1750 | def ANDPDrr : PDI<0x54, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1751 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1752 | "andpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1753 | [(set VR128:$dst, |
| 1754 | (and (bc_v2i64 (v2f64 VR128:$src1)), |
| 1755 | (bc_v2i64 (v2f64 VR128:$src2))))]>; |
| 1756 | def ORPDrr : PDI<0x56, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1757 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1758 | "orpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1759 | [(set VR128:$dst, |
| 1760 | (or (bc_v2i64 (v2f64 VR128:$src1)), |
| 1761 | (bc_v2i64 (v2f64 VR128:$src2))))]>; |
| 1762 | def XORPDrr : PDI<0x57, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1763 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1764 | "xorpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1765 | [(set VR128:$dst, |
| 1766 | (xor (bc_v2i64 (v2f64 VR128:$src1)), |
| 1767 | (bc_v2i64 (v2f64 VR128:$src2))))]>; |
| 1768 | } |
| 1769 | |
| 1770 | def ANDPDrm : PDI<0x54, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1771 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1772 | "andpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1773 | [(set VR128:$dst, |
| 1774 | (and (bc_v2i64 (v2f64 VR128:$src1)), |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 1775 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1776 | def ORPDrm : PDI<0x56, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1777 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1778 | "orpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1779 | [(set VR128:$dst, |
| 1780 | (or (bc_v2i64 (v2f64 VR128:$src1)), |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 1781 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1782 | def XORPDrm : PDI<0x57, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1783 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1784 | "xorpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1785 | [(set VR128:$dst, |
| 1786 | (xor (bc_v2i64 (v2f64 VR128:$src1)), |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 1787 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1788 | def ANDNPDrr : PDI<0x55, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1789 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1790 | "andnpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1791 | [(set VR128:$dst, |
| 1792 | (and (vnot (bc_v2i64 (v2f64 VR128:$src1))), |
| 1793 | (bc_v2i64 (v2f64 VR128:$src2))))]>; |
| 1794 | def ANDNPDrm : PDI<0x55, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1795 | (outs VR128:$dst), (ins VR128:$src1,f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1796 | "andnpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1797 | [(set VR128:$dst, |
| 1798 | (and (vnot (bc_v2i64 (v2f64 VR128:$src1))), |
Evan Cheng | 8e92cd1 | 2007-07-19 23:34:10 +0000 | [diff] [blame] | 1799 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1800 | } |
| 1801 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1802 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1803 | def CMPPDrri : PDIi8<0xC2, MRMSrcReg, |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1804 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src, SSECC:$cc), |
| 1805 | "cmp${cc}pd\t{$src, $dst|$dst, $src}", |
| 1806 | [(set VR128:$dst, (int_x86_sse2_cmp_pd VR128:$src1, |
Nate Begeman | 061db5f | 2008-05-12 20:34:32 +0000 | [diff] [blame] | 1807 | VR128:$src, imm:$cc))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1808 | def CMPPDrmi : PDIi8<0xC2, MRMSrcMem, |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1809 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src, SSECC:$cc), |
| 1810 | "cmp${cc}pd\t{$src, $dst|$dst, $src}", |
| 1811 | [(set VR128:$dst, (int_x86_sse2_cmp_pd VR128:$src1, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 1812 | (memop addr:$src), imm:$cc))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1813 | } |
Evan Cheng | 3375409 | 2008-08-05 22:19:15 +0000 | [diff] [blame] | 1814 | def : Pat<(v2i64 (X86cmppd (v2f64 VR128:$src1), VR128:$src2, imm:$cc)), |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 1815 | (CMPPDrri VR128:$src1, VR128:$src2, imm:$cc)>; |
Evan Cheng | 3375409 | 2008-08-05 22:19:15 +0000 | [diff] [blame] | 1816 | def : Pat<(v2i64 (X86cmppd (v2f64 VR128:$src1), (memop addr:$src2), imm:$cc)), |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 1817 | (CMPPDrmi VR128:$src1, addr:$src2, imm:$cc)>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1818 | |
| 1819 | // Shuffle and unpack instructions |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1820 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1821 | def SHUFPDrri : PDIi8<0xC6, MRMSrcReg, |
Evan Cheng | 14c97c3 | 2008-03-14 07:46:48 +0000 | [diff] [blame] | 1822 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2, i8imm:$src3), |
| 1823 | "shufpd\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1824 | [(set VR128:$dst, |
| 1825 | (v2f64 (shufp:$src3 VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1826 | def SHUFPDrmi : PDIi8<0xC6, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1827 | (outs VR128:$dst), (ins VR128:$src1, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1828 | f128mem:$src2, i8imm:$src3), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1829 | "shufpd\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
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 (shufp:$src3 |
| 1832 | VR128:$src1, (memopv2f64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1833 | |
| 1834 | let AddedComplexity = 10 in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1835 | def UNPCKHPDrr : PDI<0x15, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1836 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1837 | "unpckhpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1838 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1839 | (v2f64 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1840 | def UNPCKHPDrm : PDI<0x15, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1841 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1842 | "unpckhpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1843 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1844 | (v2f64 (unpckh VR128:$src1, |
| 1845 | (memopv2f64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1846 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1847 | def UNPCKLPDrr : PDI<0x14, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1848 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1849 | "unpcklpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1850 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1851 | (v2f64 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1852 | def UNPCKLPDrm : PDI<0x14, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1853 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1854 | "unpcklpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1855 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 1856 | (unpckl VR128:$src1, (memopv2f64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1857 | } // AddedComplexity |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1858 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1859 | |
| 1860 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1861 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1862 | // SSE integer instructions |
| 1863 | |
| 1864 | // Move Instructions |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1865 | let neverHasSideEffects = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1866 | def MOVDQArr : PDI<0x6F, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1867 | "movdqa\t{$src, $dst|$dst, $src}", []>; |
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 MOVDQArm : PDI<0x6F, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1870 | "movdqa\t{$src, $dst|$dst, $src}", |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 1871 | [/*(set VR128:$dst, (alignedloadv2i64 addr:$src))*/]>; |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1872 | let mayStore = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1873 | def MOVDQAmr : PDI<0x7F, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1874 | "movdqa\t{$src, $dst|$dst, $src}", |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 1875 | [/*(alignedstore (v2i64 VR128:$src), addr:$dst)*/]>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1876 | let canFoldAsLoad = 1, mayLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1877 | def MOVDQUrm : I<0x6F, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1878 | "movdqu\t{$src, $dst|$dst, $src}", |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 1879 | [/*(set VR128:$dst, (loadv2i64 addr:$src))*/]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1880 | XS, Requires<[HasSSE2]>; |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 1881 | let mayStore = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1882 | def MOVDQUmr : I<0x7F, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1883 | "movdqu\t{$src, $dst|$dst, $src}", |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 1884 | [/*(store (v2i64 VR128:$src), addr:$dst)*/]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1885 | XS, Requires<[HasSSE2]>; |
| 1886 | |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1887 | // Intrinsic forms of MOVDQU load and store |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 1888 | let canFoldAsLoad = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1889 | def MOVDQUrm_Int : I<0x6F, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1890 | "movdqu\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1891 | [(set VR128:$dst, (int_x86_sse2_loadu_dq addr:$src))]>, |
| 1892 | XS, Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 1893 | def MOVDQUmr_Int : I<0x7F, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1894 | "movdqu\t{$src, $dst|$dst, $src}", |
Dan Gohman | 4a4f151 | 2007-07-18 20:23:34 +0000 | [diff] [blame] | 1895 | [(int_x86_sse2_storeu_dq addr:$dst, VR128:$src)]>, |
| 1896 | XS, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1897 | |
Evan Cheng | 8800475 | 2008-03-05 08:11:27 +0000 | [diff] [blame] | 1898 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1899 | |
| 1900 | multiclass PDI_binop_rm_int<bits<8> opc, string OpcodeStr, Intrinsic IntId, |
| 1901 | bit Commutable = 0> { |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1902 | def rr : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1903 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1904 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1905 | [(set VR128:$dst, (IntId VR128:$src1, VR128:$src2))]> { |
| 1906 | let isCommutable = Commutable; |
| 1907 | } |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1908 | def rm : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1909 | (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1910 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1911 | [(set VR128:$dst, (IntId VR128:$src1, |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1912 | (bitconvert (memopv2i64 |
| 1913 | addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1914 | } |
| 1915 | |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 1916 | multiclass PDI_binop_rmi_int<bits<8> opc, bits<8> opc2, Format ImmForm, |
| 1917 | string OpcodeStr, |
| 1918 | Intrinsic IntId, Intrinsic IntId2> { |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1919 | def rr : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1920 | (ins VR128:$src1, VR128:$src2), |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 1921 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 1922 | [(set VR128:$dst, (IntId VR128:$src1, VR128:$src2))]>; |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1923 | def rm : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1924 | (ins VR128:$src1, i128mem:$src2), |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 1925 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 1926 | [(set VR128:$dst, (IntId VR128:$src1, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1927 | (bitconvert (memopv2i64 addr:$src2))))]>; |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1928 | def ri : PDIi8<opc2, ImmForm, (outs VR128:$dst), |
| 1929 | (ins VR128:$src1, i32i8imm:$src2), |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 1930 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 1931 | [(set VR128:$dst, (IntId2 VR128:$src1, (i32 imm:$src2)))]>; |
| 1932 | } |
| 1933 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1934 | /// PDI_binop_rm - Simple SSE2 binary operator. |
| 1935 | multiclass PDI_binop_rm<bits<8> opc, string OpcodeStr, SDNode OpNode, |
| 1936 | ValueType OpVT, bit Commutable = 0> { |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1937 | def rr : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
| 1938 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1939 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1940 | [(set VR128:$dst, (OpVT (OpNode VR128:$src1, VR128:$src2)))]> { |
| 1941 | let isCommutable = Commutable; |
| 1942 | } |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1943 | def rm : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
| 1944 | (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1945 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1946 | [(set VR128:$dst, (OpVT (OpNode VR128:$src1, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1947 | (bitconvert (memopv2i64 addr:$src2)))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1948 | } |
| 1949 | |
| 1950 | /// PDI_binop_rm_v2i64 - Simple SSE2 binary operator whose type is v2i64. |
| 1951 | /// |
| 1952 | /// FIXME: we could eliminate this and use PDI_binop_rm instead if tblgen knew |
| 1953 | /// to collapse (bitconvert VT to VT) into its operand. |
| 1954 | /// |
| 1955 | multiclass PDI_binop_rm_v2i64<bits<8> opc, string OpcodeStr, SDNode OpNode, |
| 1956 | bit Commutable = 0> { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1957 | def rr : PDI<opc, MRMSrcReg, (outs VR128:$dst), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1958 | (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1959 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1960 | [(set VR128:$dst, (v2i64 (OpNode VR128:$src1, VR128:$src2)))]> { |
| 1961 | let isCommutable = Commutable; |
| 1962 | } |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1963 | def rm : PDI<opc, MRMSrcMem, (outs VR128:$dst), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1964 | (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 1965 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 1966 | [(set VR128:$dst, (OpNode VR128:$src1, |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 1967 | (memopv2i64 addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1968 | } |
| 1969 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 1970 | } // Constraints = "$src1 = $dst" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1971 | |
| 1972 | // 128-bit Integer Arithmetic |
| 1973 | |
| 1974 | defm PADDB : PDI_binop_rm<0xFC, "paddb", add, v16i8, 1>; |
| 1975 | defm PADDW : PDI_binop_rm<0xFD, "paddw", add, v8i16, 1>; |
| 1976 | defm PADDD : PDI_binop_rm<0xFE, "paddd", add, v4i32, 1>; |
| 1977 | defm PADDQ : PDI_binop_rm_v2i64<0xD4, "paddq", add, 1>; |
| 1978 | |
| 1979 | defm PADDSB : PDI_binop_rm_int<0xEC, "paddsb" , int_x86_sse2_padds_b, 1>; |
| 1980 | defm PADDSW : PDI_binop_rm_int<0xED, "paddsw" , int_x86_sse2_padds_w, 1>; |
| 1981 | defm PADDUSB : PDI_binop_rm_int<0xDC, "paddusb", int_x86_sse2_paddus_b, 1>; |
| 1982 | defm PADDUSW : PDI_binop_rm_int<0xDD, "paddusw", int_x86_sse2_paddus_w, 1>; |
| 1983 | |
| 1984 | defm PSUBB : PDI_binop_rm<0xF8, "psubb", sub, v16i8>; |
| 1985 | defm PSUBW : PDI_binop_rm<0xF9, "psubw", sub, v8i16>; |
| 1986 | defm PSUBD : PDI_binop_rm<0xFA, "psubd", sub, v4i32>; |
| 1987 | defm PSUBQ : PDI_binop_rm_v2i64<0xFB, "psubq", sub>; |
| 1988 | |
| 1989 | defm PSUBSB : PDI_binop_rm_int<0xE8, "psubsb" , int_x86_sse2_psubs_b>; |
| 1990 | defm PSUBSW : PDI_binop_rm_int<0xE9, "psubsw" , int_x86_sse2_psubs_w>; |
| 1991 | defm PSUBUSB : PDI_binop_rm_int<0xD8, "psubusb", int_x86_sse2_psubus_b>; |
| 1992 | defm PSUBUSW : PDI_binop_rm_int<0xD9, "psubusw", int_x86_sse2_psubus_w>; |
| 1993 | |
| 1994 | defm PMULLW : PDI_binop_rm<0xD5, "pmullw", mul, v8i16, 1>; |
| 1995 | |
| 1996 | defm PMULHUW : PDI_binop_rm_int<0xE4, "pmulhuw", int_x86_sse2_pmulhu_w, 1>; |
| 1997 | defm PMULHW : PDI_binop_rm_int<0xE5, "pmulhw" , int_x86_sse2_pmulh_w , 1>; |
| 1998 | defm PMULUDQ : PDI_binop_rm_int<0xF4, "pmuludq", int_x86_sse2_pmulu_dq, 1>; |
| 1999 | |
| 2000 | defm PMADDWD : PDI_binop_rm_int<0xF5, "pmaddwd", int_x86_sse2_pmadd_wd, 1>; |
| 2001 | |
| 2002 | defm PAVGB : PDI_binop_rm_int<0xE0, "pavgb", int_x86_sse2_pavg_b, 1>; |
| 2003 | defm PAVGW : PDI_binop_rm_int<0xE3, "pavgw", int_x86_sse2_pavg_w, 1>; |
| 2004 | |
| 2005 | |
| 2006 | defm PMINUB : PDI_binop_rm_int<0xDA, "pminub", int_x86_sse2_pminu_b, 1>; |
| 2007 | defm PMINSW : PDI_binop_rm_int<0xEA, "pminsw", int_x86_sse2_pmins_w, 1>; |
| 2008 | defm PMAXUB : PDI_binop_rm_int<0xDE, "pmaxub", int_x86_sse2_pmaxu_b, 1>; |
| 2009 | 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] | 2010 | 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] | 2011 | |
| 2012 | |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 2013 | defm PSLLW : PDI_binop_rmi_int<0xF1, 0x71, MRM6r, "psllw", |
| 2014 | int_x86_sse2_psll_w, int_x86_sse2_pslli_w>; |
| 2015 | defm PSLLD : PDI_binop_rmi_int<0xF2, 0x72, MRM6r, "pslld", |
| 2016 | int_x86_sse2_psll_d, int_x86_sse2_pslli_d>; |
| 2017 | defm PSLLQ : PDI_binop_rmi_int<0xF3, 0x73, MRM6r, "psllq", |
| 2018 | int_x86_sse2_psll_q, int_x86_sse2_pslli_q>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2019 | |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 2020 | defm PSRLW : PDI_binop_rmi_int<0xD1, 0x71, MRM2r, "psrlw", |
| 2021 | int_x86_sse2_psrl_w, int_x86_sse2_psrli_w>; |
| 2022 | defm PSRLD : PDI_binop_rmi_int<0xD2, 0x72, MRM2r, "psrld", |
| 2023 | int_x86_sse2_psrl_d, int_x86_sse2_psrli_d>; |
Nate Begeman | c2ca5f6 | 2008-05-13 17:52:09 +0000 | [diff] [blame] | 2024 | defm PSRLQ : PDI_binop_rmi_int<0xD3, 0x73, MRM2r, "psrlq", |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 2025 | int_x86_sse2_psrl_q, int_x86_sse2_psrli_q>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2026 | |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 2027 | defm PSRAW : PDI_binop_rmi_int<0xE1, 0x71, MRM4r, "psraw", |
| 2028 | int_x86_sse2_psra_w, int_x86_sse2_psrai_w>; |
Nate Begeman | d66fc34 | 2008-05-13 01:47:52 +0000 | [diff] [blame] | 2029 | defm PSRAD : PDI_binop_rmi_int<0xE2, 0x72, MRM4r, "psrad", |
Evan Cheng | f90f8f8 | 2008-05-03 00:52:09 +0000 | [diff] [blame] | 2030 | int_x86_sse2_psra_d, int_x86_sse2_psrai_d>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2031 | |
| 2032 | // 128-bit logical shifts. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2033 | let Constraints = "$src1 = $dst", neverHasSideEffects = 1 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2034 | def PSLLDQri : PDIi8<0x73, MRM7r, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2035 | (outs VR128:$dst), (ins VR128:$src1, i32i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2036 | "pslldq\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2037 | def PSRLDQri : PDIi8<0x73, MRM3r, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2038 | (outs VR128:$dst), (ins VR128:$src1, i32i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2039 | "psrldq\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2040 | // PSRADQri doesn't exist in SSE[1-3]. |
| 2041 | } |
| 2042 | |
| 2043 | let Predicates = [HasSSE2] in { |
| 2044 | def : Pat<(int_x86_sse2_psll_dq VR128:$src1, imm:$src2), |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2045 | (v2i64 (PSLLDQri VR128:$src1, (BYTE_imm imm:$src2)))>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2046 | def : Pat<(int_x86_sse2_psrl_dq VR128:$src1, imm:$src2), |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2047 | (v2i64 (PSRLDQri VR128:$src1, (BYTE_imm imm:$src2)))>; |
Bill Wendling | 314ee05 | 2008-10-02 05:56:52 +0000 | [diff] [blame] | 2048 | def : Pat<(int_x86_sse2_psll_dq_bs VR128:$src1, imm:$src2), |
| 2049 | (v2i64 (PSLLDQri VR128:$src1, imm:$src2))>; |
| 2050 | def : Pat<(int_x86_sse2_psrl_dq_bs VR128:$src1, imm:$src2), |
| 2051 | (v2i64 (PSRLDQri VR128:$src1, imm:$src2))>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2052 | def : Pat<(v2f64 (X86fsrl VR128:$src1, i32immSExt8:$src2)), |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2053 | (v2f64 (PSRLDQri VR128:$src1, (BYTE_imm imm:$src2)))>; |
Evan Cheng | dea9936 | 2008-05-29 08:22:04 +0000 | [diff] [blame] | 2054 | |
| 2055 | // Shift up / down and insert zero's. |
| 2056 | def : Pat<(v2i64 (X86vshl VR128:$src, (i8 imm:$amt))), |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2057 | (v2i64 (PSLLDQri VR128:$src, (BYTE_imm imm:$amt)))>; |
Evan Cheng | dea9936 | 2008-05-29 08:22:04 +0000 | [diff] [blame] | 2058 | def : Pat<(v2i64 (X86vshr VR128:$src, (i8 imm:$amt))), |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2059 | (v2i64 (PSRLDQri VR128:$src, (BYTE_imm imm:$amt)))>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2060 | } |
| 2061 | |
| 2062 | // Logical |
| 2063 | defm PAND : PDI_binop_rm_v2i64<0xDB, "pand", and, 1>; |
| 2064 | defm POR : PDI_binop_rm_v2i64<0xEB, "por" , or , 1>; |
| 2065 | defm PXOR : PDI_binop_rm_v2i64<0xEF, "pxor", xor, 1>; |
| 2066 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2067 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2068 | def PANDNrr : PDI<0xDF, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2069 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2070 | "pandn\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2071 | [(set VR128:$dst, (v2i64 (and (vnot VR128:$src1), |
| 2072 | VR128:$src2)))]>; |
| 2073 | |
| 2074 | def PANDNrm : PDI<0xDF, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2075 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2076 | "pandn\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2077 | [(set VR128:$dst, (v2i64 (and (vnot VR128:$src1), |
Dan Gohman | 7dc1901 | 2007-08-02 21:17:01 +0000 | [diff] [blame] | 2078 | (memopv2i64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2079 | } |
| 2080 | |
| 2081 | // SSE2 Integer comparison |
| 2082 | defm PCMPEQB : PDI_binop_rm_int<0x74, "pcmpeqb", int_x86_sse2_pcmpeq_b>; |
| 2083 | defm PCMPEQW : PDI_binop_rm_int<0x75, "pcmpeqw", int_x86_sse2_pcmpeq_w>; |
| 2084 | defm PCMPEQD : PDI_binop_rm_int<0x76, "pcmpeqd", int_x86_sse2_pcmpeq_d>; |
| 2085 | defm PCMPGTB : PDI_binop_rm_int<0x64, "pcmpgtb", int_x86_sse2_pcmpgt_b>; |
| 2086 | defm PCMPGTW : PDI_binop_rm_int<0x65, "pcmpgtw", int_x86_sse2_pcmpgt_w>; |
| 2087 | defm PCMPGTD : PDI_binop_rm_int<0x66, "pcmpgtd", int_x86_sse2_pcmpgt_d>; |
| 2088 | |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2089 | def : Pat<(v16i8 (X86pcmpeqb VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2090 | (PCMPEQBrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2091 | def : Pat<(v16i8 (X86pcmpeqb VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2092 | (PCMPEQBrm VR128:$src1, addr:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2093 | def : Pat<(v8i16 (X86pcmpeqw VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2094 | (PCMPEQWrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2095 | def : Pat<(v8i16 (X86pcmpeqw VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2096 | (PCMPEQWrm VR128:$src1, addr:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2097 | def : Pat<(v4i32 (X86pcmpeqd VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2098 | (PCMPEQDrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2099 | def : Pat<(v4i32 (X86pcmpeqd VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2100 | (PCMPEQDrm VR128:$src1, addr:$src2)>; |
| 2101 | |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2102 | def : Pat<(v16i8 (X86pcmpgtb VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2103 | (PCMPGTBrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2104 | def : Pat<(v16i8 (X86pcmpgtb VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2105 | (PCMPGTBrm VR128:$src1, addr:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2106 | def : Pat<(v8i16 (X86pcmpgtw VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2107 | (PCMPGTWrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2108 | def : Pat<(v8i16 (X86pcmpgtw VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2109 | (PCMPGTWrm VR128:$src1, addr:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2110 | def : Pat<(v4i32 (X86pcmpgtd VR128:$src1, VR128:$src2)), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2111 | (PCMPGTDrr VR128:$src1, VR128:$src2)>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 2112 | def : Pat<(v4i32 (X86pcmpgtd VR128:$src1, (memop addr:$src2))), |
Nate Begeman | 78ca4f9 | 2008-05-12 23:09:43 +0000 | [diff] [blame] | 2113 | (PCMPGTDrm VR128:$src1, addr:$src2)>; |
| 2114 | |
| 2115 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2116 | // Pack instructions |
| 2117 | defm PACKSSWB : PDI_binop_rm_int<0x63, "packsswb", int_x86_sse2_packsswb_128>; |
| 2118 | defm PACKSSDW : PDI_binop_rm_int<0x6B, "packssdw", int_x86_sse2_packssdw_128>; |
| 2119 | defm PACKUSWB : PDI_binop_rm_int<0x67, "packuswb", int_x86_sse2_packuswb_128>; |
| 2120 | |
| 2121 | // Shuffle and unpack instructions |
Nate Begeman | 080f8e2 | 2009-10-19 02:17:23 +0000 | [diff] [blame] | 2122 | let AddedComplexity = 5 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2123 | def PSHUFDri : PDIi8<0x70, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2124 | (outs VR128:$dst), (ins VR128:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2125 | "pshufd\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2126 | [(set VR128:$dst, (v4i32 (pshufd:$src2 |
| 2127 | VR128:$src1, (undef))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2128 | def PSHUFDmi : PDIi8<0x70, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2129 | (outs VR128:$dst), (ins i128mem:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2130 | "pshufd\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2131 | [(set VR128:$dst, (v4i32 (pshufd:$src2 |
Evan Cheng | e31a26a | 2009-12-09 21:00:30 +0000 | [diff] [blame] | 2132 | (bc_v4i32 (memopv2i64 addr:$src1)), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2133 | (undef))))]>; |
Eric Christopher | f365029 | 2009-11-07 08:45:53 +0000 | [diff] [blame] | 2134 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2135 | |
| 2136 | // SSE2 with ImmT == Imm8 and XS prefix. |
| 2137 | def PSHUFHWri : Ii8<0x70, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2138 | (outs VR128:$dst), (ins VR128:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2139 | "pshufhw\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2140 | [(set VR128:$dst, (v8i16 (pshufhw:$src2 VR128:$src1, |
| 2141 | (undef))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2142 | XS, Requires<[HasSSE2]>; |
| 2143 | def PSHUFHWmi : Ii8<0x70, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2144 | (outs VR128:$dst), (ins i128mem:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2145 | "pshufhw\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2146 | [(set VR128:$dst, (v8i16 (pshufhw:$src2 |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2147 | (bc_v8i16 (memopv2i64 addr:$src1)), |
| 2148 | (undef))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2149 | XS, Requires<[HasSSE2]>; |
| 2150 | |
| 2151 | // SSE2 with ImmT == Imm8 and XD prefix. |
| 2152 | def PSHUFLWri : Ii8<0x70, MRMSrcReg, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2153 | (outs VR128:$dst), (ins VR128:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2154 | "pshuflw\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2155 | [(set VR128:$dst, (v8i16 (pshuflw:$src2 VR128:$src1, |
| 2156 | (undef))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2157 | XD, Requires<[HasSSE2]>; |
| 2158 | def PSHUFLWmi : Ii8<0x70, MRMSrcMem, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2159 | (outs VR128:$dst), (ins i128mem:$src1, i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2160 | "pshuflw\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2161 | [(set VR128:$dst, (v8i16 (pshuflw:$src2 |
| 2162 | (bc_v8i16 (memopv2i64 addr:$src1)), |
| 2163 | (undef))))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2164 | XD, Requires<[HasSSE2]>; |
| 2165 | |
| 2166 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2167 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2168 | def PUNPCKLBWrr : PDI<0x60, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2169 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2170 | "punpcklbw\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2171 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2172 | (v16i8 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2173 | def PUNPCKLBWrm : PDI<0x60, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2174 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2175 | "punpcklbw\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2176 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2177 | (unpckl VR128:$src1, |
| 2178 | (bc_v16i8 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2179 | def PUNPCKLWDrr : PDI<0x61, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2180 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2181 | "punpcklwd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2182 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2183 | (v8i16 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2184 | def PUNPCKLWDrm : PDI<0x61, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2185 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2186 | "punpcklwd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2187 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2188 | (unpckl VR128:$src1, |
| 2189 | (bc_v8i16 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2190 | def PUNPCKLDQrr : PDI<0x62, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2191 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2192 | "punpckldq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2193 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2194 | (v4i32 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2195 | def PUNPCKLDQrm : PDI<0x62, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2196 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2197 | "punpckldq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2198 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2199 | (unpckl VR128:$src1, |
| 2200 | (bc_v4i32 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2201 | def PUNPCKLQDQrr : PDI<0x6C, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2202 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2203 | "punpcklqdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2204 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2205 | (v2i64 (unpckl VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2206 | def PUNPCKLQDQrm : PDI<0x6C, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2207 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2208 | "punpcklqdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2209 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2210 | (v2i64 (unpckl VR128:$src1, |
| 2211 | (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2212 | |
| 2213 | def PUNPCKHBWrr : PDI<0x68, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2214 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2215 | "punpckhbw\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2216 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2217 | (v16i8 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2218 | def PUNPCKHBWrm : PDI<0x68, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2219 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2220 | "punpckhbw\t{$src2, $dst|$dst, $src2}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2221 | [(set VR128:$dst, |
| 2222 | (unpckh VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2223 | (bc_v16i8 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2224 | def PUNPCKHWDrr : PDI<0x69, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2225 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2226 | "punpckhwd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2227 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2228 | (v8i16 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2229 | def PUNPCKHWDrm : PDI<0x69, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2230 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2231 | "punpckhwd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2232 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2233 | (unpckh VR128:$src1, |
| 2234 | (bc_v8i16 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2235 | def PUNPCKHDQrr : PDI<0x6A, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2236 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2237 | "punpckhdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2238 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2239 | (v4i32 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2240 | def PUNPCKHDQrm : PDI<0x6A, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2241 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2242 | "punpckhdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2243 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2244 | (unpckh VR128:$src1, |
| 2245 | (bc_v4i32 (memopv2i64 addr:$src2))))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2246 | def PUNPCKHQDQrr : PDI<0x6D, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2247 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2248 | "punpckhqdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2249 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2250 | (v2i64 (unpckh VR128:$src1, VR128:$src2)))]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2251 | def PUNPCKHQDQrm : PDI<0x6D, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2252 | (outs VR128:$dst), (ins VR128:$src1, i128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2253 | "punpckhqdq\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2254 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2255 | (v2i64 (unpckh VR128:$src1, |
| 2256 | (memopv2i64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2257 | } |
| 2258 | |
| 2259 | // Extract / Insert |
| 2260 | def PEXTRWri : PDIi8<0xC5, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2261 | (outs GR32:$dst), (ins VR128:$src1, i32i8imm:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2262 | "pextrw\t{$src2, $src1, $dst|$dst, $src1, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2263 | [(set GR32:$dst, (X86pextrw (v8i16 VR128:$src1), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 2264 | imm:$src2))]>; |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2265 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2266 | def PINSRWrri : PDIi8<0xC4, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2267 | (outs VR128:$dst), (ins VR128:$src1, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2268 | GR32:$src2, i32i8imm:$src3), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2269 | "pinsrw\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2270 | [(set VR128:$dst, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 2271 | (X86pinsrw VR128:$src1, GR32:$src2, imm:$src3))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2272 | def PINSRWrmi : PDIi8<0xC4, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2273 | (outs VR128:$dst), (ins VR128:$src1, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2274 | i16mem:$src2, i32i8imm:$src3), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2275 | "pinsrw\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2276 | [(set VR128:$dst, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 2277 | (X86pinsrw VR128:$src1, (extloadi16 addr:$src2), |
| 2278 | imm:$src3))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2279 | } |
| 2280 | |
| 2281 | // Mask creation |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2282 | def PMOVMSKBrr : PDI<0xD7, MRMSrcReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2283 | "pmovmskb\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2284 | [(set GR32:$dst, (int_x86_sse2_pmovmskb_128 VR128:$src))]>; |
| 2285 | |
| 2286 | // Conditional store |
Evan Cheng | 6e4d1d9 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2287 | let Uses = [EDI] in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2288 | def MASKMOVDQU : PDI<0xF7, MRMSrcReg, (outs), (ins VR128:$src, VR128:$mask), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2289 | "maskmovdqu\t{$mask, $src|$src, $mask}", |
Evan Cheng | 6e4d1d9 | 2007-09-11 19:55:27 +0000 | [diff] [blame] | 2290 | [(int_x86_sse2_maskmov_dqu VR128:$src, VR128:$mask, EDI)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2291 | |
Evan Cheng | 430de08 | 2009-02-10 22:06:28 +0000 | [diff] [blame] | 2292 | let Uses = [RDI] in |
| 2293 | def MASKMOVDQU64 : PDI<0xF7, MRMSrcReg, (outs), (ins VR128:$src, VR128:$mask), |
| 2294 | "maskmovdqu\t{$mask, $src|$src, $mask}", |
| 2295 | [(int_x86_sse2_maskmov_dqu VR128:$src, VR128:$mask, RDI)]>; |
| 2296 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2297 | // Non-temporal stores |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2298 | def MOVNTPDmr : PDI<0x2B, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2299 | "movntpd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2300 | [(int_x86_sse2_movnt_pd addr:$dst, VR128:$src)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2301 | def MOVNTDQmr : PDI<0xE7, MRMDestMem, (outs), (ins f128mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2302 | "movntdq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2303 | [(int_x86_sse2_movnt_dq addr:$dst, VR128:$src)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2304 | def MOVNTImr : I<0xC3, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2305 | "movnti\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2306 | [(int_x86_sse2_movnt_i addr:$dst, GR32:$src)]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2307 | TB, Requires<[HasSSE2]>; |
| 2308 | |
| 2309 | // Flush cache |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2310 | def CLFLUSH : I<0xAE, MRM7m, (outs), (ins i8mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2311 | "clflush\t$src", [(int_x86_sse2_clflush addr:$src)]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2312 | TB, Requires<[HasSSE2]>; |
| 2313 | |
| 2314 | // Load, store, and memory fence |
Evan Cheng | 5d0d34e | 2008-10-17 17:14:20 +0000 | [diff] [blame] | 2315 | def LFENCE : I<0xAE, MRM5r, (outs), (ins), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2316 | "lfence", [(int_x86_sse2_lfence)]>, TB, Requires<[HasSSE2]>; |
Evan Cheng | 5d0d34e | 2008-10-17 17:14:20 +0000 | [diff] [blame] | 2317 | def MFENCE : I<0xAE, MRM6r, (outs), (ins), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2318 | "mfence", [(int_x86_sse2_mfence)]>, TB, Requires<[HasSSE2]>; |
| 2319 | |
Andrew Lenharth | 785610d | 2008-02-16 01:24:58 +0000 | [diff] [blame] | 2320 | //TODO: custom lower this so as to never even generate the noop |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2321 | 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] | 2322 | (i8 0)), (NOOP)>; |
| 2323 | def : Pat<(membarrier (i8 0), (i8 0), (i8 0), (i8 1), (i8 1)), (SFENCE)>; |
| 2324 | 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] | 2325 | 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] | 2326 | (i8 1)), (MFENCE)>; |
| 2327 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2328 | // Alias instructions that map zero vector to pxor / xorp* for sse. |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 2329 | // We set canFoldAsLoad because this can be converted to a constant-pool |
Dan Gohman | 37eb6c8 | 2008-12-03 05:21:24 +0000 | [diff] [blame] | 2330 | // load of an all-ones value if folding it would be beneficial. |
Daniel Dunbar | a0e6200 | 2009-08-11 22:17:52 +0000 | [diff] [blame] | 2331 | let isReMaterializable = 1, isAsCheapAsAMove = 1, canFoldAsLoad = 1, |
| 2332 | isCodeGenOnly = 1 in |
Chris Lattner | cb521fb | 2010-02-05 21:30:49 +0000 | [diff] [blame^] | 2333 | // FIXME: Change encoding to pseudo. |
| 2334 | def V_SETALLONES : PDI<0x76, MRMInitReg, (outs VR128:$dst), (ins), "", |
Chris Lattner | e6aa386 | 2007-11-25 00:24:49 +0000 | [diff] [blame] | 2335 | [(set VR128:$dst, (v4i32 immAllOnesV))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2336 | |
| 2337 | // FR64 to 128-bit vector conversion. |
Evan Cheng | bd0ca9c | 2009-02-05 08:42:55 +0000 | [diff] [blame] | 2338 | let isAsCheapAsAMove = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2339 | def MOVSD2PDrr : SDI<0x10, MRMSrcReg, (outs VR128:$dst), (ins FR64:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2340 | "movsd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2341 | [(set VR128:$dst, |
| 2342 | (v2f64 (scalar_to_vector FR64:$src)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2343 | def MOVSD2PDrm : SDI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2344 | "movsd\t{$src, $dst|$dst, $src}", |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2345 | [(set VR128:$dst, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2346 | (v2f64 (scalar_to_vector (loadf64 addr:$src))))]>; |
| 2347 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2348 | def MOVDI2PDIrr : PDI<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2349 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2350 | [(set VR128:$dst, |
| 2351 | (v4i32 (scalar_to_vector GR32:$src)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2352 | def MOVDI2PDIrm : PDI<0x6E, MRMSrcMem, (outs VR128:$dst), (ins i32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2353 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2354 | [(set VR128:$dst, |
| 2355 | (v4i32 (scalar_to_vector (loadi32 addr:$src))))]>; |
| 2356 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2357 | def MOVDI2SSrr : PDI<0x6E, MRMSrcReg, (outs FR32:$dst), (ins GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2358 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2359 | [(set FR32:$dst, (bitconvert GR32:$src))]>; |
| 2360 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2361 | def MOVDI2SSrm : PDI<0x6E, MRMSrcMem, (outs FR32:$dst), (ins i32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2362 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2363 | [(set FR32:$dst, (bitconvert (loadi32 addr:$src)))]>; |
| 2364 | |
| 2365 | // SSE2 instructions with XS prefix |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2366 | def MOVQI2PQIrm : I<0x7E, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2367 | "movq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2368 | [(set VR128:$dst, |
| 2369 | (v2i64 (scalar_to_vector (loadi64 addr:$src))))]>, XS, |
| 2370 | Requires<[HasSSE2]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2371 | def MOVPQI2QImr : PDI<0xD6, MRMDestMem, (outs), (ins i64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2372 | "movq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2373 | [(store (i64 (vector_extract (v2i64 VR128:$src), |
| 2374 | (iPTR 0))), addr:$dst)]>; |
| 2375 | |
| 2376 | // FIXME: may not be able to eliminate this movss with coalescing the src and |
| 2377 | // dest register classes are different. We really want to write this pattern |
| 2378 | // like this: |
| 2379 | // def : Pat<(f32 (vector_extract (v4f32 VR128:$src), (iPTR 0))), |
| 2380 | // (f32 FR32:$src)>; |
Evan Cheng | bd0ca9c | 2009-02-05 08:42:55 +0000 | [diff] [blame] | 2381 | let isAsCheapAsAMove = 1 in |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2382 | def MOVPD2SDrr : SDI<0x10, MRMSrcReg, (outs FR64:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2383 | "movsd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2384 | [(set FR64:$dst, (vector_extract (v2f64 VR128:$src), |
| 2385 | (iPTR 0)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2386 | def MOVPD2SDmr : SDI<0x11, MRMDestMem, (outs), (ins f64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2387 | "movsd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2388 | [(store (f64 (vector_extract (v2f64 VR128:$src), |
| 2389 | (iPTR 0))), addr:$dst)]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2390 | def MOVPDI2DIrr : PDI<0x7E, MRMDestReg, (outs GR32:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2391 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2392 | [(set GR32:$dst, (vector_extract (v4i32 VR128:$src), |
| 2393 | (iPTR 0)))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2394 | def MOVPDI2DImr : PDI<0x7E, MRMDestMem, (outs), (ins i32mem:$dst, VR128:$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 (vector_extract (v4i32 VR128:$src), |
| 2397 | (iPTR 0))), addr:$dst)]>; |
| 2398 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2399 | def MOVSS2DIrr : PDI<0x7E, MRMDestReg, (outs GR32:$dst), (ins FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2400 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2401 | [(set GR32:$dst, (bitconvert FR32:$src))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2402 | def MOVSS2DImr : PDI<0x7E, MRMDestMem, (outs), (ins i32mem:$dst, FR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2403 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2404 | [(store (i32 (bitconvert FR32:$src)), addr:$dst)]>; |
| 2405 | |
| 2406 | |
| 2407 | // Move to lower bits of a VR128, leaving upper bits alone. |
| 2408 | // Three operand (but two address) aliases. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2409 | let Constraints = "$src1 = $dst" in { |
Chris Lattner | d1a9eb6 | 2008-01-11 06:59:07 +0000 | [diff] [blame] | 2410 | let neverHasSideEffects = 1 in |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2411 | def MOVLSD2PDrr : SDI<0x10, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2412 | (outs VR128:$dst), (ins VR128:$src1, FR64:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2413 | "movsd\t{$src2, $dst|$dst, $src2}", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2414 | |
| 2415 | let AddedComplexity = 15 in |
| 2416 | def MOVLPDrr : SDI<0x10, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2417 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2418 | "movsd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2419 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2420 | (v2f64 (movl VR128:$src1, VR128:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2421 | } |
| 2422 | |
| 2423 | // Store / copy lower 64-bits of a XMM register. |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2424 | def MOVLQ128mr : PDI<0xD6, MRMDestMem, (outs), (ins i64mem:$dst, VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2425 | "movq\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2426 | [(int_x86_sse2_storel_dq addr:$dst, VR128:$src)]>; |
| 2427 | |
| 2428 | // Move to lower bits of a VR128 and zeroing upper bits. |
| 2429 | // Loading from memory automatically zeroing upper bits. |
Evan Cheng | d743a5f | 2008-05-10 00:59:18 +0000 | [diff] [blame] | 2430 | let AddedComplexity = 20 in { |
| 2431 | def MOVZSD2PDrm : SDI<0x10, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src), |
| 2432 | "movsd\t{$src, $dst|$dst, $src}", |
| 2433 | [(set VR128:$dst, |
| 2434 | (v2f64 (X86vzmovl (v2f64 (scalar_to_vector |
| 2435 | (loadf64 addr:$src))))))]>; |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 2436 | |
Evan Cheng | 056afe1 | 2008-05-20 18:24:47 +0000 | [diff] [blame] | 2437 | def : Pat<(v2f64 (X86vzmovl (loadv2f64 addr:$src))), |
| 2438 | (MOVZSD2PDrm addr:$src)>; |
| 2439 | def : Pat<(v2f64 (X86vzmovl (bc_v2f64 (loadv4f32 addr:$src)))), |
Evan Cheng | d743a5f | 2008-05-10 00:59:18 +0000 | [diff] [blame] | 2440 | (MOVZSD2PDrm addr:$src)>; |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2441 | def : Pat<(v2f64 (X86vzload addr:$src)), (MOVZSD2PDrm addr:$src)>; |
Evan Cheng | d743a5f | 2008-05-10 00:59:18 +0000 | [diff] [blame] | 2442 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2443 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2444 | // movd / movq to XMM register zero-extends |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2445 | let AddedComplexity = 15 in { |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2446 | def MOVZDI2PDIrr : PDI<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR32:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2447 | "movd\t{$src, $dst|$dst, $src}", |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2448 | [(set VR128:$dst, (v4i32 (X86vzmovl |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 2449 | (v4i32 (scalar_to_vector GR32:$src)))))]>; |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2450 | // This is X86-64 only. |
| 2451 | def MOVZQI2PQIrr : RPDI<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR64:$src), |
| 2452 | "mov{d|q}\t{$src, $dst|$dst, $src}", |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2453 | [(set VR128:$dst, (v2i64 (X86vzmovl |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 2454 | (v2i64 (scalar_to_vector GR64:$src)))))]>; |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2455 | } |
| 2456 | |
| 2457 | let AddedComplexity = 20 in { |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2458 | def MOVZDI2PDIrm : PDI<0x6E, MRMSrcMem, (outs VR128:$dst), (ins i32mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2459 | "movd\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2460 | [(set VR128:$dst, |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2461 | (v4i32 (X86vzmovl (v4i32 (scalar_to_vector |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 2462 | (loadi32 addr:$src))))))]>; |
Evan Cheng | 3ad16c4 | 2008-05-22 18:56:56 +0000 | [diff] [blame] | 2463 | |
| 2464 | def : Pat<(v4i32 (X86vzmovl (loadv4i32 addr:$src))), |
| 2465 | (MOVZDI2PDIrm addr:$src)>; |
| 2466 | def : Pat<(v4i32 (X86vzmovl (bc_v4i32 (loadv4f32 addr:$src)))), |
| 2467 | (MOVZDI2PDIrm addr:$src)>; |
Duncan Sands | 2418bec | 2008-06-13 19:07:40 +0000 | [diff] [blame] | 2468 | def : Pat<(v4i32 (X86vzmovl (bc_v4i32 (loadv2i64 addr:$src)))), |
| 2469 | (MOVZDI2PDIrm addr:$src)>; |
Evan Cheng | 3ad16c4 | 2008-05-22 18:56:56 +0000 | [diff] [blame] | 2470 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2471 | def MOVZQI2PQIrm : I<0x7E, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2472 | "movq\t{$src, $dst|$dst, $src}", |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2473 | [(set VR128:$dst, |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2474 | (v2i64 (X86vzmovl (v2i64 (scalar_to_vector |
Evan Cheng | 40ee6e5 | 2008-05-08 00:57:18 +0000 | [diff] [blame] | 2475 | (loadi64 addr:$src))))))]>, XS, |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2476 | Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2477 | |
Evan Cheng | 3ad16c4 | 2008-05-22 18:56:56 +0000 | [diff] [blame] | 2478 | def : Pat<(v2i64 (X86vzmovl (loadv2i64 addr:$src))), |
| 2479 | (MOVZQI2PQIrm addr:$src)>; |
| 2480 | def : Pat<(v2i64 (X86vzmovl (bc_v2i64 (loadv4f32 addr:$src)))), |
| 2481 | (MOVZQI2PQIrm addr:$src)>; |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2482 | def : Pat<(v2i64 (X86vzload addr:$src)), (MOVZQI2PQIrm addr:$src)>; |
Evan Cheng | d743a5f | 2008-05-10 00:59:18 +0000 | [diff] [blame] | 2483 | } |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2484 | |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2485 | // Moving from XMM to XMM and clear upper 64 bits. Note, there is a bug in |
| 2486 | // IA32 document. movq xmm1, xmm2 does clear the high bits. |
| 2487 | let AddedComplexity = 15 in |
| 2488 | def MOVZPQILo2PQIrr : I<0x7E, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 2489 | "movq\t{$src, $dst|$dst, $src}", |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2490 | [(set VR128:$dst, (v2i64 (X86vzmovl (v2i64 VR128:$src))))]>, |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2491 | XS, Requires<[HasSSE2]>; |
| 2492 | |
Evan Cheng | 056afe1 | 2008-05-20 18:24:47 +0000 | [diff] [blame] | 2493 | let AddedComplexity = 20 in { |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2494 | def MOVZPQILo2PQIrm : I<0x7E, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
| 2495 | "movq\t{$src, $dst|$dst, $src}", |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2496 | [(set VR128:$dst, (v2i64 (X86vzmovl |
Evan Cheng | 056afe1 | 2008-05-20 18:24:47 +0000 | [diff] [blame] | 2497 | (loadv2i64 addr:$src))))]>, |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 2498 | XS, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2499 | |
Evan Cheng | 056afe1 | 2008-05-20 18:24:47 +0000 | [diff] [blame] | 2500 | def : Pat<(v2i64 (X86vzmovl (bc_v2i64 (loadv4i32 addr:$src)))), |
| 2501 | (MOVZPQILo2PQIrm addr:$src)>; |
| 2502 | } |
| 2503 | |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 2504 | // Instructions for the disassembler |
| 2505 | // xr = XMM register |
| 2506 | // xm = mem64 |
| 2507 | |
| 2508 | def MOVQxrxr : I<0x7E, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 2509 | "movq\t{$src, $dst|$dst, $src}", []>, XS; |
| 2510 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2511 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2512 | // SSE3 Instructions |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2513 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2514 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2515 | // Move Instructions |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2516 | def MOVSHDUPrr : S3SI<0x16, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2517 | "movshdup\t{$src, $dst|$dst, $src}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2518 | [(set VR128:$dst, (v4f32 (movshdup |
| 2519 | VR128:$src, (undef))))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2520 | def MOVSHDUPrm : S3SI<0x16, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2521 | "movshdup\t{$src, $dst|$dst, $src}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2522 | [(set VR128:$dst, (movshdup |
| 2523 | (memopv4f32 addr:$src), (undef)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2524 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2525 | def MOVSLDUPrr : S3SI<0x12, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2526 | "movsldup\t{$src, $dst|$dst, $src}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2527 | [(set VR128:$dst, (v4f32 (movsldup |
| 2528 | VR128:$src, (undef))))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2529 | def MOVSLDUPrm : S3SI<0x12, MRMSrcMem, (outs VR128:$dst), (ins f128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2530 | "movsldup\t{$src, $dst|$dst, $src}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2531 | [(set VR128:$dst, (movsldup |
| 2532 | (memopv4f32 addr:$src), (undef)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2533 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2534 | def MOVDDUPrr : S3DI<0x12, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2535 | "movddup\t{$src, $dst|$dst, $src}", |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2536 | [(set VR128:$dst,(v2f64 (movddup VR128:$src, (undef))))]>; |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2537 | def MOVDDUPrm : S3DI<0x12, MRMSrcMem, (outs VR128:$dst), (ins f64mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2538 | "movddup\t{$src, $dst|$dst, $src}", |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 2539 | [(set VR128:$dst, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2540 | (v2f64 (movddup (scalar_to_vector (loadf64 addr:$src)), |
| 2541 | (undef))))]>; |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 2542 | |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2543 | def : Pat<(movddup (bc_v2f64 (v2i64 (scalar_to_vector (loadi64 addr:$src)))), |
| 2544 | (undef)), |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 2545 | (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; |
Nate Begeman | b44aad7 | 2009-04-29 22:47:44 +0000 | [diff] [blame] | 2546 | |
| 2547 | let AddedComplexity = 5 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2548 | def : Pat<(movddup (memopv2f64 addr:$src), (undef)), |
Evan Cheng | a2497eb | 2008-09-25 20:50:48 +0000 | [diff] [blame] | 2549 | (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; |
Nate Begeman | b44aad7 | 2009-04-29 22:47:44 +0000 | [diff] [blame] | 2550 | def : Pat<(movddup (bc_v4f32 (memopv2f64 addr:$src)), (undef)), |
| 2551 | (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; |
| 2552 | def : Pat<(movddup (memopv2i64 addr:$src), (undef)), |
| 2553 | (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; |
| 2554 | def : Pat<(movddup (bc_v4i32 (memopv2i64 addr:$src)), (undef)), |
| 2555 | (MOVDDUPrm addr:$src)>, Requires<[HasSSE3]>; |
| 2556 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2557 | |
| 2558 | // Arithmetic |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2559 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2560 | def ADDSUBPSrr : S3DI<0xD0, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2561 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2562 | "addsubps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2563 | [(set VR128:$dst, (int_x86_sse3_addsub_ps VR128:$src1, |
| 2564 | VR128:$src2))]>; |
| 2565 | def ADDSUBPSrm : S3DI<0xD0, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2566 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2567 | "addsubps\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2568 | [(set VR128:$dst, (int_x86_sse3_addsub_ps VR128:$src1, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 2569 | (memop addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2570 | def ADDSUBPDrr : S3I<0xD0, MRMSrcReg, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2571 | (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2572 | "addsubpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2573 | [(set VR128:$dst, (int_x86_sse3_addsub_pd VR128:$src1, |
| 2574 | VR128:$src2))]>; |
| 2575 | def ADDSUBPDrm : S3I<0xD0, MRMSrcMem, |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2576 | (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2577 | "addsubpd\t{$src2, $dst|$dst, $src2}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2578 | [(set VR128:$dst, (int_x86_sse3_addsub_pd VR128:$src1, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 2579 | (memop addr:$src2)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2580 | } |
| 2581 | |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2582 | def LDDQUrm : S3DI<0xF0, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2583 | "lddqu\t{$src, $dst|$dst, $src}", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2584 | [(set VR128:$dst, (int_x86_sse3_ldu_dq addr:$src))]>; |
| 2585 | |
| 2586 | // Horizontal ops |
| 2587 | class S3D_Intrr<bits<8> o, string OpcodeStr, Intrinsic IntId> |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2588 | : S3DI<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, (v4f32 (IntId VR128:$src1, VR128:$src2)))]>; |
| 2591 | class S3D_Intrm<bits<8> o, string OpcodeStr, Intrinsic IntId> |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2592 | : S3DI<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, (v4f32 (IntId VR128:$src1, (memop addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2595 | class S3_Intrr<bits<8> o, string OpcodeStr, Intrinsic IntId> |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2596 | : S3I<o, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2597 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2598 | [(set VR128:$dst, (v2f64 (IntId VR128:$src1, VR128:$src2)))]>; |
| 2599 | class S3_Intrm<bits<8> o, string OpcodeStr, Intrinsic IntId> |
Evan Cheng | b783fa3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 2600 | : S3I<o, MRMSrcMem, (outs VR128:$dst), (ins VR128:$src1, f128mem:$src2), |
Dan Gohman | 91888f0 | 2007-07-31 20:11:57 +0000 | [diff] [blame] | 2601 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 2602 | [(set VR128:$dst, (v2f64 (IntId VR128:$src1, (memopv2f64 addr:$src2))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2603 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2604 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2605 | def HADDPSrr : S3D_Intrr<0x7C, "haddps", int_x86_sse3_hadd_ps>; |
| 2606 | def HADDPSrm : S3D_Intrm<0x7C, "haddps", int_x86_sse3_hadd_ps>; |
| 2607 | def HADDPDrr : S3_Intrr <0x7C, "haddpd", int_x86_sse3_hadd_pd>; |
| 2608 | def HADDPDrm : S3_Intrm <0x7C, "haddpd", int_x86_sse3_hadd_pd>; |
| 2609 | def HSUBPSrr : S3D_Intrr<0x7D, "hsubps", int_x86_sse3_hsub_ps>; |
| 2610 | def HSUBPSrm : S3D_Intrm<0x7D, "hsubps", int_x86_sse3_hsub_ps>; |
| 2611 | def HSUBPDrr : S3_Intrr <0x7D, "hsubpd", int_x86_sse3_hsub_pd>; |
| 2612 | def HSUBPDrm : S3_Intrm <0x7D, "hsubpd", int_x86_sse3_hsub_pd>; |
| 2613 | } |
| 2614 | |
| 2615 | // Thread synchronization |
Bill Wendling | 6ee7655 | 2009-05-28 23:40:46 +0000 | [diff] [blame] | 2616 | def MONITOR : I<0x01, MRM1r, (outs), (ins), "monitor", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2617 | [(int_x86_sse3_monitor EAX, ECX, EDX)]>,TB, Requires<[HasSSE3]>; |
Bill Wendling | 6ee7655 | 2009-05-28 23:40:46 +0000 | [diff] [blame] | 2618 | def MWAIT : I<0x01, MRM1r, (outs), (ins), "mwait", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2619 | [(int_x86_sse3_mwait ECX, EAX)]>, TB, Requires<[HasSSE3]>; |
| 2620 | |
| 2621 | // vector_shuffle v1, <undef> <1, 1, 3, 3> |
| 2622 | let AddedComplexity = 15 in |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2623 | def : Pat<(v4i32 (movshdup VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2624 | (MOVSHDUPrr 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 (movshdup (bc_v4i32 (memopv2i64 addr:$src)), (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2627 | (MOVSHDUPrm addr:$src)>, Requires<[HasSSE3]>; |
| 2628 | |
| 2629 | // vector_shuffle v1, <undef> <0, 0, 2, 2> |
| 2630 | let AddedComplexity = 15 in |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2631 | def : Pat<(v4i32 (movsldup VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2632 | (MOVSLDUPrr VR128:$src)>, Requires<[HasSSE3]>; |
| 2633 | let AddedComplexity = 20 in |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 2634 | def : Pat<(v4i32 (movsldup (bc_v4i32 (memopv2i64 addr:$src)), (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2635 | (MOVSLDUPrm addr:$src)>, Requires<[HasSSE3]>; |
| 2636 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2637 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2638 | // SSSE3 Instructions |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2639 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2640 | |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2641 | /// 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] | 2642 | multiclass SS3I_unop_rm_int_8<bits<8> opc, string OpcodeStr, |
| 2643 | Intrinsic IntId64, Intrinsic IntId128> { |
| 2644 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), (ins VR64:$src), |
| 2645 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2646 | [(set VR64:$dst, (IntId64 VR64:$src))]>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2647 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 2648 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), (ins i64mem:$src), |
| 2649 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2650 | [(set VR64:$dst, |
| 2651 | (IntId64 (bitconvert (memopv8i8 addr:$src))))]>; |
| 2652 | |
| 2653 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2654 | (ins VR128:$src), |
| 2655 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2656 | [(set VR128:$dst, (IntId128 VR128:$src))]>, |
| 2657 | OpSize; |
| 2658 | |
| 2659 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2660 | (ins i128mem:$src), |
| 2661 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2662 | [(set VR128:$dst, |
| 2663 | (IntId128 |
| 2664 | (bitconvert (memopv16i8 addr:$src))))]>, OpSize; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2665 | } |
| 2666 | |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2667 | /// 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] | 2668 | multiclass SS3I_unop_rm_int_16<bits<8> opc, string OpcodeStr, |
| 2669 | Intrinsic IntId64, Intrinsic IntId128> { |
| 2670 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), |
| 2671 | (ins VR64:$src), |
| 2672 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2673 | [(set VR64:$dst, (IntId64 VR64:$src))]>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2674 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 2675 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), |
| 2676 | (ins i64mem:$src), |
| 2677 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2678 | [(set VR64:$dst, |
| 2679 | (IntId64 |
| 2680 | (bitconvert (memopv4i16 addr:$src))))]>; |
| 2681 | |
| 2682 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2683 | (ins VR128:$src), |
| 2684 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2685 | [(set VR128:$dst, (IntId128 VR128:$src))]>, |
| 2686 | OpSize; |
| 2687 | |
| 2688 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2689 | (ins i128mem:$src), |
| 2690 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2691 | [(set VR128:$dst, |
| 2692 | (IntId128 |
| 2693 | (bitconvert (memopv8i16 addr:$src))))]>, OpSize; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2694 | } |
| 2695 | |
| 2696 | /// 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] | 2697 | multiclass SS3I_unop_rm_int_32<bits<8> opc, string OpcodeStr, |
| 2698 | Intrinsic IntId64, Intrinsic IntId128> { |
| 2699 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), |
| 2700 | (ins VR64:$src), |
| 2701 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2702 | [(set VR64:$dst, (IntId64 VR64:$src))]>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2703 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 2704 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), |
| 2705 | (ins i64mem:$src), |
| 2706 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2707 | [(set VR64:$dst, |
| 2708 | (IntId64 |
| 2709 | (bitconvert (memopv2i32 addr:$src))))]>; |
| 2710 | |
| 2711 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2712 | (ins VR128:$src), |
| 2713 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2714 | [(set VR128:$dst, (IntId128 VR128:$src))]>, |
| 2715 | OpSize; |
| 2716 | |
| 2717 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2718 | (ins i128mem:$src), |
| 2719 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 2720 | [(set VR128:$dst, |
| 2721 | (IntId128 |
| 2722 | (bitconvert (memopv4i32 addr:$src))))]>, OpSize; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2723 | } |
| 2724 | |
| 2725 | defm PABSB : SS3I_unop_rm_int_8 <0x1C, "pabsb", |
| 2726 | int_x86_ssse3_pabs_b, |
| 2727 | int_x86_ssse3_pabs_b_128>; |
| 2728 | defm PABSW : SS3I_unop_rm_int_16<0x1D, "pabsw", |
| 2729 | int_x86_ssse3_pabs_w, |
| 2730 | int_x86_ssse3_pabs_w_128>; |
| 2731 | defm PABSD : SS3I_unop_rm_int_32<0x1E, "pabsd", |
| 2732 | int_x86_ssse3_pabs_d, |
| 2733 | int_x86_ssse3_pabs_d_128>; |
| 2734 | |
| 2735 | /// 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] | 2736 | let Constraints = "$src1 = $dst" in { |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2737 | multiclass SS3I_binop_rm_int_8<bits<8> opc, string OpcodeStr, |
| 2738 | Intrinsic IntId64, Intrinsic IntId128, |
| 2739 | bit Commutable = 0> { |
| 2740 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), |
| 2741 | (ins VR64:$src1, VR64:$src2), |
| 2742 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2743 | [(set VR64:$dst, (IntId64 VR64:$src1, VR64:$src2))]> { |
| 2744 | let isCommutable = Commutable; |
| 2745 | } |
| 2746 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), |
| 2747 | (ins VR64:$src1, i64mem:$src2), |
| 2748 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2749 | [(set VR64:$dst, |
| 2750 | (IntId64 VR64:$src1, |
| 2751 | (bitconvert (memopv8i8 addr:$src2))))]>; |
| 2752 | |
| 2753 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2754 | (ins VR128:$src1, VR128:$src2), |
| 2755 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2756 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 2757 | OpSize { |
| 2758 | let isCommutable = Commutable; |
| 2759 | } |
| 2760 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2761 | (ins VR128:$src1, i128mem:$src2), |
| 2762 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2763 | [(set VR128:$dst, |
| 2764 | (IntId128 VR128:$src1, |
| 2765 | (bitconvert (memopv16i8 addr:$src2))))]>, OpSize; |
| 2766 | } |
| 2767 | } |
| 2768 | |
| 2769 | /// 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] | 2770 | let Constraints = "$src1 = $dst" in { |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2771 | multiclass SS3I_binop_rm_int_16<bits<8> opc, string OpcodeStr, |
| 2772 | Intrinsic IntId64, Intrinsic IntId128, |
| 2773 | bit Commutable = 0> { |
| 2774 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), |
| 2775 | (ins VR64:$src1, VR64:$src2), |
| 2776 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2777 | [(set VR64:$dst, (IntId64 VR64:$src1, VR64:$src2))]> { |
| 2778 | let isCommutable = Commutable; |
| 2779 | } |
| 2780 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), |
| 2781 | (ins VR64:$src1, i64mem:$src2), |
| 2782 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2783 | [(set VR64:$dst, |
| 2784 | (IntId64 VR64:$src1, |
| 2785 | (bitconvert (memopv4i16 addr:$src2))))]>; |
| 2786 | |
| 2787 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2788 | (ins VR128:$src1, VR128:$src2), |
| 2789 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2790 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 2791 | OpSize { |
| 2792 | let isCommutable = Commutable; |
| 2793 | } |
| 2794 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2795 | (ins VR128:$src1, i128mem:$src2), |
| 2796 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2797 | [(set VR128:$dst, |
| 2798 | (IntId128 VR128:$src1, |
| 2799 | (bitconvert (memopv8i16 addr:$src2))))]>, OpSize; |
| 2800 | } |
| 2801 | } |
| 2802 | |
| 2803 | /// 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] | 2804 | let Constraints = "$src1 = $dst" in { |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2805 | multiclass SS3I_binop_rm_int_32<bits<8> opc, string OpcodeStr, |
| 2806 | Intrinsic IntId64, Intrinsic IntId128, |
| 2807 | bit Commutable = 0> { |
| 2808 | def rr64 : SS38I<opc, MRMSrcReg, (outs VR64:$dst), |
| 2809 | (ins VR64:$src1, VR64:$src2), |
| 2810 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2811 | [(set VR64:$dst, (IntId64 VR64:$src1, VR64:$src2))]> { |
| 2812 | let isCommutable = Commutable; |
| 2813 | } |
| 2814 | def rm64 : SS38I<opc, MRMSrcMem, (outs VR64:$dst), |
| 2815 | (ins VR64:$src1, i64mem:$src2), |
| 2816 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2817 | [(set VR64:$dst, |
| 2818 | (IntId64 VR64:$src1, |
| 2819 | (bitconvert (memopv2i32 addr:$src2))))]>; |
| 2820 | |
| 2821 | def rr128 : SS38I<opc, MRMSrcReg, (outs VR128:$dst), |
| 2822 | (ins VR128:$src1, VR128:$src2), |
| 2823 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2824 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 2825 | OpSize { |
| 2826 | let isCommutable = Commutable; |
| 2827 | } |
| 2828 | def rm128 : SS38I<opc, MRMSrcMem, (outs VR128:$dst), |
| 2829 | (ins VR128:$src1, i128mem:$src2), |
| 2830 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 2831 | [(set VR128:$dst, |
| 2832 | (IntId128 VR128:$src1, |
| 2833 | (bitconvert (memopv4i32 addr:$src2))))]>, OpSize; |
| 2834 | } |
| 2835 | } |
| 2836 | |
| 2837 | defm PHADDW : SS3I_binop_rm_int_16<0x01, "phaddw", |
| 2838 | int_x86_ssse3_phadd_w, |
Evan Cheng | 944e441 | 2008-06-16 21:16:24 +0000 | [diff] [blame] | 2839 | int_x86_ssse3_phadd_w_128>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2840 | defm PHADDD : SS3I_binop_rm_int_32<0x02, "phaddd", |
| 2841 | int_x86_ssse3_phadd_d, |
Evan Cheng | 944e441 | 2008-06-16 21:16:24 +0000 | [diff] [blame] | 2842 | int_x86_ssse3_phadd_d_128>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2843 | defm PHADDSW : SS3I_binop_rm_int_16<0x03, "phaddsw", |
| 2844 | int_x86_ssse3_phadd_sw, |
Evan Cheng | 944e441 | 2008-06-16 21:16:24 +0000 | [diff] [blame] | 2845 | int_x86_ssse3_phadd_sw_128>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2846 | defm PHSUBW : SS3I_binop_rm_int_16<0x05, "phsubw", |
| 2847 | int_x86_ssse3_phsub_w, |
| 2848 | int_x86_ssse3_phsub_w_128>; |
| 2849 | defm PHSUBD : SS3I_binop_rm_int_32<0x06, "phsubd", |
| 2850 | int_x86_ssse3_phsub_d, |
| 2851 | int_x86_ssse3_phsub_d_128>; |
| 2852 | defm PHSUBSW : SS3I_binop_rm_int_16<0x07, "phsubsw", |
| 2853 | int_x86_ssse3_phsub_sw, |
| 2854 | int_x86_ssse3_phsub_sw_128>; |
| 2855 | defm PMADDUBSW : SS3I_binop_rm_int_8 <0x04, "pmaddubsw", |
| 2856 | int_x86_ssse3_pmadd_ub_sw, |
Evan Cheng | 944e441 | 2008-06-16 21:16:24 +0000 | [diff] [blame] | 2857 | int_x86_ssse3_pmadd_ub_sw_128>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2858 | defm PMULHRSW : SS3I_binop_rm_int_16<0x0B, "pmulhrsw", |
| 2859 | int_x86_ssse3_pmul_hr_sw, |
| 2860 | int_x86_ssse3_pmul_hr_sw_128, 1>; |
| 2861 | defm PSHUFB : SS3I_binop_rm_int_8 <0x00, "pshufb", |
| 2862 | int_x86_ssse3_pshuf_b, |
| 2863 | int_x86_ssse3_pshuf_b_128>; |
| 2864 | defm PSIGNB : SS3I_binop_rm_int_8 <0x08, "psignb", |
| 2865 | int_x86_ssse3_psign_b, |
| 2866 | int_x86_ssse3_psign_b_128>; |
| 2867 | defm PSIGNW : SS3I_binop_rm_int_16<0x09, "psignw", |
| 2868 | int_x86_ssse3_psign_w, |
| 2869 | int_x86_ssse3_psign_w_128>; |
Evan Cheng | abfed47 | 2009-05-28 18:48:53 +0000 | [diff] [blame] | 2870 | defm PSIGND : SS3I_binop_rm_int_32<0x0A, "psignd", |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2871 | int_x86_ssse3_psign_d, |
| 2872 | int_x86_ssse3_psign_d_128>; |
| 2873 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 2874 | let Constraints = "$src1 = $dst" in { |
Bill Wendling | 1dc817c | 2007-08-10 09:00:17 +0000 | [diff] [blame] | 2875 | def PALIGNR64rr : SS3AI<0x0F, MRMSrcReg, (outs VR64:$dst), |
Sean Callanan | b02aec5 | 2009-11-20 22:28:42 +0000 | [diff] [blame] | 2876 | (ins VR64:$src1, VR64:$src2, i8imm:$src3), |
Dale Johannesen | 576b27e | 2007-10-11 20:58:37 +0000 | [diff] [blame] | 2877 | "palignr\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2878 | []>; |
Dan Gohman | bcb9d46 | 2008-05-28 01:50:19 +0000 | [diff] [blame] | 2879 | def PALIGNR64rm : SS3AI<0x0F, MRMSrcMem, (outs VR64:$dst), |
Sean Callanan | b02aec5 | 2009-11-20 22:28:42 +0000 | [diff] [blame] | 2880 | (ins VR64:$src1, i64mem:$src2, i8imm:$src3), |
Dale Johannesen | 576b27e | 2007-10-11 20:58:37 +0000 | [diff] [blame] | 2881 | "palignr\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2882 | []>; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2883 | |
Bill Wendling | 1dc817c | 2007-08-10 09:00:17 +0000 | [diff] [blame] | 2884 | def PALIGNR128rr : SS3AI<0x0F, MRMSrcReg, (outs VR128:$dst), |
Sean Callanan | b02aec5 | 2009-11-20 22:28:42 +0000 | [diff] [blame] | 2885 | (ins VR128:$src1, VR128:$src2, i8imm:$src3), |
Dale Johannesen | 576b27e | 2007-10-11 20:58:37 +0000 | [diff] [blame] | 2886 | "palignr\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2887 | []>, OpSize; |
Dan Gohman | bcb9d46 | 2008-05-28 01:50:19 +0000 | [diff] [blame] | 2888 | def PALIGNR128rm : SS3AI<0x0F, MRMSrcMem, (outs VR128:$dst), |
Sean Callanan | b02aec5 | 2009-11-20 22:28:42 +0000 | [diff] [blame] | 2889 | (ins VR128:$src1, i128mem:$src2, i8imm:$src3), |
Dale Johannesen | 576b27e | 2007-10-11 20:58:37 +0000 | [diff] [blame] | 2890 | "palignr\t{$src3, $src2, $dst|$dst, $src2, $src3}", |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2891 | []>, OpSize; |
Bill Wendling | 9868029 | 2007-08-10 06:22:27 +0000 | [diff] [blame] | 2892 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2893 | |
Nate Begeman | 080f8e2 | 2009-10-19 02:17:23 +0000 | [diff] [blame] | 2894 | // palignr patterns. |
Sean Callanan | b02aec5 | 2009-11-20 22:28:42 +0000 | [diff] [blame] | 2895 | 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] | 2896 | (PALIGNR64rr VR64:$src1, VR64:$src2, (BYTE_imm imm:$src3))>, |
| 2897 | Requires<[HasSSSE3]>; |
| 2898 | def : Pat<(int_x86_ssse3_palign_r VR64:$src1, |
| 2899 | (memop64 addr:$src2), |
Sean Callanan | b02aec5 | 2009-11-20 22:28:42 +0000 | [diff] [blame] | 2900 | (i8 imm:$src3)), |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2901 | (PALIGNR64rm VR64:$src1, addr:$src2, (BYTE_imm imm:$src3))>, |
| 2902 | Requires<[HasSSSE3]>; |
| 2903 | |
Sean Callanan | b02aec5 | 2009-11-20 22:28:42 +0000 | [diff] [blame] | 2904 | 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] | 2905 | (PALIGNR128rr VR128:$src1, VR128:$src2, (BYTE_imm imm:$src3))>, |
| 2906 | Requires<[HasSSSE3]>; |
| 2907 | def : Pat<(int_x86_ssse3_palign_r_128 VR128:$src1, |
| 2908 | (memopv2i64 addr:$src2), |
Sean Callanan | b02aec5 | 2009-11-20 22:28:42 +0000 | [diff] [blame] | 2909 | (i8 imm:$src3)), |
Evan Cheng | 06cd207 | 2009-10-28 06:30:34 +0000 | [diff] [blame] | 2910 | (PALIGNR128rm VR128:$src1, addr:$src2, (BYTE_imm imm:$src3))>, |
| 2911 | Requires<[HasSSSE3]>; |
| 2912 | |
Nate Begeman | 080f8e2 | 2009-10-19 02:17:23 +0000 | [diff] [blame] | 2913 | let AddedComplexity = 5 in { |
| 2914 | def : Pat<(v4i32 (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<(v4f32 (palign:$src3 VR128:$src1, VR128:$src2)), |
| 2919 | (PALIGNR128rr VR128:$src2, VR128:$src1, |
| 2920 | (SHUFFLE_get_palign_imm VR128:$src3))>, |
| 2921 | Requires<[HasSSSE3]>; |
| 2922 | def : Pat<(v8i16 (palign:$src3 VR128:$src1, VR128:$src2)), |
| 2923 | (PALIGNR128rr VR128:$src2, VR128:$src1, |
| 2924 | (SHUFFLE_get_palign_imm VR128:$src3))>, |
| 2925 | Requires<[HasSSSE3]>; |
| 2926 | def : Pat<(v16i8 (palign:$src3 VR128:$src1, VR128:$src2)), |
| 2927 | (PALIGNR128rr VR128:$src2, VR128:$src1, |
| 2928 | (SHUFFLE_get_palign_imm VR128:$src3))>, |
| 2929 | Requires<[HasSSSE3]>; |
Eric Christopher | f365029 | 2009-11-07 08:45:53 +0000 | [diff] [blame] | 2930 | } |
Nate Begeman | 080f8e2 | 2009-10-19 02:17:23 +0000 | [diff] [blame] | 2931 | |
Nate Begeman | 2c87c42 | 2009-02-23 08:49:38 +0000 | [diff] [blame] | 2932 | def : Pat<(X86pshufb VR128:$src, VR128:$mask), |
| 2933 | (PSHUFBrr128 VR128:$src, VR128:$mask)>, Requires<[HasSSSE3]>; |
| 2934 | def : Pat<(X86pshufb VR128:$src, (bc_v16i8 (memopv2i64 addr:$mask))), |
| 2935 | (PSHUFBrm128 VR128:$src, addr:$mask)>, Requires<[HasSSSE3]>; |
| 2936 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2937 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2938 | // Non-Instruction Patterns |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2939 | //===---------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2940 | |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 2941 | // extload f32 -> f64. This matches load+fextend because we have a hack in |
| 2942 | // the isel (PreprocessForFPConvert) that can introduce loads after dag |
| 2943 | // combine. |
Chris Lattner | dec9cb5 | 2008-01-24 08:07:48 +0000 | [diff] [blame] | 2944 | // Since these loads aren't folded into the fextend, we have to match it |
| 2945 | // explicitly here. |
| 2946 | let Predicates = [HasSSE2] in |
| 2947 | def : Pat<(fextend (loadf32 addr:$src)), |
| 2948 | (CVTSS2SDrm addr:$src)>; |
| 2949 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2950 | // bit_convert |
| 2951 | let Predicates = [HasSSE2] in { |
| 2952 | def : Pat<(v2i64 (bitconvert (v4i32 VR128:$src))), (v2i64 VR128:$src)>; |
| 2953 | def : Pat<(v2i64 (bitconvert (v8i16 VR128:$src))), (v2i64 VR128:$src)>; |
| 2954 | def : Pat<(v2i64 (bitconvert (v16i8 VR128:$src))), (v2i64 VR128:$src)>; |
| 2955 | def : Pat<(v2i64 (bitconvert (v2f64 VR128:$src))), (v2i64 VR128:$src)>; |
| 2956 | def : Pat<(v2i64 (bitconvert (v4f32 VR128:$src))), (v2i64 VR128:$src)>; |
| 2957 | def : Pat<(v4i32 (bitconvert (v2i64 VR128:$src))), (v4i32 VR128:$src)>; |
| 2958 | def : Pat<(v4i32 (bitconvert (v8i16 VR128:$src))), (v4i32 VR128:$src)>; |
| 2959 | def : Pat<(v4i32 (bitconvert (v16i8 VR128:$src))), (v4i32 VR128:$src)>; |
| 2960 | def : Pat<(v4i32 (bitconvert (v2f64 VR128:$src))), (v4i32 VR128:$src)>; |
| 2961 | def : Pat<(v4i32 (bitconvert (v4f32 VR128:$src))), (v4i32 VR128:$src)>; |
| 2962 | def : Pat<(v8i16 (bitconvert (v2i64 VR128:$src))), (v8i16 VR128:$src)>; |
| 2963 | def : Pat<(v8i16 (bitconvert (v4i32 VR128:$src))), (v8i16 VR128:$src)>; |
| 2964 | def : Pat<(v8i16 (bitconvert (v16i8 VR128:$src))), (v8i16 VR128:$src)>; |
| 2965 | def : Pat<(v8i16 (bitconvert (v2f64 VR128:$src))), (v8i16 VR128:$src)>; |
| 2966 | def : Pat<(v8i16 (bitconvert (v4f32 VR128:$src))), (v8i16 VR128:$src)>; |
| 2967 | def : Pat<(v16i8 (bitconvert (v2i64 VR128:$src))), (v16i8 VR128:$src)>; |
| 2968 | def : Pat<(v16i8 (bitconvert (v4i32 VR128:$src))), (v16i8 VR128:$src)>; |
| 2969 | def : Pat<(v16i8 (bitconvert (v8i16 VR128:$src))), (v16i8 VR128:$src)>; |
| 2970 | def : Pat<(v16i8 (bitconvert (v2f64 VR128:$src))), (v16i8 VR128:$src)>; |
| 2971 | def : Pat<(v16i8 (bitconvert (v4f32 VR128:$src))), (v16i8 VR128:$src)>; |
| 2972 | def : Pat<(v4f32 (bitconvert (v2i64 VR128:$src))), (v4f32 VR128:$src)>; |
| 2973 | def : Pat<(v4f32 (bitconvert (v4i32 VR128:$src))), (v4f32 VR128:$src)>; |
| 2974 | def : Pat<(v4f32 (bitconvert (v8i16 VR128:$src))), (v4f32 VR128:$src)>; |
| 2975 | def : Pat<(v4f32 (bitconvert (v16i8 VR128:$src))), (v4f32 VR128:$src)>; |
| 2976 | def : Pat<(v4f32 (bitconvert (v2f64 VR128:$src))), (v4f32 VR128:$src)>; |
| 2977 | def : Pat<(v2f64 (bitconvert (v2i64 VR128:$src))), (v2f64 VR128:$src)>; |
| 2978 | def : Pat<(v2f64 (bitconvert (v4i32 VR128:$src))), (v2f64 VR128:$src)>; |
| 2979 | def : Pat<(v2f64 (bitconvert (v8i16 VR128:$src))), (v2f64 VR128:$src)>; |
| 2980 | def : Pat<(v2f64 (bitconvert (v16i8 VR128:$src))), (v2f64 VR128:$src)>; |
| 2981 | def : Pat<(v2f64 (bitconvert (v4f32 VR128:$src))), (v2f64 VR128:$src)>; |
| 2982 | } |
| 2983 | |
| 2984 | // Move scalar to XMM zero-extended |
| 2985 | // movd to XMM register zero-extends |
| 2986 | let AddedComplexity = 15 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2987 | // 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] | 2988 | def : Pat<(v2f64 (X86vzmovl (v2f64 (scalar_to_vector FR64:$src)))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2989 | (MOVLSD2PDrr (V_SET0), FR64:$src)>, Requires<[HasSSE2]>; |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 2990 | def : Pat<(v4f32 (X86vzmovl (v4f32 (scalar_to_vector FR32:$src)))), |
Anders Carlsson | fd7e450 | 2008-10-07 16:14:11 +0000 | [diff] [blame] | 2991 | (MOVLSS2PSrr (V_SET0), FR32:$src)>, Requires<[HasSSE1]>; |
Evan Cheng | e259e87 | 2008-05-09 23:37:55 +0000 | [diff] [blame] | 2992 | def : Pat<(v4f32 (X86vzmovl (v4f32 VR128:$src))), |
Anders Carlsson | fd7e450 | 2008-10-07 16:14:11 +0000 | [diff] [blame] | 2993 | (MOVLPSrr (V_SET0), VR128:$src)>, Requires<[HasSSE1]>; |
Evan Cheng | 7fe0ff0 | 2008-07-10 01:08:23 +0000 | [diff] [blame] | 2994 | def : Pat<(v4i32 (X86vzmovl (v4i32 VR128:$src))), |
Anders Carlsson | fd7e450 | 2008-10-07 16:14:11 +0000 | [diff] [blame] | 2995 | (MOVLPSrr (V_SET0), VR128:$src)>, Requires<[HasSSE1]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 2996 | } |
| 2997 | |
| 2998 | // Splat v2f64 / v2i64 |
| 2999 | let AddedComplexity = 10 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3000 | def : Pat<(splat_lo (v2f64 VR128:$src), (undef)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3001 | (UNPCKLPDrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3002 | def : Pat<(unpckh (v2f64 VR128:$src), (undef)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3003 | (UNPCKHPDrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3004 | def : Pat<(splat_lo (v2i64 VR128:$src), (undef)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3005 | (PUNPCKLQDQrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3006 | def : Pat<(unpckh (v2i64 VR128:$src), (undef)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3007 | (PUNPCKHQDQrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
| 3008 | } |
| 3009 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3010 | // Special unary SHUFPSrri case. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3011 | def : Pat<(v4f32 (pshufd:$src3 VR128:$src1, (undef))), |
| 3012 | (SHUFPSrri VR128:$src1, VR128:$src1, |
| 3013 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3014 | Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3015 | let AddedComplexity = 5 in |
| 3016 | def : Pat<(v4f32 (pshufd:$src2 VR128:$src1, (undef))), |
| 3017 | (PSHUFDri VR128:$src1, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
| 3018 | Requires<[HasSSE2]>; |
Dan Gohman | 7dc1901 | 2007-08-02 21:17:01 +0000 | [diff] [blame] | 3019 | // Special unary SHUFPDrri case. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3020 | def : Pat<(v2i64 (pshufd:$src3 VR128:$src1, (undef))), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3021 | (SHUFPDrri VR128:$src1, VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3022 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
| 3023 | Requires<[HasSSE2]>; |
| 3024 | // Special unary SHUFPDrri case. |
| 3025 | def : Pat<(v2f64 (pshufd:$src3 VR128:$src1, (undef))), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3026 | (SHUFPDrri VR128:$src1, VR128:$src1, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3027 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
Dan Gohman | 7dc1901 | 2007-08-02 21:17:01 +0000 | [diff] [blame] | 3028 | Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3029 | // Unary v4f32 shuffle with PSHUF* in order to fold a load. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3030 | def : Pat<(pshufd:$src2 (bc_v4i32 (memopv4f32 addr:$src1)), (undef)), |
| 3031 | (PSHUFDmi addr:$src1, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3032 | Requires<[HasSSE2]>; |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3033 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3034 | // Special binary v4i32 shuffle cases with SHUFPS. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3035 | def : Pat<(v4i32 (shufp:$src3 VR128:$src1, (v4i32 VR128:$src2))), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3036 | (SHUFPSrri VR128:$src1, VR128:$src2, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3037 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3038 | Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3039 | def : Pat<(v4i32 (shufp:$src3 VR128:$src1, (bc_v4i32 (memopv2i64 addr:$src2)))), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3040 | (SHUFPSrmi VR128:$src1, addr:$src2, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3041 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3042 | Requires<[HasSSE2]>; |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 3043 | // Special binary v2i64 shuffle cases using SHUFPDrri. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3044 | def : Pat<(v2i64 (shufp:$src3 VR128:$src1, VR128:$src2)), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3045 | (SHUFPDrri VR128:$src1, VR128:$src2, |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3046 | (SHUFFLE_get_shuf_imm VR128:$src3))>, |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 3047 | Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3048 | |
| 3049 | // vector_shuffle v1, <undef>, <0, 0, 1, 1, ...> |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3050 | let AddedComplexity = 15 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3051 | def : Pat<(v4i32 (unpckl_undef:$src2 VR128:$src, (undef))), |
| 3052 | (PSHUFDri VR128:$src, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3053 | Requires<[OptForSpeed, HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3054 | def : Pat<(v4f32 (unpckl_undef:$src2 VR128:$src, (undef))), |
| 3055 | (PSHUFDri VR128:$src, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3056 | Requires<[OptForSpeed, HasSSE2]>; |
| 3057 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3058 | let AddedComplexity = 10 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3059 | def : Pat<(v4f32 (unpckl_undef VR128:$src, (undef))), |
Evan Cheng | 09d4507 | 2008-09-26 21:26:30 +0000 | [diff] [blame] | 3060 | (UNPCKLPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3061 | def : Pat<(v16i8 (unpckl_undef VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3062 | (PUNPCKLBWrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3063 | def : Pat<(v8i16 (unpckl_undef VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3064 | (PUNPCKLWDrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3065 | def : Pat<(v4i32 (unpckl_undef VR128:$src, (undef))), |
Evan Cheng | 09d4507 | 2008-09-26 21:26:30 +0000 | [diff] [blame] | 3066 | (PUNPCKLDQrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3067 | } |
| 3068 | |
| 3069 | // vector_shuffle v1, <undef>, <2, 2, 3, 3, ...> |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3070 | let AddedComplexity = 15 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3071 | def : Pat<(v4i32 (unpckh_undef:$src2 VR128:$src, (undef))), |
| 3072 | (PSHUFDri VR128:$src, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3073 | Requires<[OptForSpeed, HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3074 | def : Pat<(v4f32 (unpckh_undef:$src2 VR128:$src, (undef))), |
| 3075 | (PSHUFDri VR128:$src, (SHUFFLE_get_shuf_imm VR128:$src2))>, |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3076 | Requires<[OptForSpeed, HasSSE2]>; |
| 3077 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3078 | let AddedComplexity = 10 in { |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3079 | def : Pat<(v4f32 (unpckh_undef VR128:$src, (undef))), |
Evan Cheng | 09d4507 | 2008-09-26 21:26:30 +0000 | [diff] [blame] | 3080 | (UNPCKHPSrr VR128:$src, VR128:$src)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3081 | def : Pat<(v16i8 (unpckh_undef VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3082 | (PUNPCKHBWrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3083 | def : Pat<(v8i16 (unpckh_undef VR128:$src, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3084 | (PUNPCKHWDrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3085 | def : Pat<(v4i32 (unpckh_undef VR128:$src, (undef))), |
Evan Cheng | 09d4507 | 2008-09-26 21:26:30 +0000 | [diff] [blame] | 3086 | (PUNPCKHDQrr VR128:$src, VR128:$src)>, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3087 | } |
| 3088 | |
Evan Cheng | 13559d6 | 2008-09-26 23:41:32 +0000 | [diff] [blame] | 3089 | let AddedComplexity = 20 in { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3090 | // vector_shuffle v1, v2 <0, 1, 4, 5> using MOVLHPS |
Nate Begeman | b13034d | 2009-11-07 23:17:15 +0000 | [diff] [blame] | 3091 | def : Pat<(v4i32 (movlhps VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3092 | (MOVLHPSrr VR128:$src1, VR128:$src2)>; |
| 3093 | |
| 3094 | // vector_shuffle v1, v2 <6, 7, 2, 3> using MOVHLPS |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3095 | def : Pat<(v4i32 (movhlps VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3096 | (MOVHLPSrr VR128:$src1, VR128:$src2)>; |
| 3097 | |
| 3098 | // vector_shuffle v1, undef <2, ?, ?, ?> using MOVHLPS |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3099 | def : Pat<(v4f32 (movhlps_undef VR128:$src1, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3100 | (MOVHLPSrr VR128:$src1, VR128:$src1)>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3101 | def : Pat<(v4i32 (movhlps_undef VR128:$src1, (undef))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3102 | (MOVHLPSrr VR128:$src1, VR128:$src1)>; |
| 3103 | } |
| 3104 | |
| 3105 | let AddedComplexity = 20 in { |
| 3106 | // vector_shuffle v1, (load v2) <4, 5, 2, 3> using MOVLPS |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3107 | def : Pat<(v4f32 (movlp VR128:$src1, (load addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3108 | (MOVLPSrm VR128:$src1, addr:$src2)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3109 | def : Pat<(v2f64 (movlp VR128:$src1, (load addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3110 | (MOVLPDrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3111 | def : Pat<(v4i32 (movlp VR128:$src1, (load addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3112 | (MOVLPSrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3113 | def : Pat<(v2i64 (movlp VR128:$src1, (load addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3114 | (MOVLPDrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3115 | } |
| 3116 | |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3117 | // (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] | 3118 | def : Pat<(store (v4f32 (movlp (load addr:$src1), VR128:$src2)), addr:$src1), |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3119 | (MOVLPSmr addr:$src1, VR128:$src2)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3120 | def : Pat<(store (v2f64 (movlp (load addr:$src1), VR128:$src2)), addr:$src1), |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3121 | (MOVLPDmr addr:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3122 | def : Pat<(store (v4i32 (movlp (bc_v4i32 (loadv2i64 addr:$src1)), VR128:$src2)), |
| 3123 | addr:$src1), |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3124 | (MOVLPSmr addr:$src1, VR128:$src2)>, Requires<[HasSSE1]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3125 | def : Pat<(store (v2i64 (movlp (load addr:$src1), VR128:$src2)), addr:$src1), |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3126 | (MOVLPDmr addr:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
Evan Cheng | 2b2a701 | 2008-05-23 21:23:16 +0000 | [diff] [blame] | 3127 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3128 | let AddedComplexity = 15 in { |
| 3129 | // Setting the lowest element in the vector. |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3130 | def : Pat<(v4i32 (movl VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3131 | (MOVLPSrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3132 | def : Pat<(v2i64 (movl VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3133 | (MOVLPDrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
| 3134 | |
| 3135 | // vector_shuffle v1, v2 <4, 5, 2, 3> using MOVLPDrr (movsd) |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3136 | def : Pat<(v4f32 (movlp VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3137 | (MOVLPDrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3138 | def : Pat<(v4i32 (movlp VR128:$src1, VR128:$src2)), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3139 | (MOVLPDrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
| 3140 | } |
| 3141 | |
Eli Friedman | 27d1974 | 2009-06-19 07:00:55 +0000 | [diff] [blame] | 3142 | // vector_shuffle v1, v2 <4, 5, 2, 3> using SHUFPSrri (we prefer movsd, but |
| 3143 | // fall back to this for SSE1) |
| 3144 | def : Pat<(v4f32 (movlp:$src3 VR128:$src1, (v4f32 VR128:$src2))), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3145 | (SHUFPSrri VR128:$src2, VR128:$src1, |
Eli Friedman | 27d1974 | 2009-06-19 07:00:55 +0000 | [diff] [blame] | 3146 | (SHUFFLE_get_shuf_imm VR128:$src3))>, Requires<[HasSSE1]>; |
| 3147 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3148 | // Set lowest element and zero upper elements. |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 3149 | let AddedComplexity = 15 in |
Nate Begeman | 543d214 | 2009-04-27 18:41:29 +0000 | [diff] [blame] | 3150 | def : Pat<(v2f64 (movl immAllZerosV_bc, VR128:$src)), |
Evan Cheng | 15e8f5a | 2007-12-15 03:00:47 +0000 | [diff] [blame] | 3151 | (MOVZPQILo2PQIrr VR128:$src)>, Requires<[HasSSE2]>; |
Evan Cheng | e9b9c67 | 2008-05-09 21:53:03 +0000 | [diff] [blame] | 3152 | def : Pat<(v2f64 (X86vzmovl (v2f64 VR128:$src))), |
Evan Cheng | d09a8a0 | 2008-05-08 22:35:02 +0000 | [diff] [blame] | 3153 | (MOVZPQILo2PQIrr VR128:$src)>, Requires<[HasSSE2]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3154 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3155 | // Some special case pandn patterns. |
| 3156 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v4i32 immAllOnesV))), |
| 3157 | VR128:$src2)), |
| 3158 | (PANDNrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
| 3159 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v8i16 immAllOnesV))), |
| 3160 | VR128:$src2)), |
| 3161 | (PANDNrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
| 3162 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v16i8 immAllOnesV))), |
| 3163 | VR128:$src2)), |
| 3164 | (PANDNrr VR128:$src1, VR128:$src2)>, Requires<[HasSSE2]>; |
| 3165 | |
| 3166 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v4i32 immAllOnesV))), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3167 | (memop addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3168 | (PANDNrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
| 3169 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v8i16 immAllOnesV))), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3170 | (memop addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3171 | (PANDNrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
| 3172 | def : Pat<(v2i64 (and (xor VR128:$src1, (bc_v2i64 (v16i8 immAllOnesV))), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3173 | (memop addr:$src2))), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 3174 | (PANDNrm VR128:$src1, addr:$src2)>, Requires<[HasSSE2]>; |
| 3175 | |
Nate Begeman | 78246ca | 2007-11-17 03:58:34 +0000 | [diff] [blame] | 3176 | // vector -> vector casts |
| 3177 | def : Pat<(v4f32 (sint_to_fp (v4i32 VR128:$src))), |
| 3178 | (Int_CVTDQ2PSrr VR128:$src)>, Requires<[HasSSE2]>; |
| 3179 | def : Pat<(v4i32 (fp_to_sint (v4f32 VR128:$src))), |
| 3180 | (Int_CVTTPS2DQrr VR128:$src)>, Requires<[HasSSE2]>; |
Eli Friedman | 7fa52ca | 2008-09-05 23:07:03 +0000 | [diff] [blame] | 3181 | def : Pat<(v2f64 (sint_to_fp (v2i32 VR64:$src))), |
| 3182 | (Int_CVTPI2PDrr VR64:$src)>, Requires<[HasSSE2]>; |
| 3183 | def : Pat<(v2i32 (fp_to_sint (v2f64 VR128:$src))), |
| 3184 | (Int_CVTTPD2PIrr VR128:$src)>, Requires<[HasSSE2]>; |
Nate Begeman | 78246ca | 2007-11-17 03:58:34 +0000 | [diff] [blame] | 3185 | |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 3186 | // Use movaps / movups for SSE integer load / store (one byte shorter). |
Dan Gohman | 1182170 | 2007-07-27 17:16:43 +0000 | [diff] [blame] | 3187 | def : Pat<(alignedloadv4i32 addr:$src), |
| 3188 | (MOVAPSrm addr:$src)>, Requires<[HasSSE1]>; |
| 3189 | def : Pat<(loadv4i32 addr:$src), |
| 3190 | (MOVUPSrm addr:$src)>, Requires<[HasSSE1]>; |
Evan Cheng | 51a49b2 | 2007-07-20 00:27:43 +0000 | [diff] [blame] | 3191 | def : Pat<(alignedloadv2i64 addr:$src), |
| 3192 | (MOVAPSrm addr:$src)>, Requires<[HasSSE2]>; |
| 3193 | def : Pat<(loadv2i64 addr:$src), |
| 3194 | (MOVUPSrm addr:$src)>, Requires<[HasSSE2]>; |
| 3195 | |
| 3196 | def : Pat<(alignedstore (v2i64 VR128:$src), addr:$dst), |
| 3197 | (MOVAPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3198 | def : Pat<(alignedstore (v4i32 VR128:$src), addr:$dst), |
| 3199 | (MOVAPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3200 | def : Pat<(alignedstore (v8i16 VR128:$src), addr:$dst), |
| 3201 | (MOVAPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3202 | def : Pat<(alignedstore (v16i8 VR128:$src), addr:$dst), |
| 3203 | (MOVAPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3204 | def : Pat<(store (v2i64 VR128:$src), addr:$dst), |
| 3205 | (MOVUPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3206 | def : Pat<(store (v4i32 VR128:$src), addr:$dst), |
| 3207 | (MOVUPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3208 | def : Pat<(store (v8i16 VR128:$src), addr:$dst), |
| 3209 | (MOVUPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
| 3210 | def : Pat<(store (v16i8 VR128:$src), addr:$dst), |
| 3211 | (MOVUPSmr addr:$dst, VR128:$src)>, Requires<[HasSSE2]>; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3212 | |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3213 | //===----------------------------------------------------------------------===// |
| 3214 | // SSE4.1 Instructions |
| 3215 | //===----------------------------------------------------------------------===// |
| 3216 | |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3217 | multiclass sse41_fp_unop_rm<bits<8> opcps, bits<8> opcpd, |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3218 | string OpcodeStr, |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3219 | Intrinsic V4F32Int, |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3220 | Intrinsic V2F64Int> { |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3221 | // Intrinsic operation, reg. |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3222 | // Vector intrinsic operation, reg |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3223 | def PSr_Int : SS4AIi8<opcps, MRMSrcReg, |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3224 | (outs VR128:$dst), (ins VR128:$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}"), |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3227 | [(set VR128:$dst, (V4F32Int VR128:$src1, imm:$src2))]>, |
| 3228 | OpSize; |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3229 | |
| 3230 | // Vector intrinsic operation, mem |
Evan Cheng | d3f27fb | 2009-12-18 07:40:29 +0000 | [diff] [blame] | 3231 | def PSm_Int : Ii8<opcps, MRMSrcMem, |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3232 | (outs VR128:$dst), (ins f128mem:$src1, i32i8imm:$src2), |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3233 | !strconcat(OpcodeStr, |
| 3234 | "ps\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3235 | [(set VR128:$dst, |
| 3236 | (V4F32Int (memopv4f32 addr:$src1),imm:$src2))]>, |
Evan Cheng | d3f27fb | 2009-12-18 07:40:29 +0000 | [diff] [blame] | 3237 | TA, OpSize, |
Evan Cheng | d53fca1 | 2009-12-22 17:47:23 +0000 | [diff] [blame] | 3238 | Requires<[HasSSE41]>; |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3239 | |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3240 | // Vector intrinsic operation, reg |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3241 | def PDr_Int : SS4AIi8<opcpd, MRMSrcReg, |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3242 | (outs VR128:$dst), (ins VR128:$src1, i32i8imm:$src2), |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3243 | !strconcat(OpcodeStr, |
| 3244 | "pd\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3245 | [(set VR128:$dst, (V2F64Int VR128:$src1, imm:$src2))]>, |
| 3246 | OpSize; |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3247 | |
| 3248 | // Vector intrinsic operation, mem |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3249 | def PDm_Int : SS4AIi8<opcpd, MRMSrcMem, |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3250 | (outs VR128:$dst), (ins f128mem:$src1, i32i8imm:$src2), |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3251 | !strconcat(OpcodeStr, |
| 3252 | "pd\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3253 | [(set VR128:$dst, |
| 3254 | (V2F64Int (memopv2f64 addr:$src1),imm:$src2))]>, |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3255 | OpSize; |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3256 | } |
| 3257 | |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3258 | let Constraints = "$src1 = $dst" in { |
| 3259 | multiclass sse41_fp_binop_rm<bits<8> opcss, bits<8> opcsd, |
| 3260 | string OpcodeStr, |
| 3261 | Intrinsic F32Int, |
| 3262 | Intrinsic F64Int> { |
| 3263 | // Intrinsic operation, reg. |
| 3264 | def SSr_Int : SS4AIi8<opcss, MRMSrcReg, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3265 | (outs VR128:$dst), |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3266 | (ins VR128:$src1, VR128:$src2, i32i8imm:$src3), |
| 3267 | !strconcat(OpcodeStr, |
| 3268 | "ss\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3269 | [(set VR128:$dst, |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3270 | (F32Int VR128:$src1, VR128:$src2, imm:$src3))]>, |
| 3271 | OpSize; |
| 3272 | |
| 3273 | // Intrinsic operation, mem. |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3274 | def SSm_Int : SS4AIi8<opcss, MRMSrcMem, |
| 3275 | (outs VR128:$dst), |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3276 | (ins VR128:$src1, ssmem:$src2, i32i8imm:$src3), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3277 | !strconcat(OpcodeStr, |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3278 | "ss\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3279 | [(set VR128:$dst, |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3280 | (F32Int VR128:$src1, sse_load_f32:$src2, imm:$src3))]>, |
| 3281 | OpSize; |
| 3282 | |
| 3283 | // Intrinsic operation, reg. |
| 3284 | def SDr_Int : SS4AIi8<opcsd, MRMSrcReg, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3285 | (outs VR128:$dst), |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3286 | (ins VR128:$src1, VR128:$src2, i32i8imm:$src3), |
| 3287 | !strconcat(OpcodeStr, |
| 3288 | "sd\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3289 | [(set VR128:$dst, |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3290 | (F64Int VR128:$src1, VR128:$src2, imm:$src3))]>, |
| 3291 | OpSize; |
| 3292 | |
| 3293 | // Intrinsic operation, mem. |
| 3294 | def SDm_Int : SS4AIi8<opcsd, MRMSrcMem, |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3295 | (outs VR128:$dst), |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3296 | (ins VR128:$src1, sdmem:$src2, i32i8imm:$src3), |
| 3297 | !strconcat(OpcodeStr, |
| 3298 | "sd\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3299 | [(set VR128:$dst, |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3300 | (F64Int VR128:$src1, sse_load_f64:$src2, imm:$src3))]>, |
| 3301 | OpSize; |
| 3302 | } |
| 3303 | } |
| 3304 | |
Nate Begeman | b297556 | 2008-02-03 07:18:54 +0000 | [diff] [blame] | 3305 | // FP round - roundss, roundps, roundsd, roundpd |
Dale Johannesen | a7d2b44 | 2008-10-10 23:51:03 +0000 | [diff] [blame] | 3306 | defm ROUND : sse41_fp_unop_rm<0x08, 0x09, "round", |
| 3307 | int_x86_sse41_round_ps, int_x86_sse41_round_pd>; |
| 3308 | defm ROUND : sse41_fp_binop_rm<0x0A, 0x0B, "round", |
| 3309 | int_x86_sse41_round_ss, int_x86_sse41_round_sd>; |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3310 | |
| 3311 | // SS41I_unop_rm_int_v16 - SSE 4.1 unary operator whose type is v8i16. |
| 3312 | multiclass SS41I_unop_rm_int_v16<bits<8> opc, string OpcodeStr, |
| 3313 | Intrinsic IntId128> { |
| 3314 | def rr128 : SS48I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3315 | (ins VR128:$src), |
| 3316 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 3317 | [(set VR128:$dst, (IntId128 VR128:$src))]>, OpSize; |
| 3318 | def rm128 : SS48I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3319 | (ins i128mem:$src), |
| 3320 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 3321 | [(set VR128:$dst, |
| 3322 | (IntId128 |
| 3323 | (bitconvert (memopv8i16 addr:$src))))]>, OpSize; |
| 3324 | } |
| 3325 | |
| 3326 | defm PHMINPOSUW : SS41I_unop_rm_int_v16 <0x41, "phminposuw", |
| 3327 | int_x86_sse41_phminposuw>; |
| 3328 | |
| 3329 | /// SS41I_binop_rm_int - Simple SSE 4.1 binary operator |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3330 | let Constraints = "$src1 = $dst" in { |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3331 | multiclass SS41I_binop_rm_int<bits<8> opc, string OpcodeStr, |
| 3332 | Intrinsic IntId128, bit Commutable = 0> { |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3333 | def rr : SS48I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3334 | (ins VR128:$src1, VR128:$src2), |
| 3335 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3336 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 3337 | OpSize { |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3338 | let isCommutable = Commutable; |
| 3339 | } |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3340 | def rm : SS48I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3341 | (ins VR128:$src1, i128mem:$src2), |
| 3342 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3343 | [(set VR128:$dst, |
| 3344 | (IntId128 VR128:$src1, |
| 3345 | (bitconvert (memopv16i8 addr:$src2))))]>, OpSize; |
Nate Begeman | eb3f543 | 2008-02-04 05:34:34 +0000 | [diff] [blame] | 3346 | } |
| 3347 | } |
| 3348 | |
| 3349 | defm PCMPEQQ : SS41I_binop_rm_int<0x29, "pcmpeqq", |
| 3350 | int_x86_sse41_pcmpeqq, 1>; |
| 3351 | defm PACKUSDW : SS41I_binop_rm_int<0x2B, "packusdw", |
| 3352 | int_x86_sse41_packusdw, 0>; |
| 3353 | defm PMINSB : SS41I_binop_rm_int<0x38, "pminsb", |
| 3354 | int_x86_sse41_pminsb, 1>; |
| 3355 | defm PMINSD : SS41I_binop_rm_int<0x39, "pminsd", |
| 3356 | int_x86_sse41_pminsd, 1>; |
| 3357 | defm PMINUD : SS41I_binop_rm_int<0x3B, "pminud", |
| 3358 | int_x86_sse41_pminud, 1>; |
| 3359 | defm PMINUW : SS41I_binop_rm_int<0x3A, "pminuw", |
| 3360 | int_x86_sse41_pminuw, 1>; |
| 3361 | defm PMAXSB : SS41I_binop_rm_int<0x3C, "pmaxsb", |
| 3362 | int_x86_sse41_pmaxsb, 1>; |
| 3363 | defm PMAXSD : SS41I_binop_rm_int<0x3D, "pmaxsd", |
| 3364 | int_x86_sse41_pmaxsd, 1>; |
| 3365 | defm PMAXUD : SS41I_binop_rm_int<0x3F, "pmaxud", |
| 3366 | int_x86_sse41_pmaxud, 1>; |
| 3367 | defm PMAXUW : SS41I_binop_rm_int<0x3E, "pmaxuw", |
| 3368 | int_x86_sse41_pmaxuw, 1>; |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3369 | |
Mon P Wang | 14edb09 | 2008-12-18 21:42:19 +0000 | [diff] [blame] | 3370 | defm PMULDQ : SS41I_binop_rm_int<0x28, "pmuldq", int_x86_sse41_pmuldq, 1>; |
| 3371 | |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 3372 | def : Pat<(v2i64 (X86pcmpeqq VR128:$src1, VR128:$src2)), |
| 3373 | (PCMPEQQrr VR128:$src1, VR128:$src2)>; |
| 3374 | def : Pat<(v2i64 (X86pcmpeqq VR128:$src1, (memop addr:$src2))), |
| 3375 | (PCMPEQQrm VR128:$src1, addr:$src2)>; |
| 3376 | |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3377 | /// SS41I_binop_rm_int - Simple SSE 4.1 binary operator |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3378 | let Constraints = "$src1 = $dst" in { |
Dan Gohman | e3731f5 | 2008-05-23 17:49:40 +0000 | [diff] [blame] | 3379 | multiclass SS41I_binop_patint<bits<8> opc, string OpcodeStr, ValueType OpVT, |
| 3380 | SDNode OpNode, Intrinsic IntId128, |
| 3381 | bit Commutable = 0> { |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3382 | def rr : SS48I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3383 | (ins VR128:$src1, VR128:$src2), |
| 3384 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
Dan Gohman | e3731f5 | 2008-05-23 17:49:40 +0000 | [diff] [blame] | 3385 | [(set VR128:$dst, (OpNode (OpVT VR128:$src1), |
| 3386 | VR128:$src2))]>, OpSize { |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3387 | let isCommutable = Commutable; |
| 3388 | } |
| 3389 | def rr_int : SS48I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3390 | (ins VR128:$src1, VR128:$src2), |
| 3391 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3392 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 3393 | OpSize { |
| 3394 | let isCommutable = Commutable; |
| 3395 | } |
| 3396 | def rm : SS48I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3397 | (ins VR128:$src1, i128mem:$src2), |
| 3398 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3399 | [(set VR128:$dst, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3400 | (OpNode VR128:$src1, (memop addr:$src2)))]>, OpSize; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3401 | def rm_int : SS48I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3402 | (ins VR128:$src1, i128mem:$src2), |
| 3403 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3404 | [(set VR128:$dst, |
Evan Cheng | 00b66ef | 2008-05-23 00:37:07 +0000 | [diff] [blame] | 3405 | (IntId128 VR128:$src1, (memop addr:$src2)))]>, |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3406 | OpSize; |
| 3407 | } |
| 3408 | } |
Dan Gohman | e3731f5 | 2008-05-23 17:49:40 +0000 | [diff] [blame] | 3409 | defm PMULLD : SS41I_binop_patint<0x40, "pmulld", v4i32, mul, |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3410 | int_x86_sse41_pmulld, 1>; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3411 | |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3412 | /// 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] | 3413 | let Constraints = "$src1 = $dst" in { |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3414 | multiclass SS41I_binop_rmi_int<bits<8> opc, string OpcodeStr, |
| 3415 | Intrinsic IntId128, bit Commutable = 0> { |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3416 | def rri : SS4AIi8<opc, MRMSrcReg, (outs VR128:$dst), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3417 | (ins VR128:$src1, VR128:$src2, i32i8imm:$src3), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3418 | !strconcat(OpcodeStr, |
Nate Begeman | b4e9a04 | 2008-02-10 18:47:57 +0000 | [diff] [blame] | 3419 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3420 | [(set VR128:$dst, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3421 | (IntId128 VR128:$src1, VR128:$src2, imm:$src3))]>, |
| 3422 | OpSize { |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3423 | let isCommutable = Commutable; |
| 3424 | } |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3425 | def rmi : SS4AIi8<opc, MRMSrcMem, (outs VR128:$dst), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3426 | (ins VR128:$src1, i128mem:$src2, i32i8imm:$src3), |
| 3427 | !strconcat(OpcodeStr, |
Nate Begeman | b4e9a04 | 2008-02-10 18:47:57 +0000 | [diff] [blame] | 3428 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3429 | [(set VR128:$dst, |
| 3430 | (IntId128 VR128:$src1, |
| 3431 | (bitconvert (memopv16i8 addr:$src2)), imm:$src3))]>, |
| 3432 | OpSize; |
Nate Begeman | 72d802a | 2008-02-04 06:00:24 +0000 | [diff] [blame] | 3433 | } |
| 3434 | } |
| 3435 | |
| 3436 | defm BLENDPS : SS41I_binop_rmi_int<0x0C, "blendps", |
| 3437 | int_x86_sse41_blendps, 0>; |
| 3438 | defm BLENDPD : SS41I_binop_rmi_int<0x0D, "blendpd", |
| 3439 | int_x86_sse41_blendpd, 0>; |
| 3440 | defm PBLENDW : SS41I_binop_rmi_int<0x0E, "pblendw", |
| 3441 | int_x86_sse41_pblendw, 0>; |
| 3442 | defm DPPS : SS41I_binop_rmi_int<0x40, "dpps", |
| 3443 | int_x86_sse41_dpps, 1>; |
| 3444 | defm DPPD : SS41I_binop_rmi_int<0x41, "dppd", |
| 3445 | int_x86_sse41_dppd, 1>; |
| 3446 | defm MPSADBW : SS41I_binop_rmi_int<0x42, "mpsadbw", |
Evan Cheng | 81ed985 | 2008-06-16 20:25:59 +0000 | [diff] [blame] | 3447 | int_x86_sse41_mpsadbw, 1>; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3448 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3449 | |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3450 | /// SS41I_ternary_int - SSE 4.1 ternary operator |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3451 | let Uses = [XMM0], Constraints = "$src1 = $dst" in { |
Nate Begeman | b4e9a04 | 2008-02-10 18:47:57 +0000 | [diff] [blame] | 3452 | multiclass SS41I_ternary_int<bits<8> opc, string OpcodeStr, Intrinsic IntId> { |
| 3453 | def rr0 : SS48I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3454 | (ins VR128:$src1, VR128:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3455 | !strconcat(OpcodeStr, |
Nate Begeman | b4e9a04 | 2008-02-10 18:47:57 +0000 | [diff] [blame] | 3456 | "\t{%xmm0, $src2, $dst|$dst, $src2, %xmm0}"), |
| 3457 | [(set VR128:$dst, (IntId VR128:$src1, VR128:$src2, XMM0))]>, |
| 3458 | OpSize; |
| 3459 | |
| 3460 | def rm0 : SS48I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3461 | (ins VR128:$src1, i128mem:$src2), |
| 3462 | !strconcat(OpcodeStr, |
| 3463 | "\t{%xmm0, $src2, $dst|$dst, $src2, %xmm0}"), |
| 3464 | [(set VR128:$dst, |
| 3465 | (IntId VR128:$src1, |
| 3466 | (bitconvert (memopv16i8 addr:$src2)), XMM0))]>, OpSize; |
| 3467 | } |
| 3468 | } |
| 3469 | |
| 3470 | defm BLENDVPD : SS41I_ternary_int<0x15, "blendvpd", int_x86_sse41_blendvpd>; |
| 3471 | defm BLENDVPS : SS41I_ternary_int<0x14, "blendvps", int_x86_sse41_blendvps>; |
| 3472 | defm PBLENDVB : SS41I_ternary_int<0x10, "pblendvb", int_x86_sse41_pblendvb>; |
| 3473 | |
| 3474 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3475 | multiclass SS41I_binop_rm_int8<bits<8> opc, string OpcodeStr, Intrinsic IntId> { |
| 3476 | def rr : SS48I<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 3477 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 3478 | [(set VR128:$dst, (IntId VR128:$src))]>, OpSize; |
| 3479 | |
| 3480 | def rm : SS48I<opc, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), |
| 3481 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3482 | [(set VR128:$dst, |
| 3483 | (IntId (bitconvert (v2i64 (scalar_to_vector (loadi64 addr:$src))))))]>, |
| 3484 | OpSize; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3485 | } |
| 3486 | |
| 3487 | defm PMOVSXBW : SS41I_binop_rm_int8<0x20, "pmovsxbw", int_x86_sse41_pmovsxbw>; |
| 3488 | defm PMOVSXWD : SS41I_binop_rm_int8<0x23, "pmovsxwd", int_x86_sse41_pmovsxwd>; |
| 3489 | defm PMOVSXDQ : SS41I_binop_rm_int8<0x25, "pmovsxdq", int_x86_sse41_pmovsxdq>; |
| 3490 | defm PMOVZXBW : SS41I_binop_rm_int8<0x30, "pmovzxbw", int_x86_sse41_pmovzxbw>; |
| 3491 | defm PMOVZXWD : SS41I_binop_rm_int8<0x33, "pmovzxwd", int_x86_sse41_pmovzxwd>; |
| 3492 | defm PMOVZXDQ : SS41I_binop_rm_int8<0x35, "pmovzxdq", int_x86_sse41_pmovzxdq>; |
| 3493 | |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3494 | // Common patterns involving scalar load. |
| 3495 | def : Pat<(int_x86_sse41_pmovsxbw (vzmovl_v2i64 addr:$src)), |
| 3496 | (PMOVSXBWrm addr:$src)>, Requires<[HasSSE41]>; |
| 3497 | def : Pat<(int_x86_sse41_pmovsxbw (vzload_v2i64 addr:$src)), |
| 3498 | (PMOVSXBWrm addr:$src)>, Requires<[HasSSE41]>; |
| 3499 | |
| 3500 | def : Pat<(int_x86_sse41_pmovsxwd (vzmovl_v2i64 addr:$src)), |
| 3501 | (PMOVSXWDrm addr:$src)>, Requires<[HasSSE41]>; |
| 3502 | def : Pat<(int_x86_sse41_pmovsxwd (vzload_v2i64 addr:$src)), |
| 3503 | (PMOVSXWDrm addr:$src)>, Requires<[HasSSE41]>; |
| 3504 | |
| 3505 | def : Pat<(int_x86_sse41_pmovsxdq (vzmovl_v2i64 addr:$src)), |
| 3506 | (PMOVSXDQrm addr:$src)>, Requires<[HasSSE41]>; |
| 3507 | def : Pat<(int_x86_sse41_pmovsxdq (vzload_v2i64 addr:$src)), |
| 3508 | (PMOVSXDQrm addr:$src)>, Requires<[HasSSE41]>; |
| 3509 | |
| 3510 | def : Pat<(int_x86_sse41_pmovzxbw (vzmovl_v2i64 addr:$src)), |
| 3511 | (PMOVZXBWrm addr:$src)>, Requires<[HasSSE41]>; |
| 3512 | def : Pat<(int_x86_sse41_pmovzxbw (vzload_v2i64 addr:$src)), |
| 3513 | (PMOVZXBWrm addr:$src)>, Requires<[HasSSE41]>; |
| 3514 | |
| 3515 | def : Pat<(int_x86_sse41_pmovzxwd (vzmovl_v2i64 addr:$src)), |
| 3516 | (PMOVZXWDrm addr:$src)>, Requires<[HasSSE41]>; |
| 3517 | def : Pat<(int_x86_sse41_pmovzxwd (vzload_v2i64 addr:$src)), |
| 3518 | (PMOVZXWDrm addr:$src)>, Requires<[HasSSE41]>; |
| 3519 | |
| 3520 | def : Pat<(int_x86_sse41_pmovzxdq (vzmovl_v2i64 addr:$src)), |
| 3521 | (PMOVZXDQrm addr:$src)>, Requires<[HasSSE41]>; |
| 3522 | def : Pat<(int_x86_sse41_pmovzxdq (vzload_v2i64 addr:$src)), |
| 3523 | (PMOVZXDQrm addr:$src)>, Requires<[HasSSE41]>; |
| 3524 | |
| 3525 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3526 | multiclass SS41I_binop_rm_int4<bits<8> opc, string OpcodeStr, Intrinsic IntId> { |
| 3527 | def rr : SS48I<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 3528 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 3529 | [(set VR128:$dst, (IntId VR128:$src))]>, OpSize; |
| 3530 | |
| 3531 | def rm : SS48I<opc, MRMSrcMem, (outs VR128:$dst), (ins i32mem:$src), |
| 3532 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3533 | [(set VR128:$dst, |
| 3534 | (IntId (bitconvert (v4i32 (scalar_to_vector (loadi32 addr:$src))))))]>, |
| 3535 | OpSize; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3536 | } |
| 3537 | |
| 3538 | defm PMOVSXBD : SS41I_binop_rm_int4<0x21, "pmovsxbd", int_x86_sse41_pmovsxbd>; |
| 3539 | defm PMOVSXWQ : SS41I_binop_rm_int4<0x24, "pmovsxwq", int_x86_sse41_pmovsxwq>; |
| 3540 | defm PMOVZXBD : SS41I_binop_rm_int4<0x31, "pmovzxbd", int_x86_sse41_pmovzxbd>; |
| 3541 | defm PMOVZXWQ : SS41I_binop_rm_int4<0x34, "pmovzxwq", int_x86_sse41_pmovzxwq>; |
| 3542 | |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3543 | // Common patterns involving scalar load |
| 3544 | def : Pat<(int_x86_sse41_pmovsxbd (vzmovl_v4i32 addr:$src)), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3545 | (PMOVSXBDrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3546 | def : Pat<(int_x86_sse41_pmovsxwq (vzmovl_v4i32 addr:$src)), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3547 | (PMOVSXWQrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3548 | |
| 3549 | def : Pat<(int_x86_sse41_pmovzxbd (vzmovl_v4i32 addr:$src)), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3550 | (PMOVZXBDrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3551 | def : Pat<(int_x86_sse41_pmovzxwq (vzmovl_v4i32 addr:$src)), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3552 | (PMOVZXWQrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3553 | |
| 3554 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3555 | multiclass SS41I_binop_rm_int2<bits<8> opc, string OpcodeStr, Intrinsic IntId> { |
| 3556 | def rr : SS48I<opc, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), |
| 3557 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
| 3558 | [(set VR128:$dst, (IntId VR128:$src))]>, OpSize; |
| 3559 | |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3560 | // Expecting a i16 load any extended to i32 value. |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3561 | def rm : SS48I<opc, MRMSrcMem, (outs VR128:$dst), (ins i16mem:$src), |
| 3562 | !strconcat(OpcodeStr, "\t{$src, $dst|$dst, $src}"), |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3563 | [(set VR128:$dst, (IntId (bitconvert |
| 3564 | (v4i32 (scalar_to_vector (loadi16_anyext addr:$src))))))]>, |
| 3565 | OpSize; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3566 | } |
| 3567 | |
| 3568 | defm PMOVSXBQ : SS41I_binop_rm_int2<0x22, "pmovsxbq", int_x86_sse41_pmovsxbq>; |
Eli Friedman | 75a89d6 | 2009-06-06 05:55:37 +0000 | [diff] [blame] | 3569 | defm PMOVZXBQ : SS41I_binop_rm_int2<0x32, "pmovzxbq", int_x86_sse41_pmovzxbq>; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3570 | |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3571 | // Common patterns involving scalar load |
| 3572 | def : Pat<(int_x86_sse41_pmovsxbq |
| 3573 | (bitconvert (v4i32 (X86vzmovl |
| 3574 | (v4i32 (scalar_to_vector (loadi32 addr:$src))))))), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3575 | (PMOVSXBQrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3576 | |
| 3577 | def : Pat<(int_x86_sse41_pmovzxbq |
| 3578 | (bitconvert (v4i32 (X86vzmovl |
| 3579 | (v4i32 (scalar_to_vector (loadi32 addr:$src))))))), |
Evan Cheng | 00a3ec5 | 2008-09-25 00:49:51 +0000 | [diff] [blame] | 3580 | (PMOVZXBQrm addr:$src)>, Requires<[HasSSE41]>; |
Evan Cheng | 56ec77b | 2008-09-24 23:27:55 +0000 | [diff] [blame] | 3581 | |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3582 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3583 | /// SS41I_binop_ext8 - SSE 4.1 extract 8 bits to 32 bit reg or 8 bit mem |
| 3584 | multiclass SS41I_extract8<bits<8> opc, string OpcodeStr> { |
Evan Cheng | c2054be | 2008-03-26 08:11:49 +0000 | [diff] [blame] | 3585 | def rr : SS4AIi8<opc, MRMDestReg, (outs GR32:$dst), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3586 | (ins VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3587 | !strconcat(OpcodeStr, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3588 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3589 | [(set GR32:$dst, (X86pextrb (v16i8 VR128:$src1), imm:$src2))]>, |
| 3590 | OpSize; |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3591 | def mr : SS4AIi8<opc, MRMDestMem, (outs), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3592 | (ins i8mem:$dst, VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3593 | !strconcat(OpcodeStr, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3594 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3595 | []>, OpSize; |
| 3596 | // FIXME: |
| 3597 | // There's an AssertZext in the way of writing the store pattern |
| 3598 | // (store (i8 (trunc (X86pextrb (v16i8 VR128:$src1), imm:$src2))), addr:$dst) |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3599 | } |
| 3600 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3601 | defm PEXTRB : SS41I_extract8<0x14, "pextrb">; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3602 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3603 | |
| 3604 | /// SS41I_extract16 - SSE 4.1 extract 16 bits to memory destination |
| 3605 | multiclass SS41I_extract16<bits<8> opc, string OpcodeStr> { |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3606 | def mr : SS4AIi8<opc, MRMDestMem, (outs), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3607 | (ins i16mem:$dst, VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3608 | !strconcat(OpcodeStr, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3609 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
| 3610 | []>, OpSize; |
| 3611 | // FIXME: |
| 3612 | // There's an AssertZext in the way of writing the store pattern |
| 3613 | // (store (i16 (trunc (X86pextrw (v16i8 VR128:$src1), imm:$src2))), addr:$dst) |
| 3614 | } |
| 3615 | |
| 3616 | defm PEXTRW : SS41I_extract16<0x15, "pextrw">; |
| 3617 | |
| 3618 | |
| 3619 | /// SS41I_extract32 - SSE 4.1 extract 32 bits to int reg or memory destination |
| 3620 | multiclass SS41I_extract32<bits<8> opc, string OpcodeStr> { |
Evan Cheng | c2054be | 2008-03-26 08:11:49 +0000 | [diff] [blame] | 3621 | def rr : SS4AIi8<opc, MRMDestReg, (outs GR32:$dst), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3622 | (ins VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3623 | !strconcat(OpcodeStr, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3624 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
| 3625 | [(set GR32:$dst, |
| 3626 | (extractelt (v4i32 VR128:$src1), imm:$src2))]>, OpSize; |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3627 | def mr : SS4AIi8<opc, MRMDestMem, (outs), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3628 | (ins i32mem:$dst, VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3629 | !strconcat(OpcodeStr, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3630 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
| 3631 | [(store (extractelt (v4i32 VR128:$src1), imm:$src2), |
| 3632 | addr:$dst)]>, OpSize; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3633 | } |
| 3634 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3635 | defm PEXTRD : SS41I_extract32<0x16, "pextrd">; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3636 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3637 | |
Evan Cheng | 6c24933 | 2008-03-24 21:52:23 +0000 | [diff] [blame] | 3638 | /// SS41I_extractf32 - SSE 4.1 extract 32 bits fp value to int reg or memory |
| 3639 | /// destination |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3640 | multiclass SS41I_extractf32<bits<8> opc, string OpcodeStr> { |
Evan Cheng | c2054be | 2008-03-26 08:11:49 +0000 | [diff] [blame] | 3641 | def rr : SS4AIi8<opc, MRMDestReg, (outs GR32:$dst), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3642 | (ins VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3643 | !strconcat(OpcodeStr, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3644 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Dan Gohman | 788db59 | 2008-04-16 02:32:24 +0000 | [diff] [blame] | 3645 | [(set GR32:$dst, |
| 3646 | (extractelt (bc_v4i32 (v4f32 VR128:$src1)), imm:$src2))]>, |
Evan Cheng | 6c24933 | 2008-03-24 21:52:23 +0000 | [diff] [blame] | 3647 | OpSize; |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3648 | def mr : SS4AIi8<opc, MRMDestMem, (outs), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3649 | (ins f32mem:$dst, VR128:$src1, i32i8imm:$src2), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3650 | !strconcat(OpcodeStr, |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3651 | "\t{$src2, $src1, $dst|$dst, $src1, $src2}"), |
Evan Cheng | 6c24933 | 2008-03-24 21:52:23 +0000 | [diff] [blame] | 3652 | [(store (extractelt (bc_v4i32 (v4f32 VR128:$src1)), imm:$src2), |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3653 | addr:$dst)]>, OpSize; |
Nate Begeman | 5805796 | 2008-02-09 01:38:08 +0000 | [diff] [blame] | 3654 | } |
| 3655 | |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3656 | defm EXTRACTPS : SS41I_extractf32<0x17, "extractps">; |
Nate Begeman | 9a58b8a | 2008-02-09 23:46:37 +0000 | [diff] [blame] | 3657 | |
Dan Gohman | a41862a | 2008-08-08 18:30:21 +0000 | [diff] [blame] | 3658 | // Also match an EXTRACTPS store when the store is done as f32 instead of i32. |
| 3659 | def : Pat<(store (f32 (bitconvert (extractelt (bc_v4i32 (v4f32 VR128:$src1)), |
| 3660 | imm:$src2))), |
| 3661 | addr:$dst), |
| 3662 | (EXTRACTPSmr addr:$dst, VR128:$src1, imm:$src2)>, |
| 3663 | Requires<[HasSSE41]>; |
| 3664 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3665 | let Constraints = "$src1 = $dst" in { |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3666 | multiclass SS41I_insert8<bits<8> opc, string OpcodeStr> { |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3667 | def rr : SS4AIi8<opc, MRMSrcReg, (outs VR128:$dst), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3668 | (ins VR128:$src1, GR32:$src2, i32i8imm:$src3), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3669 | !strconcat(OpcodeStr, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3670 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3671 | [(set VR128:$dst, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3672 | (X86pinsrb VR128:$src1, GR32:$src2, imm:$src3))]>, OpSize; |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3673 | def rm : SS4AIi8<opc, MRMSrcMem, (outs VR128:$dst), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3674 | (ins VR128:$src1, i8mem:$src2, i32i8imm:$src3), |
| 3675 | !strconcat(OpcodeStr, |
| 3676 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3677 | [(set VR128:$dst, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3678 | (X86pinsrb VR128:$src1, (extloadi8 addr:$src2), |
| 3679 | imm:$src3))]>, OpSize; |
| 3680 | } |
| 3681 | } |
| 3682 | |
| 3683 | defm PINSRB : SS41I_insert8<0x20, "pinsrb">; |
| 3684 | |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3685 | let Constraints = "$src1 = $dst" in { |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3686 | multiclass SS41I_insert32<bits<8> opc, string OpcodeStr> { |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3687 | def rr : SS4AIi8<opc, MRMSrcReg, (outs VR128:$dst), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3688 | (ins VR128:$src1, GR32:$src2, i32i8imm:$src3), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3689 | !strconcat(OpcodeStr, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3690 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3691 | [(set VR128:$dst, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3692 | (v4i32 (insertelt VR128:$src1, GR32:$src2, imm:$src3)))]>, |
| 3693 | OpSize; |
Evan Cheng | 78d0061 | 2008-03-14 07:39:27 +0000 | [diff] [blame] | 3694 | def rm : SS4AIi8<opc, MRMSrcMem, (outs VR128:$dst), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3695 | (ins VR128:$src1, i32mem:$src2, i32i8imm:$src3), |
| 3696 | !strconcat(OpcodeStr, |
| 3697 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3698 | [(set VR128:$dst, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3699 | (v4i32 (insertelt VR128:$src1, (loadi32 addr:$src2), |
| 3700 | imm:$src3)))]>, OpSize; |
| 3701 | } |
| 3702 | } |
| 3703 | |
| 3704 | defm PINSRD : SS41I_insert32<0x22, "pinsrd">; |
| 3705 | |
Eric Christopher | a044360 | 2009-07-23 02:22:41 +0000 | [diff] [blame] | 3706 | // insertps has a few different modes, there's the first two here below which |
| 3707 | // are optimized inserts that won't zero arbitrary elements in the destination |
| 3708 | // vector. The next one matches the intrinsic and could zero arbitrary elements |
| 3709 | // in the target vector. |
Evan Cheng | 3ea4d67 | 2008-03-05 08:19:16 +0000 | [diff] [blame] | 3710 | let Constraints = "$src1 = $dst" in { |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3711 | multiclass SS41I_insertf32<bits<8> opc, string OpcodeStr> { |
Eric Christopher | efb657e | 2009-07-24 00:33:09 +0000 | [diff] [blame] | 3712 | def rr : SS4AIi8<opc, MRMSrcReg, (outs VR128:$dst), |
| 3713 | (ins VR128:$src1, VR128:$src2, i32i8imm:$src3), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3714 | !strconcat(OpcodeStr, |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3715 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3716 | [(set VR128:$dst, |
| 3717 | (X86insrtps VR128:$src1, VR128:$src2, imm:$src3))]>, |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3718 | OpSize; |
Eric Christopher | efb657e | 2009-07-24 00:33:09 +0000 | [diff] [blame] | 3719 | def rm : SS4AIi8<opc, MRMSrcMem, (outs VR128:$dst), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3720 | (ins VR128:$src1, f32mem:$src2, i32i8imm:$src3), |
| 3721 | !strconcat(OpcodeStr, |
| 3722 | "\t{$src3, $src2, $dst|$dst, $src2, $src3}"), |
Eric Christopher | 7f2d4f4 | 2009-07-31 20:07:27 +0000 | [diff] [blame] | 3723 | [(set VR128:$dst, |
Eric Christopher | efb657e | 2009-07-24 00:33:09 +0000 | [diff] [blame] | 3724 | (X86insrtps VR128:$src1, |
| 3725 | (v4f32 (scalar_to_vector (loadf32 addr:$src2))), |
Nate Begeman | d77e59e | 2008-02-11 04:19:36 +0000 | [diff] [blame] | 3726 | imm:$src3))]>, OpSize; |
| 3727 | } |
| 3728 | } |
| 3729 | |
Evan Cheng | c2054be | 2008-03-26 08:11:49 +0000 | [diff] [blame] | 3730 | defm INSERTPS : SS41I_insertf32<0x21, "insertps">; |
Nate Begeman | 0dd3cb5 | 2008-03-16 21:14:46 +0000 | [diff] [blame] | 3731 | |
Eric Christopher | efb657e | 2009-07-24 00:33:09 +0000 | [diff] [blame] | 3732 | def : Pat<(int_x86_sse41_insertps VR128:$src1, VR128:$src2, imm:$src3), |
| 3733 | (INSERTPSrr VR128:$src1, VR128:$src2, imm:$src3)>; |
| 3734 | |
Eric Christopher | 95d7926 | 2009-07-29 00:28:05 +0000 | [diff] [blame] | 3735 | // ptest instruction we'll lower to this in X86ISelLowering primarily from |
| 3736 | // the intel intrinsic that corresponds to this. |
Nate Begeman | 0dd3cb5 | 2008-03-16 21:14:46 +0000 | [diff] [blame] | 3737 | let Defs = [EFLAGS] in { |
| 3738 | def PTESTrr : SS48I<0x17, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), |
Eric Christopher | 95d7926 | 2009-07-29 00:28:05 +0000 | [diff] [blame] | 3739 | "ptest \t{$src2, $src1|$src1, $src2}", |
| 3740 | [(X86ptest VR128:$src1, VR128:$src2), |
| 3741 | (implicit EFLAGS)]>, OpSize; |
Nate Begeman | 0dd3cb5 | 2008-03-16 21:14:46 +0000 | [diff] [blame] | 3742 | def PTESTrm : SS48I<0x17, MRMSrcMem, (outs), (ins VR128:$src1, i128mem:$src2), |
Eric Christopher | 95d7926 | 2009-07-29 00:28:05 +0000 | [diff] [blame] | 3743 | "ptest \t{$src2, $src1|$src1, $src2}", |
| 3744 | [(X86ptest VR128:$src1, (load addr:$src2)), |
| 3745 | (implicit EFLAGS)]>, OpSize; |
Nate Begeman | 0dd3cb5 | 2008-03-16 21:14:46 +0000 | [diff] [blame] | 3746 | } |
| 3747 | |
| 3748 | def MOVNTDQArm : SS48I<0x2A, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), |
| 3749 | "movntdqa\t{$src, $dst|$dst, $src}", |
| 3750 | [(set VR128:$dst, (int_x86_sse41_movntdqa addr:$src))]>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 3751 | |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3752 | |
| 3753 | //===----------------------------------------------------------------------===// |
| 3754 | // SSE4.2 Instructions |
| 3755 | //===----------------------------------------------------------------------===// |
| 3756 | |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 3757 | /// SS42I_binop_rm_int - Simple SSE 4.2 binary operator |
| 3758 | let Constraints = "$src1 = $dst" in { |
| 3759 | multiclass SS42I_binop_rm_int<bits<8> opc, string OpcodeStr, |
| 3760 | Intrinsic IntId128, bit Commutable = 0> { |
| 3761 | def rr : SS428I<opc, MRMSrcReg, (outs VR128:$dst), |
| 3762 | (ins VR128:$src1, VR128:$src2), |
| 3763 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3764 | [(set VR128:$dst, (IntId128 VR128:$src1, VR128:$src2))]>, |
| 3765 | OpSize { |
| 3766 | let isCommutable = Commutable; |
| 3767 | } |
| 3768 | def rm : SS428I<opc, MRMSrcMem, (outs VR128:$dst), |
| 3769 | (ins VR128:$src1, i128mem:$src2), |
| 3770 | !strconcat(OpcodeStr, "\t{$src2, $dst|$dst, $src2}"), |
| 3771 | [(set VR128:$dst, |
| 3772 | (IntId128 VR128:$src1, |
| 3773 | (bitconvert (memopv16i8 addr:$src2))))]>, OpSize; |
| 3774 | } |
| 3775 | } |
| 3776 | |
Nate Begeman | 235666b | 2008-07-17 17:04:58 +0000 | [diff] [blame] | 3777 | defm PCMPGTQ : SS42I_binop_rm_int<0x37, "pcmpgtq", int_x86_sse42_pcmpgtq>; |
Nate Begeman | 03605a0 | 2008-07-17 16:51:19 +0000 | [diff] [blame] | 3778 | |
| 3779 | def : Pat<(v2i64 (X86pcmpgtq VR128:$src1, VR128:$src2)), |
| 3780 | (PCMPGTQrr VR128:$src1, VR128:$src2)>; |
| 3781 | def : Pat<(v2i64 (X86pcmpgtq VR128:$src1, (memop addr:$src2))), |
| 3782 | (PCMPGTQrm VR128:$src1, addr:$src2)>; |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3783 | |
| 3784 | // crc intrinsic instruction |
| 3785 | // This set of instructions are only rm, the only difference is the size |
| 3786 | // of r and m. |
| 3787 | let Constraints = "$src1 = $dst" in { |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3788 | def CRC32m8 : SS42FI<0xF0, MRMSrcMem, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3789 | (ins GR32:$src1, i8mem:$src2), |
| 3790 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3791 | [(set GR32:$dst, |
| 3792 | (int_x86_sse42_crc32_8 GR32:$src1, |
| 3793 | (load addr:$src2)))]>, OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3794 | def CRC32r8 : SS42FI<0xF0, MRMSrcReg, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3795 | (ins GR32:$src1, GR8:$src2), |
| 3796 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3797 | [(set GR32:$dst, |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3798 | (int_x86_sse42_crc32_8 GR32:$src1, GR8:$src2))]>, |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3799 | OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3800 | def CRC32m16 : SS42FI<0xF1, MRMSrcMem, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3801 | (ins GR32:$src1, i16mem:$src2), |
| 3802 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3803 | [(set GR32:$dst, |
| 3804 | (int_x86_sse42_crc32_16 GR32:$src1, |
| 3805 | (load addr:$src2)))]>, |
| 3806 | OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3807 | def CRC32r16 : SS42FI<0xF1, MRMSrcReg, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3808 | (ins GR32:$src1, GR16:$src2), |
| 3809 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3810 | [(set GR32:$dst, |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3811 | (int_x86_sse42_crc32_16 GR32:$src1, GR16:$src2))]>, |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3812 | OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3813 | def CRC32m32 : SS42FI<0xF1, MRMSrcMem, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3814 | (ins GR32:$src1, i32mem:$src2), |
| 3815 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3816 | [(set GR32:$dst, |
| 3817 | (int_x86_sse42_crc32_32 GR32:$src1, |
| 3818 | (load addr:$src2)))]>, OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3819 | def CRC32r32 : SS42FI<0xF1, MRMSrcReg, (outs GR32:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3820 | (ins GR32:$src1, GR32:$src2), |
| 3821 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3822 | [(set GR32:$dst, |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3823 | (int_x86_sse42_crc32_32 GR32:$src1, GR32:$src2))]>, |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3824 | OpSize; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3825 | def CRC64m64 : SS42FI<0xF0, MRMSrcMem, (outs GR64:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3826 | (ins GR64:$src1, i64mem:$src2), |
| 3827 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3828 | [(set GR64:$dst, |
| 3829 | (int_x86_sse42_crc32_64 GR64:$src1, |
| 3830 | (load addr:$src2)))]>, |
| 3831 | OpSize, REX_W; |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3832 | def CRC64r64 : SS42FI<0xF0, MRMSrcReg, (outs GR64:$dst), |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3833 | (ins GR64:$src1, GR64:$src2), |
| 3834 | "crc32 \t{$src2, $src1|$src1, $src2}", |
| 3835 | [(set GR64:$dst, |
Eric Christopher | 85f187b | 2009-08-10 21:48:58 +0000 | [diff] [blame] | 3836 | (int_x86_sse42_crc32_64 GR64:$src1, GR64:$src2))]>, |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3837 | OpSize, REX_W; |
Eric Christopher | b5f948c | 2009-08-08 21:55:08 +0000 | [diff] [blame] | 3838 | } |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3839 | |
| 3840 | // String/text processing instructions. |
Dan Gohman | 30afe01 | 2009-10-29 18:10:34 +0000 | [diff] [blame] | 3841 | let Defs = [EFLAGS], usesCustomInserter = 1 in { |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3842 | def PCMPISTRM128REG : SS42AI<0, Pseudo, (outs VR128:$dst), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3843 | (ins VR128:$src1, VR128:$src2, i8imm:$src3), |
| 3844 | "#PCMPISTRM128rr PSEUDO!", |
| 3845 | [(set VR128:$dst, (int_x86_sse42_pcmpistrm128 VR128:$src1, VR128:$src2, |
| 3846 | imm:$src3))]>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3847 | def PCMPISTRM128MEM : SS42AI<0, Pseudo, (outs VR128:$dst), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3848 | (ins VR128:$src1, i128mem:$src2, i8imm:$src3), |
| 3849 | "#PCMPISTRM128rm PSEUDO!", |
| 3850 | [(set VR128:$dst, (int_x86_sse42_pcmpistrm128 VR128:$src1, (load addr:$src2), |
| 3851 | imm:$src3))]>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3852 | } |
| 3853 | |
| 3854 | let Defs = [XMM0, EFLAGS] in { |
| 3855 | def PCMPISTRM128rr : SS42AI<0x62, MRMSrcReg, (outs), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3856 | (ins VR128:$src1, VR128:$src2, i8imm:$src3), |
| 3857 | "pcmpistrm\t{$src3, $src2, $src1|$src1, $src2, $src3}", []>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3858 | def PCMPISTRM128rm : SS42AI<0x62, MRMSrcMem, (outs), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3859 | (ins VR128:$src1, i128mem:$src2, i8imm:$src3), |
| 3860 | "pcmpistrm\t{$src3, $src2, $src1|$src1, $src2, $src3}", []>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3861 | } |
| 3862 | |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3863 | let Defs = [EFLAGS], Uses = [EAX, EDX], usesCustomInserter = 1 in { |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3864 | def PCMPESTRM128REG : SS42AI<0, Pseudo, (outs VR128:$dst), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3865 | (ins VR128:$src1, VR128:$src3, i8imm:$src5), |
| 3866 | "#PCMPESTRM128rr PSEUDO!", |
| 3867 | [(set VR128:$dst, |
| 3868 | (int_x86_sse42_pcmpestrm128 |
| 3869 | VR128:$src1, EAX, VR128:$src3, EDX, imm:$src5))]>, OpSize; |
| 3870 | |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3871 | def PCMPESTRM128MEM : SS42AI<0, Pseudo, (outs VR128:$dst), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3872 | (ins VR128:$src1, i128mem:$src3, i8imm:$src5), |
| 3873 | "#PCMPESTRM128rm PSEUDO!", |
| 3874 | [(set VR128:$dst, (int_x86_sse42_pcmpestrm128 |
| 3875 | VR128:$src1, EAX, (load addr:$src3), EDX, imm:$src5))]>, |
| 3876 | OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3877 | } |
| 3878 | |
| 3879 | let Defs = [XMM0, EFLAGS], Uses = [EAX, EDX] in { |
Sean Callanan | c5a05b7 | 2009-08-20 18:24:27 +0000 | [diff] [blame] | 3880 | def PCMPESTRM128rr : SS42AI<0x60, MRMSrcReg, (outs), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3881 | (ins VR128:$src1, VR128:$src3, i8imm:$src5), |
| 3882 | "pcmpestrm\t{$src5, $src3, $src1|$src1, $src3, $src5}", []>, OpSize; |
Sean Callanan | c5a05b7 | 2009-08-20 18:24:27 +0000 | [diff] [blame] | 3883 | def PCMPESTRM128rm : SS42AI<0x60, MRMSrcMem, (outs), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3884 | (ins VR128:$src1, i128mem:$src3, i8imm:$src5), |
| 3885 | "pcmpestrm\t{$src5, $src3, $src1|$src1, $src3, $src5}", []>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3886 | } |
| 3887 | |
| 3888 | let Defs = [ECX, EFLAGS] in { |
| 3889 | multiclass SS42AI_pcmpistri<Intrinsic IntId128> { |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3890 | def rr : SS42AI<0x63, MRMSrcReg, (outs), |
| 3891 | (ins VR128:$src1, VR128:$src2, i8imm:$src3), |
| 3892 | "pcmpistri\t{$src3, $src2, $src1|$src1, $src2, $src3}", |
| 3893 | [(set ECX, (IntId128 VR128:$src1, VR128:$src2, imm:$src3)), |
| 3894 | (implicit EFLAGS)]>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3895 | def rm : SS42AI<0x63, MRMSrcMem, (outs), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3896 | (ins VR128:$src1, i128mem:$src2, i8imm:$src3), |
| 3897 | "pcmpistri\t{$src3, $src2, $src1|$src1, $src2, $src3}", |
| 3898 | [(set ECX, (IntId128 VR128:$src1, (load addr:$src2), imm:$src3)), |
| 3899 | (implicit EFLAGS)]>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3900 | } |
| 3901 | } |
| 3902 | |
| 3903 | defm PCMPISTRI : SS42AI_pcmpistri<int_x86_sse42_pcmpistri128>; |
| 3904 | defm PCMPISTRIA : SS42AI_pcmpistri<int_x86_sse42_pcmpistria128>; |
| 3905 | defm PCMPISTRIC : SS42AI_pcmpistri<int_x86_sse42_pcmpistric128>; |
| 3906 | defm PCMPISTRIO : SS42AI_pcmpistri<int_x86_sse42_pcmpistrio128>; |
| 3907 | defm PCMPISTRIS : SS42AI_pcmpistri<int_x86_sse42_pcmpistris128>; |
| 3908 | defm PCMPISTRIZ : SS42AI_pcmpistri<int_x86_sse42_pcmpistriz128>; |
| 3909 | |
| 3910 | let Defs = [ECX, EFLAGS] in { |
| 3911 | let Uses = [EAX, EDX] in { |
| 3912 | multiclass SS42AI_pcmpestri<Intrinsic IntId128> { |
| 3913 | def rr : SS42AI<0x61, MRMSrcReg, (outs), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3914 | (ins VR128:$src1, VR128:$src3, i8imm:$src5), |
| 3915 | "pcmpestri\t{$src5, $src3, $src1|$src1, $src3, $src5}", |
| 3916 | [(set ECX, (IntId128 VR128:$src1, EAX, VR128:$src3, EDX, imm:$src5)), |
| 3917 | (implicit EFLAGS)]>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3918 | def rm : SS42AI<0x61, MRMSrcMem, (outs), |
Sean Callanan | 2c48df2 | 2009-12-18 00:01:26 +0000 | [diff] [blame] | 3919 | (ins VR128:$src1, i128mem:$src3, i8imm:$src5), |
| 3920 | "pcmpestri\t{$src5, $src3, $src1|$src1, $src3, $src5}", |
| 3921 | [(set ECX, |
| 3922 | (IntId128 VR128:$src1, EAX, (load addr:$src3), EDX, imm:$src5)), |
| 3923 | (implicit EFLAGS)]>, OpSize; |
Eric Christopher | 22a3940 | 2009-08-18 22:50:32 +0000 | [diff] [blame] | 3924 | } |
| 3925 | } |
| 3926 | } |
| 3927 | |
| 3928 | defm PCMPESTRI : SS42AI_pcmpestri<int_x86_sse42_pcmpestri128>; |
| 3929 | defm PCMPESTRIA : SS42AI_pcmpestri<int_x86_sse42_pcmpestria128>; |
| 3930 | defm PCMPESTRIC : SS42AI_pcmpestri<int_x86_sse42_pcmpestric128>; |
| 3931 | defm PCMPESTRIO : SS42AI_pcmpestri<int_x86_sse42_pcmpestrio128>; |
| 3932 | defm PCMPESTRIS : SS42AI_pcmpestri<int_x86_sse42_pcmpestris128>; |
| 3933 | defm PCMPESTRIZ : SS42AI_pcmpestri<int_x86_sse42_pcmpestriz128>; |