Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | //===- ARMInstrVFP.td - VFP support for ARM -------------------------------===// |
| 2 | // |
| 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. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Jim Grosbach | 31b3e68 | 2008-09-11 21:41:29 +0000 | [diff] [blame] | 10 | // This file describes the ARM VFP instruction set. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 14 | def SDT_FTOI : |
| 15 | SDTypeProfile<1, 1, [SDTCisVT<0, f32>, SDTCisFP<1>]>; |
| 16 | def SDT_ITOF : |
| 17 | SDTypeProfile<1, 1, [SDTCisFP<0>, SDTCisVT<1, f32>]>; |
| 18 | def SDT_CMPFP0 : |
| 19 | SDTypeProfile<0, 1, [SDTCisFP<0>]>; |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 20 | def SDT_VMOVDRR : |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 21 | SDTypeProfile<1, 2, [SDTCisVT<0, f64>, SDTCisVT<1, i32>, |
| 22 | SDTCisSameAs<1, 2>]>; |
| 23 | |
Chris Lattner | 3d25455 | 2008-01-15 22:02:54 +0000 | [diff] [blame] | 24 | def arm_fmstat : SDNode<"ARMISD::FMSTAT", SDTNone, [SDNPInFlag,SDNPOutFlag]>; |
Evan Cheng | c63e15e | 2008-11-11 02:11:05 +0000 | [diff] [blame] | 25 | def arm_cmpfp : SDNode<"ARMISD::CMPFP", SDT_ARMCmp, [SDNPOutFlag]>; |
| 26 | def arm_cmpfp0 : SDNode<"ARMISD::CMPFPw0",SDT_CMPFP0, [SDNPOutFlag]>; |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 27 | def arm_fmdrr : SDNode<"ARMISD::VMOVDRR", SDT_VMOVDRR>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 28 | |
| 29 | //===----------------------------------------------------------------------===// |
Evan Cheng | 7c7a3ff | 2009-10-28 01:44:26 +0000 | [diff] [blame] | 30 | // Operand Definitions. |
| 31 | // |
| 32 | |
| 33 | |
| 34 | def vfp_f32imm : Operand<f32>, |
| 35 | PatLeaf<(f32 fpimm), [{ |
| 36 | return ARM::getVFPf32Imm(N->getValueAPF()) != -1; |
| 37 | }]> { |
| 38 | let PrintMethod = "printVFPf32ImmOperand"; |
| 39 | } |
| 40 | |
| 41 | def vfp_f64imm : Operand<f64>, |
| 42 | PatLeaf<(f64 fpimm), [{ |
| 43 | return ARM::getVFPf64Imm(N->getValueAPF()) != -1; |
| 44 | }]> { |
| 45 | let PrintMethod = "printVFPf64ImmOperand"; |
| 46 | } |
| 47 | |
| 48 | |
| 49 | //===----------------------------------------------------------------------===// |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 50 | // Load / store Instructions. |
| 51 | // |
| 52 | |
Dan Gohman | 6debe02 | 2010-02-27 23:47:46 +0000 | [diff] [blame] | 53 | let canFoldAsLoad = 1, isReMaterializable = 1 in { |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 54 | def VLDRD : ADI5<0b1101, 0b01, (outs DPR:$dst), (ins addrmode5:$addr), |
| 55 | IIC_fpLoad64, "vldr", ".64\t$dst, $addr", |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 56 | [(set DPR:$dst, (f64 (load addrmode5:$addr)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 57 | |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 58 | def VLDRS : ASI5<0b1101, 0b01, (outs SPR:$dst), (ins addrmode5:$addr), |
| 59 | IIC_fpLoad32, "vldr", ".32\t$dst, $addr", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 60 | [(set SPR:$dst, (load addrmode5:$addr))]>; |
Dan Gohman | 5574cc7 | 2008-12-03 18:15:48 +0000 | [diff] [blame] | 61 | } // canFoldAsLoad |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 62 | |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 63 | def VSTRD : ADI5<0b1101, 0b00, (outs), (ins DPR:$src, addrmode5:$addr), |
| 64 | IIC_fpStore64, "vstr", ".64\t$src, $addr", |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 65 | [(store (f64 DPR:$src), addrmode5:$addr)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 66 | |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 67 | def VSTRS : ASI5<0b1101, 0b00, (outs), (ins SPR:$src, addrmode5:$addr), |
| 68 | IIC_fpStore32, "vstr", ".32\t$src, $addr", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 69 | [(store SPR:$src, addrmode5:$addr)]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 70 | |
| 71 | //===----------------------------------------------------------------------===// |
| 72 | // Load / store multiple Instructions. |
| 73 | // |
| 74 | |
Evan Cheng | 7c8d5ea | 2009-10-01 08:22:27 +0000 | [diff] [blame] | 75 | let mayLoad = 1, hasExtraDefRegAllocReq = 1 in { |
Bob Wilson | 5ef33c7 | 2010-03-13 01:08:20 +0000 | [diff] [blame] | 76 | def VLDMD : AXDI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$dsts, |
Bob Wilson | b9ee99d | 2010-03-13 07:34:35 +0000 | [diff] [blame] | 77 | variable_ops), IndexModeNone, IIC_fpLoadm, |
Bob Wilson | 5ef33c7 | 2010-03-13 01:08:20 +0000 | [diff] [blame] | 78 | "vldm${addr:submode}${p}\t${addr:base}, $dsts", "", []> { |
Evan Cheng | bb786b3 | 2008-11-11 21:48:44 +0000 | [diff] [blame] | 79 | let Inst{20} = 1; |
| 80 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 81 | |
Bob Wilson | 5ef33c7 | 2010-03-13 01:08:20 +0000 | [diff] [blame] | 82 | def VLDMS : AXSI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$dsts, |
Bob Wilson | b9ee99d | 2010-03-13 07:34:35 +0000 | [diff] [blame] | 83 | variable_ops), IndexModeNone, IIC_fpLoadm, |
Bob Wilson | 5ef33c7 | 2010-03-13 01:08:20 +0000 | [diff] [blame] | 84 | "vldm${addr:submode}${p}\t${addr:base}, $dsts", "", []> { |
| 85 | let Inst{20} = 1; |
| 86 | } |
| 87 | |
| 88 | def VLDMD_UPD : AXDI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p, |
| 89 | reglist:$dsts, variable_ops), |
Bob Wilson | b9ee99d | 2010-03-13 07:34:35 +0000 | [diff] [blame] | 90 | IndexModeUpd, IIC_fpLoadm, |
Bob Wilson | a256a75 | 2010-03-16 18:38:09 +0000 | [diff] [blame] | 91 | "vldm${addr:submode}${p}\t${addr:base}!, $dsts", |
Bob Wilson | 5ef33c7 | 2010-03-13 01:08:20 +0000 | [diff] [blame] | 92 | "$addr.base = $wb", []> { |
Johnny Chen | bc65432 | 2010-03-16 21:25:05 +0000 | [diff] [blame] | 93 | let Inst{21} = 1; // wback |
Bob Wilson | 5ef33c7 | 2010-03-13 01:08:20 +0000 | [diff] [blame] | 94 | let Inst{20} = 1; |
| 95 | } |
| 96 | |
| 97 | def VLDMS_UPD : AXSI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p, |
| 98 | reglist:$dsts, variable_ops), |
Bob Wilson | b9ee99d | 2010-03-13 07:34:35 +0000 | [diff] [blame] | 99 | IndexModeUpd, IIC_fpLoadm, |
Bob Wilson | a256a75 | 2010-03-16 18:38:09 +0000 | [diff] [blame] | 100 | "vldm${addr:submode}${p}\t${addr:base}!, $dsts", |
Bob Wilson | 5ef33c7 | 2010-03-13 01:08:20 +0000 | [diff] [blame] | 101 | "$addr.base = $wb", []> { |
Johnny Chen | bc65432 | 2010-03-16 21:25:05 +0000 | [diff] [blame] | 102 | let Inst{21} = 1; // wback |
Evan Cheng | bb786b3 | 2008-11-11 21:48:44 +0000 | [diff] [blame] | 103 | let Inst{20} = 1; |
| 104 | } |
Evan Cheng | 7c8d5ea | 2009-10-01 08:22:27 +0000 | [diff] [blame] | 105 | } // mayLoad, hasExtraDefRegAllocReq |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 106 | |
Evan Cheng | 7c8d5ea | 2009-10-01 08:22:27 +0000 | [diff] [blame] | 107 | let mayStore = 1, hasExtraSrcRegAllocReq = 1 in { |
Bob Wilson | 5ef33c7 | 2010-03-13 01:08:20 +0000 | [diff] [blame] | 108 | def VSTMD : AXDI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$srcs, |
Bob Wilson | b9ee99d | 2010-03-13 07:34:35 +0000 | [diff] [blame] | 109 | variable_ops), IndexModeNone, IIC_fpStorem, |
Bob Wilson | 5ef33c7 | 2010-03-13 01:08:20 +0000 | [diff] [blame] | 110 | "vstm${addr:submode}${p}\t${addr:base}, $srcs", "", []> { |
Evan Cheng | bb786b3 | 2008-11-11 21:48:44 +0000 | [diff] [blame] | 111 | let Inst{20} = 0; |
| 112 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 113 | |
Bob Wilson | 5ef33c7 | 2010-03-13 01:08:20 +0000 | [diff] [blame] | 114 | def VSTMS : AXSI5<(outs), (ins addrmode5:$addr, pred:$p, reglist:$srcs, |
Bob Wilson | b9ee99d | 2010-03-13 07:34:35 +0000 | [diff] [blame] | 115 | variable_ops), IndexModeNone, IIC_fpStorem, |
Bob Wilson | 5ef33c7 | 2010-03-13 01:08:20 +0000 | [diff] [blame] | 116 | "vstm${addr:submode}${p}\t${addr:base}, $srcs", "", []> { |
| 117 | let Inst{20} = 0; |
| 118 | } |
| 119 | |
| 120 | def VSTMD_UPD : AXDI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p, |
| 121 | reglist:$srcs, variable_ops), |
Bob Wilson | b9ee99d | 2010-03-13 07:34:35 +0000 | [diff] [blame] | 122 | IndexModeUpd, IIC_fpStorem, |
Bob Wilson | a256a75 | 2010-03-16 18:38:09 +0000 | [diff] [blame] | 123 | "vstm${addr:submode}${p}\t${addr:base}!, $srcs", |
Bob Wilson | 5ef33c7 | 2010-03-13 01:08:20 +0000 | [diff] [blame] | 124 | "$addr.base = $wb", []> { |
Johnny Chen | bc65432 | 2010-03-16 21:25:05 +0000 | [diff] [blame] | 125 | let Inst{21} = 1; // wback |
Bob Wilson | 5ef33c7 | 2010-03-13 01:08:20 +0000 | [diff] [blame] | 126 | let Inst{20} = 0; |
| 127 | } |
| 128 | |
| 129 | def VSTMS_UPD : AXSI5<(outs GPR:$wb), (ins addrmode5:$addr, pred:$p, |
| 130 | reglist:$srcs, variable_ops), |
Bob Wilson | b9ee99d | 2010-03-13 07:34:35 +0000 | [diff] [blame] | 131 | IndexModeUpd, IIC_fpStorem, |
Bob Wilson | a256a75 | 2010-03-16 18:38:09 +0000 | [diff] [blame] | 132 | "vstm${addr:submode}${p}\t${addr:base}!, $srcs", |
Bob Wilson | 5ef33c7 | 2010-03-13 01:08:20 +0000 | [diff] [blame] | 133 | "$addr.base = $wb", []> { |
Johnny Chen | bc65432 | 2010-03-16 21:25:05 +0000 | [diff] [blame] | 134 | let Inst{21} = 1; // wback |
Evan Cheng | bb786b3 | 2008-11-11 21:48:44 +0000 | [diff] [blame] | 135 | let Inst{20} = 0; |
| 136 | } |
Evan Cheng | 7c8d5ea | 2009-10-01 08:22:27 +0000 | [diff] [blame] | 137 | } // mayStore, hasExtraSrcRegAllocReq |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 138 | |
| 139 | // FLDMX, FSTMX - mixing S/D registers for pre-armv6 cores |
| 140 | |
| 141 | //===----------------------------------------------------------------------===// |
| 142 | // FP Binary Operations. |
| 143 | // |
| 144 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 145 | def VADDD : ADbI<0b11100, 0b11, 0, 0, (outs DPR:$dst), (ins DPR:$a, DPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 146 | IIC_fpALU64, "vadd", ".f64\t$dst, $a, $b", |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 147 | [(set DPR:$dst, (fadd DPR:$a, (f64 DPR:$b)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 148 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 149 | def VADDS : ASbIn<0b11100, 0b11, 0, 0, (outs SPR:$dst), (ins SPR:$a, SPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 150 | IIC_fpALU32, "vadd", ".f32\t$dst, $a, $b", |
David Goodwin | dd19ce4 | 2009-08-04 17:53:06 +0000 | [diff] [blame] | 151 | [(set SPR:$dst, (fadd SPR:$a, SPR:$b))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 152 | |
Evan Cheng | 11838a8 | 2008-11-12 07:18:38 +0000 | [diff] [blame] | 153 | // These are encoded as unary instructions. |
Evan Cheng | df6703e | 2009-07-20 02:12:31 +0000 | [diff] [blame] | 154 | let Defs = [FPSCR] in { |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 155 | def VCMPED : ADuI<0b11101, 0b11, 0b0100, 0b11, 0, (outs), (ins DPR:$a, DPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 156 | IIC_fpCMP64, "vcmpe", ".f64\t$a, $b", |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 157 | [(arm_cmpfp DPR:$a, (f64 DPR:$b))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 158 | |
Johnny Chen | 714b9c7 | 2010-02-08 19:41:48 +0000 | [diff] [blame] | 159 | def VCMPD : ADuI<0b11101, 0b11, 0b0100, 0b01, 0, (outs), (ins DPR:$a, DPR:$b), |
| 160 | IIC_fpCMP64, "vcmp", ".f64\t$a, $b", |
| 161 | [/* For disassembly only; pattern left blank */]>; |
| 162 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 163 | def VCMPES : ASuI<0b11101, 0b11, 0b0100, 0b11, 0, (outs), (ins SPR:$a, SPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 164 | IIC_fpCMP32, "vcmpe", ".f32\t$a, $b", |
Evan Cheng | 11838a8 | 2008-11-12 07:18:38 +0000 | [diff] [blame] | 165 | [(arm_cmpfp SPR:$a, SPR:$b)]>; |
Johnny Chen | 714b9c7 | 2010-02-08 19:41:48 +0000 | [diff] [blame] | 166 | |
| 167 | def VCMPS : ASuI<0b11101, 0b11, 0b0100, 0b01, 0, (outs), (ins SPR:$a, SPR:$b), |
| 168 | IIC_fpCMP32, "vcmp", ".f32\t$a, $b", |
| 169 | [/* For disassembly only; pattern left blank */]>; |
Evan Cheng | df6703e | 2009-07-20 02:12:31 +0000 | [diff] [blame] | 170 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 171 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 172 | def VDIVD : ADbI<0b11101, 0b00, 0, 0, (outs DPR:$dst), (ins DPR:$a, DPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 173 | IIC_fpDIV64, "vdiv", ".f64\t$dst, $a, $b", |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 174 | [(set DPR:$dst, (fdiv DPR:$a, (f64 DPR:$b)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 175 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 176 | def VDIVS : ASbI<0b11101, 0b00, 0, 0, (outs SPR:$dst), (ins SPR:$a, SPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 177 | IIC_fpDIV32, "vdiv", ".f32\t$dst, $a, $b", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 178 | [(set SPR:$dst, (fdiv SPR:$a, SPR:$b))]>; |
| 179 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 180 | def VMULD : ADbI<0b11100, 0b10, 0, 0, (outs DPR:$dst), (ins DPR:$a, DPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 181 | IIC_fpMUL64, "vmul", ".f64\t$dst, $a, $b", |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 182 | [(set DPR:$dst, (fmul DPR:$a, (f64 DPR:$b)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 183 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 184 | def VMULS : ASbIn<0b11100, 0b10, 0, 0, (outs SPR:$dst), (ins SPR:$a, SPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 185 | IIC_fpMUL32, "vmul", ".f32\t$dst, $a, $b", |
David Goodwin | dd19ce4 | 2009-08-04 17:53:06 +0000 | [diff] [blame] | 186 | [(set SPR:$dst, (fmul SPR:$a, SPR:$b))]>; |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 187 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 188 | def VNMULD : ADbI<0b11100, 0b10, 1, 0, (outs DPR:$dst), (ins DPR:$a, DPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 189 | IIC_fpMUL64, "vnmul", ".f64\t$dst, $a, $b", |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 190 | [(set DPR:$dst, (fneg (fmul DPR:$a, (f64 DPR:$b))))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 191 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 192 | def VNMULS : ASbI<0b11100, 0b10, 1, 0, (outs SPR:$dst), (ins SPR:$a, SPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 193 | IIC_fpMUL32, "vnmul", ".f32\t$dst, $a, $b", |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 194 | [(set SPR:$dst, (fneg (fmul SPR:$a, SPR:$b)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 195 | |
| 196 | // Match reassociated forms only if not sign dependent rounding. |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 197 | def : Pat<(fmul (fneg DPR:$a), (f64 DPR:$b)), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 198 | (VNMULD DPR:$a, DPR:$b)>, Requires<[NoHonorSignDependentRounding]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 199 | def : Pat<(fmul (fneg SPR:$a), SPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 200 | (VNMULS SPR:$a, SPR:$b)>, Requires<[NoHonorSignDependentRounding]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 201 | |
| 202 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 203 | def VSUBD : ADbI<0b11100, 0b11, 1, 0, (outs DPR:$dst), (ins DPR:$a, DPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 204 | IIC_fpALU64, "vsub", ".f64\t$dst, $a, $b", |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 205 | [(set DPR:$dst, (fsub DPR:$a, (f64 DPR:$b)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 206 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 207 | def VSUBS : ASbIn<0b11100, 0b11, 1, 0, (outs SPR:$dst), (ins SPR:$a, SPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 208 | IIC_fpALU32, "vsub", ".f32\t$dst, $a, $b", |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 209 | [(set SPR:$dst, (fsub SPR:$a, SPR:$b))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 210 | |
| 211 | //===----------------------------------------------------------------------===// |
| 212 | // FP Unary Operations. |
| 213 | // |
| 214 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 215 | def VABSD : ADuI<0b11101, 0b11, 0b0000, 0b11, 0, (outs DPR:$dst), (ins DPR:$a), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 216 | IIC_fpUNA64, "vabs", ".f64\t$dst, $a", |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 217 | [(set DPR:$dst, (fabs (f64 DPR:$a)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 218 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 219 | def VABSS : ASuIn<0b11101, 0b11, 0b0000, 0b11, 0,(outs SPR:$dst), (ins SPR:$a), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 220 | IIC_fpUNA32, "vabs", ".f32\t$dst, $a", |
David Goodwin | bc7c05e | 2009-08-04 20:39:05 +0000 | [diff] [blame] | 221 | [(set SPR:$dst, (fabs SPR:$a))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 222 | |
Evan Cheng | df6703e | 2009-07-20 02:12:31 +0000 | [diff] [blame] | 223 | let Defs = [FPSCR] in { |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 224 | def VCMPEZD : ADuI<0b11101, 0b11, 0b0101, 0b11, 0, (outs), (ins DPR:$a), |
Jim Grosbach | cdc4980 | 2009-11-09 15:27:51 +0000 | [diff] [blame] | 225 | IIC_fpCMP64, "vcmpe", ".f64\t$a, #0", |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 226 | [(arm_cmpfp0 (f64 DPR:$a))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 227 | |
Johnny Chen | 714b9c7 | 2010-02-08 19:41:48 +0000 | [diff] [blame] | 228 | def VCMPZD : ADuI<0b11101, 0b11, 0b0101, 0b01, 0, (outs), (ins DPR:$a), |
| 229 | IIC_fpCMP64, "vcmp", ".f64\t$a, #0", |
| 230 | [/* For disassembly only; pattern left blank */]>; |
| 231 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 232 | def VCMPEZS : ASuI<0b11101, 0b11, 0b0101, 0b11, 0, (outs), (ins SPR:$a), |
Jim Grosbach | cdc4980 | 2009-11-09 15:27:51 +0000 | [diff] [blame] | 233 | IIC_fpCMP32, "vcmpe", ".f32\t$a, #0", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 234 | [(arm_cmpfp0 SPR:$a)]>; |
Johnny Chen | 714b9c7 | 2010-02-08 19:41:48 +0000 | [diff] [blame] | 235 | |
| 236 | def VCMPZS : ASuI<0b11101, 0b11, 0b0101, 0b01, 0, (outs), (ins SPR:$a), |
| 237 | IIC_fpCMP32, "vcmp", ".f32\t$a, #0", |
| 238 | [/* For disassembly only; pattern left blank */]>; |
Evan Cheng | df6703e | 2009-07-20 02:12:31 +0000 | [diff] [blame] | 239 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 240 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 241 | def VCVTDS : ASuI<0b11101, 0b11, 0b0111, 0b11, 0, (outs DPR:$dst), (ins SPR:$a), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 242 | IIC_fpCVTDS, "vcvt", ".f64.f32\t$dst, $a", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 243 | [(set DPR:$dst, (fextend SPR:$a))]>; |
| 244 | |
Evan Cheng | c63e15e | 2008-11-11 02:11:05 +0000 | [diff] [blame] | 245 | // Special case encoding: bits 11-8 is 0b1011. |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 246 | def VCVTSD : VFPAI<(outs SPR:$dst), (ins DPR:$a), VFPUnaryFrm, |
| 247 | IIC_fpCVTSD, "vcvt", ".f32.f64\t$dst, $a", |
David Goodwin | ce9fbbe | 2009-07-10 17:03:29 +0000 | [diff] [blame] | 248 | [(set SPR:$dst, (fround DPR:$a))]> { |
Evan Cheng | c63e15e | 2008-11-11 02:11:05 +0000 | [diff] [blame] | 249 | let Inst{27-23} = 0b11101; |
| 250 | let Inst{21-16} = 0b110111; |
| 251 | let Inst{11-8} = 0b1011; |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 252 | let Inst{7-6} = 0b11; |
| 253 | let Inst{4} = 0; |
Evan Cheng | c63e15e | 2008-11-11 02:11:05 +0000 | [diff] [blame] | 254 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 255 | |
Johnny Chen | 2e1f009 | 2010-02-09 17:21:56 +0000 | [diff] [blame] | 256 | // Between half-precision and single-precision. For disassembly only. |
| 257 | |
| 258 | def VCVTBSH : ASuI<0b11101, 0b11, 0b0010, 0b01, 0, (outs SPR:$dst), (ins SPR:$a), |
| 259 | /* FIXME */ IIC_fpCVTDS, "vcvtb", ".f32.f16\t$dst, $a", |
Anton Korobeynikov | c761f63 | 2010-03-18 22:35:37 +0000 | [diff] [blame] | 260 | [/* For disassembly only; pattern left blank */]>; |
| 261 | |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 262 | def : VFPPat<(f32_to_f16 SPR:$a), |
| 263 | (i32 (COPY_TO_REGCLASS (VCVTBSH SPR:$a), GPR))>, |
| 264 | Requires<[HasVFP3, HasFP16]>; |
Johnny Chen | 2e1f009 | 2010-02-09 17:21:56 +0000 | [diff] [blame] | 265 | |
| 266 | def VCVTBHS : ASuI<0b11101, 0b11, 0b0011, 0b01, 0, (outs SPR:$dst), (ins SPR:$a), |
| 267 | /* FIXME */ IIC_fpCVTDS, "vcvtb", ".f16.f32\t$dst, $a", |
Anton Korobeynikov | c761f63 | 2010-03-18 22:35:37 +0000 | [diff] [blame] | 268 | [/* For disassembly only; pattern left blank */]>; |
| 269 | |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 270 | def : VFPPat<(f16_to_f32 GPR:$a), |
| 271 | (VCVTBHS (COPY_TO_REGCLASS GPR:$a, SPR))>, |
| 272 | Requires<[HasVFP3, HasFP16]>; |
Johnny Chen | 2e1f009 | 2010-02-09 17:21:56 +0000 | [diff] [blame] | 273 | |
| 274 | def VCVTTSH : ASuI<0b11101, 0b11, 0b0010, 0b11, 0, (outs SPR:$dst), (ins SPR:$a), |
| 275 | /* FIXME */ IIC_fpCVTDS, "vcvtt", ".f32.f16\t$dst, $a", |
| 276 | [/* For disassembly only; pattern left blank */]>; |
| 277 | |
| 278 | def VCVTTHS : ASuI<0b11101, 0b11, 0b0011, 0b11, 0, (outs SPR:$dst), (ins SPR:$a), |
| 279 | /* FIXME */ IIC_fpCVTDS, "vcvtt", ".f16.f32\t$dst, $a", |
| 280 | [/* For disassembly only; pattern left blank */]>; |
| 281 | |
Evan Cheng | d97d714 | 2009-06-12 20:46:18 +0000 | [diff] [blame] | 282 | let neverHasSideEffects = 1 in { |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 283 | def VMOVD: ADuI<0b11101, 0b11, 0b0000, 0b01, 0, (outs DPR:$dst), (ins DPR:$a), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 284 | IIC_fpUNA64, "vmov", ".f64\t$dst, $a", []>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 285 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 286 | def VMOVS: ASuI<0b11101, 0b11, 0b0000, 0b01, 0, (outs SPR:$dst), (ins SPR:$a), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 287 | IIC_fpUNA32, "vmov", ".f32\t$dst, $a", []>; |
Evan Cheng | d97d714 | 2009-06-12 20:46:18 +0000 | [diff] [blame] | 288 | } // neverHasSideEffects |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 289 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 290 | def VNEGD : ADuI<0b11101, 0b11, 0b0001, 0b01, 0, (outs DPR:$dst), (ins DPR:$a), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 291 | IIC_fpUNA64, "vneg", ".f64\t$dst, $a", |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 292 | [(set DPR:$dst, (fneg (f64 DPR:$a)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 293 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 294 | def VNEGS : ASuIn<0b11101, 0b11, 0b0001, 0b01, 0,(outs SPR:$dst), (ins SPR:$a), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 295 | IIC_fpUNA32, "vneg", ".f32\t$dst, $a", |
David Goodwin | bc7c05e | 2009-08-04 20:39:05 +0000 | [diff] [blame] | 296 | [(set SPR:$dst, (fneg SPR:$a))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 297 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 298 | def VSQRTD : ADuI<0b11101, 0b11, 0b0001, 0b11, 0, (outs DPR:$dst), (ins DPR:$a), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 299 | IIC_fpSQRT64, "vsqrt", ".f64\t$dst, $a", |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 300 | [(set DPR:$dst, (fsqrt (f64 DPR:$a)))]>; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 301 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 302 | def VSQRTS : ASuI<0b11101, 0b11, 0b0001, 0b11, 0, (outs SPR:$dst), (ins SPR:$a), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 303 | IIC_fpSQRT32, "vsqrt", ".f32\t$dst, $a", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 304 | [(set SPR:$dst, (fsqrt SPR:$a))]>; |
| 305 | |
| 306 | //===----------------------------------------------------------------------===// |
| 307 | // FP <-> GPR Copies. Int <-> FP Conversions. |
| 308 | // |
| 309 | |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 310 | def VMOVRS : AVConv2I<0b11100001, 0b1010, (outs GPR:$dst), (ins SPR:$src), |
| 311 | IIC_VMOVSI, "vmov", "\t$dst, $src", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 312 | [(set GPR:$dst, (bitconvert SPR:$src))]>; |
| 313 | |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 314 | def VMOVSR : AVConv4I<0b11100000, 0b1010, (outs SPR:$dst), (ins GPR:$src), |
| 315 | IIC_VMOVIS, "vmov", "\t$dst, $src", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 316 | [(set SPR:$dst, (bitconvert GPR:$src))]>; |
| 317 | |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 318 | def VMOVRRD : AVConv3I<0b11000101, 0b1011, |
Evan Cheng | b43a20e | 2009-10-01 01:33:39 +0000 | [diff] [blame] | 319 | (outs GPR:$wb, GPR:$dst2), (ins DPR:$src), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 320 | IIC_VMOVDI, "vmov", "\t$wb, $dst2, $src", |
Johnny Chen | 92a90ab | 2010-02-05 18:04:58 +0000 | [diff] [blame] | 321 | [/* FIXME: Can't write pattern for multiple result instr*/]> { |
| 322 | let Inst{7-6} = 0b00; |
| 323 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 324 | |
Johnny Chen | bbe7726 | 2010-02-08 17:26:09 +0000 | [diff] [blame] | 325 | def VMOVRRS : AVConv3I<0b11000101, 0b1010, |
| 326 | (outs GPR:$wb, GPR:$dst2), (ins SPR:$src1, SPR:$src2), |
| 327 | IIC_VMOVDI, "vmov", "\t$wb, $dst2, $src1, $src2", |
| 328 | [/* For disassembly only; pattern left blank */]> { |
| 329 | let Inst{7-6} = 0b00; |
| 330 | } |
| 331 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 332 | // FMDHR: GPR -> SPR |
| 333 | // FMDLR: GPR -> SPR |
| 334 | |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 335 | def VMOVDRR : AVConv5I<0b11000100, 0b1011, |
Evan Cheng | 7416593 | 2008-12-11 22:02:02 +0000 | [diff] [blame] | 336 | (outs DPR:$dst), (ins GPR:$src1, GPR:$src2), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 337 | IIC_VMOVID, "vmov", "\t$dst, $src1, $src2", |
Johnny Chen | 92a90ab | 2010-02-05 18:04:58 +0000 | [diff] [blame] | 338 | [(set DPR:$dst, (arm_fmdrr GPR:$src1, GPR:$src2))]> { |
| 339 | let Inst{7-6} = 0b00; |
| 340 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 341 | |
Johnny Chen | bbe7726 | 2010-02-08 17:26:09 +0000 | [diff] [blame] | 342 | def VMOVSRR : AVConv5I<0b11000100, 0b1010, |
| 343 | (outs SPR:$dst1, SPR:$dst2), (ins GPR:$src1, GPR:$src2), |
| 344 | IIC_VMOVID, "vmov", "\t$dst1, $dst2, $src1, $src2", |
| 345 | [/* For disassembly only; pattern left blank */]> { |
| 346 | let Inst{7-6} = 0b00; |
| 347 | } |
| 348 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 349 | // FMRDH: SPR -> GPR |
| 350 | // FMRDL: SPR -> GPR |
| 351 | // FMRRS: SPR -> GPR |
| 352 | // FMRX : SPR system reg -> GPR |
| 353 | |
| 354 | // FMSRR: GPR -> SPR |
| 355 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 356 | // FMXR: GPR -> VFP Sstem reg |
| 357 | |
| 358 | |
| 359 | // Int to FP: |
| 360 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 361 | def VSITOD : AVConv1I<0b11101, 0b11, 0b1000, 0b1011, |
| 362 | (outs DPR:$dst), (ins SPR:$a), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 363 | IIC_fpCVTID, "vcvt", ".f64.s32\t$dst, $a", |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 364 | [/* For disassembly only; pattern left blank */]> { |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 365 | let Inst{7} = 1; // s32 |
Evan Cheng | 9d3cc18 | 2008-11-11 19:40:26 +0000 | [diff] [blame] | 366 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 367 | |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 368 | def : VFPPat<(f64 (sint_to_fp GPR:$a)), |
| 369 | (VSITOD (COPY_TO_REGCLASS GPR:$a, SPR))>; |
| 370 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 371 | def VSITOS : AVConv1In<0b11101, 0b11, 0b1000, 0b1010, |
| 372 | (outs SPR:$dst),(ins SPR:$a), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 373 | IIC_fpCVTIS, "vcvt", ".f32.s32\t$dst, $a", |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 374 | [/* For disassembly only; pattern left blank */]> { |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 375 | let Inst{7} = 1; // s32 |
Evan Cheng | 9d3cc18 | 2008-11-11 19:40:26 +0000 | [diff] [blame] | 376 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 377 | |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 378 | def : VFPPat<(f32 (sint_to_fp GPR:$a)), |
| 379 | (VSITOS (COPY_TO_REGCLASS GPR:$a, SPR))>, |
| 380 | Requires<[DontUseNEONForFP, HasVFP2]>; |
| 381 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 382 | def VUITOD : AVConv1I<0b11101, 0b11, 0b1000, 0b1011, |
| 383 | (outs DPR:$dst), (ins SPR:$a), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 384 | IIC_fpCVTID, "vcvt", ".f64.u32\t$dst, $a", |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 385 | [/* For disassembly only; pattern left blank */]> { |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 386 | let Inst{7} = 0; // u32 |
| 387 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 388 | |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 389 | def : VFPPat<(f64 (uint_to_fp GPR:$a)), |
| 390 | (VUITOD (COPY_TO_REGCLASS GPR:$a, SPR))>; |
| 391 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 392 | def VUITOS : AVConv1In<0b11101, 0b11, 0b1000, 0b1010, |
| 393 | (outs SPR:$dst), (ins SPR:$a), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 394 | IIC_fpCVTIS, "vcvt", ".f32.u32\t$dst, $a", |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 395 | [/* For disassembly only; pattern left blank */]> { |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 396 | let Inst{7} = 0; // u32 |
| 397 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 398 | |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 399 | def : VFPPat<(f32 (uint_to_fp GPR:$a)), |
| 400 | (VUITOS (COPY_TO_REGCLASS GPR:$a, SPR))>, |
| 401 | Requires<[DontUseNEONForFP, HasVFP2]>; |
| 402 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 403 | // FP to Int: |
| 404 | // Always set Z bit in the instruction, i.e. "round towards zero" variants. |
| 405 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 406 | def VTOSIZD : AVConv1I<0b11101, 0b11, 0b1101, 0b1011, |
Evan Cheng | 9d3cc18 | 2008-11-11 19:40:26 +0000 | [diff] [blame] | 407 | (outs SPR:$dst), (ins DPR:$a), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 408 | IIC_fpCVTDI, "vcvt", ".s32.f64\t$dst, $a", |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 409 | [/* For disassembly only; pattern left blank */]> { |
Evan Cheng | 9d3cc18 | 2008-11-11 19:40:26 +0000 | [diff] [blame] | 410 | let Inst{7} = 1; // Z bit |
| 411 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 412 | |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 413 | def : VFPPat<(i32 (fp_to_sint (f64 DPR:$a))), |
| 414 | (COPY_TO_REGCLASS (VTOSIZD DPR:$a), GPR)>; |
| 415 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 416 | def VTOSIZS : AVConv1In<0b11101, 0b11, 0b1101, 0b1010, |
David Goodwin | 4b358db | 2009-08-10 22:17:39 +0000 | [diff] [blame] | 417 | (outs SPR:$dst), (ins SPR:$a), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 418 | IIC_fpCVTSI, "vcvt", ".s32.f32\t$dst, $a", |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 419 | [/* For disassembly only; pattern left blank */]> { |
Evan Cheng | 9d3cc18 | 2008-11-11 19:40:26 +0000 | [diff] [blame] | 420 | let Inst{7} = 1; // Z bit |
| 421 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 422 | |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 423 | def : VFPPat<(i32 (fp_to_sint SPR:$a)), |
| 424 | (COPY_TO_REGCLASS (VTOSIZS SPR:$a), GPR)>, |
| 425 | Requires<[DontUseNEONForFP, HasVFP2]>; |
| 426 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 427 | def VTOUIZD : AVConv1I<0b11101, 0b11, 0b1100, 0b1011, |
Evan Cheng | 9d3cc18 | 2008-11-11 19:40:26 +0000 | [diff] [blame] | 428 | (outs SPR:$dst), (ins DPR:$a), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 429 | IIC_fpCVTDI, "vcvt", ".u32.f64\t$dst, $a", |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 430 | [/* For disassembly only; pattern left blank */]> { |
Evan Cheng | 9d3cc18 | 2008-11-11 19:40:26 +0000 | [diff] [blame] | 431 | let Inst{7} = 1; // Z bit |
| 432 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 433 | |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 434 | def : VFPPat<(i32 (fp_to_uint (f64 DPR:$a))), |
| 435 | (COPY_TO_REGCLASS (VTOUIZD DPR:$a), GPR)>; |
| 436 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 437 | def VTOUIZS : AVConv1In<0b11101, 0b11, 0b1100, 0b1010, |
David Goodwin | 4b358db | 2009-08-10 22:17:39 +0000 | [diff] [blame] | 438 | (outs SPR:$dst), (ins SPR:$a), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 439 | IIC_fpCVTSI, "vcvt", ".u32.f32\t$dst, $a", |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 440 | [/* For disassembly only; pattern left blank */]> { |
Evan Cheng | 9d3cc18 | 2008-11-11 19:40:26 +0000 | [diff] [blame] | 441 | let Inst{7} = 1; // Z bit |
| 442 | } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 443 | |
Anton Korobeynikov | 2d58809 | 2010-03-18 22:35:45 +0000 | [diff] [blame] | 444 | def : VFPPat<(i32 (fp_to_uint SPR:$a)), |
| 445 | (COPY_TO_REGCLASS (VTOUIZS SPR:$a), GPR)>, |
| 446 | Requires<[DontUseNEONForFP, HasVFP2]>; |
| 447 | |
Johnny Chen | 00b26de | 2010-02-08 22:02:41 +0000 | [diff] [blame] | 448 | // And the Z bit '0' variants, i.e. use the rounding mode specified by FPSCR. |
| 449 | // For disassembly only. |
| 450 | |
| 451 | def VTOSIRD : AVConv1I<0b11101, 0b11, 0b1101, 0b1011, |
| 452 | (outs SPR:$dst), (ins DPR:$a), |
| 453 | IIC_fpCVTDI, "vcvtr", ".s32.f64\t$dst, $a", |
| 454 | [/* For disassembly only; pattern left blank */]> { |
| 455 | let Inst{7} = 0; // Z bit |
| 456 | } |
| 457 | |
| 458 | def VTOSIRS : AVConv1In<0b11101, 0b11, 0b1101, 0b1010, |
| 459 | (outs SPR:$dst), (ins SPR:$a), |
| 460 | IIC_fpCVTSI, "vcvtr", ".s32.f32\t$dst, $a", |
| 461 | [/* For disassembly only; pattern left blank */]> { |
| 462 | let Inst{7} = 0; // Z bit |
| 463 | } |
| 464 | |
| 465 | def VTOUIRD : AVConv1I<0b11101, 0b11, 0b1100, 0b1011, |
| 466 | (outs SPR:$dst), (ins DPR:$a), |
| 467 | IIC_fpCVTDI, "vcvtr", ".u32.f64\t$dst, $a", |
| 468 | [/* For disassembly only; pattern left blank */]> { |
| 469 | let Inst{7} = 0; // Z bit |
| 470 | } |
| 471 | |
| 472 | def VTOUIRS : AVConv1In<0b11101, 0b11, 0b1100, 0b1010, |
| 473 | (outs SPR:$dst), (ins SPR:$a), |
| 474 | IIC_fpCVTSI, "vcvtr", ".u32.f32\t$dst, $a", |
| 475 | [/* For disassembly only; pattern left blank */]> { |
| 476 | let Inst{7} = 0; // Z bit |
| 477 | } |
| 478 | |
Johnny Chen | 3dd3f80 | 2010-02-11 18:17:16 +0000 | [diff] [blame] | 479 | // Convert between floating-point and fixed-point |
| 480 | // Data type for fixed-point naming convention: |
| 481 | // S16 (U=0, sx=0) -> SH |
| 482 | // U16 (U=1, sx=0) -> UH |
| 483 | // S32 (U=0, sx=1) -> SL |
| 484 | // U32 (U=1, sx=1) -> UL |
| 485 | |
| 486 | let Constraints = "$a = $dst" in { |
| 487 | |
| 488 | // FP to Fixed-Point: |
| 489 | |
| 490 | def VTOSHS : AVConv1XI<0b11101, 0b11, 0b1110, 0b1010, 0, |
| 491 | (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), |
| 492 | IIC_fpCVTSI, "vcvt", ".s16.f32\t$dst, $a, $fbits", |
| 493 | [/* For disassembly only; pattern left blank */]>; |
| 494 | |
| 495 | def VTOUHS : AVConv1XI<0b11101, 0b11, 0b1111, 0b1010, 0, |
| 496 | (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), |
| 497 | IIC_fpCVTSI, "vcvt", ".u16.f32\t$dst, $a, $fbits", |
| 498 | [/* For disassembly only; pattern left blank */]>; |
| 499 | |
| 500 | def VTOSLS : AVConv1XI<0b11101, 0b11, 0b1110, 0b1010, 1, |
| 501 | (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), |
| 502 | IIC_fpCVTSI, "vcvt", ".s32.f32\t$dst, $a, $fbits", |
| 503 | [/* For disassembly only; pattern left blank */]>; |
| 504 | |
| 505 | def VTOULS : AVConv1XI<0b11101, 0b11, 0b1111, 0b1010, 1, |
| 506 | (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), |
| 507 | IIC_fpCVTSI, "vcvt", ".u32.f32\t$dst, $a, $fbits", |
| 508 | [/* For disassembly only; pattern left blank */]>; |
| 509 | |
| 510 | def VTOSHD : AVConv1XI<0b11101, 0b11, 0b1110, 0b1011, 0, |
| 511 | (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), |
| 512 | IIC_fpCVTDI, "vcvt", ".s16.f64\t$dst, $a, $fbits", |
| 513 | [/* For disassembly only; pattern left blank */]>; |
| 514 | |
| 515 | def VTOUHD : AVConv1XI<0b11101, 0b11, 0b1111, 0b1011, 0, |
| 516 | (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), |
| 517 | IIC_fpCVTDI, "vcvt", ".u16.f64\t$dst, $a, $fbits", |
| 518 | [/* For disassembly only; pattern left blank */]>; |
| 519 | |
| 520 | def VTOSLD : AVConv1XI<0b11101, 0b11, 0b1110, 0b1011, 1, |
| 521 | (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), |
| 522 | IIC_fpCVTDI, "vcvt", ".s32.f64\t$dst, $a, $fbits", |
| 523 | [/* For disassembly only; pattern left blank */]>; |
| 524 | |
| 525 | def VTOULD : AVConv1XI<0b11101, 0b11, 0b1111, 0b1011, 1, |
| 526 | (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), |
| 527 | IIC_fpCVTDI, "vcvt", ".u32.f64\t$dst, $a, $fbits", |
| 528 | [/* For disassembly only; pattern left blank */]>; |
| 529 | |
| 530 | // Fixed-Point to FP: |
| 531 | |
| 532 | def VSHTOS : AVConv1XI<0b11101, 0b11, 0b1010, 0b1010, 0, |
| 533 | (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), |
| 534 | IIC_fpCVTIS, "vcvt", ".f32.s16\t$dst, $a, $fbits", |
| 535 | [/* For disassembly only; pattern left blank */]>; |
| 536 | |
| 537 | def VUHTOS : AVConv1XI<0b11101, 0b11, 0b1011, 0b1010, 0, |
| 538 | (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), |
| 539 | IIC_fpCVTIS, "vcvt", ".f32.u16\t$dst, $a, $fbits", |
| 540 | [/* For disassembly only; pattern left blank */]>; |
| 541 | |
| 542 | def VSLTOS : AVConv1XI<0b11101, 0b11, 0b1010, 0b1010, 1, |
| 543 | (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), |
| 544 | IIC_fpCVTIS, "vcvt", ".f32.s32\t$dst, $a, $fbits", |
| 545 | [/* For disassembly only; pattern left blank */]>; |
| 546 | |
| 547 | def VULTOS : AVConv1XI<0b11101, 0b11, 0b1011, 0b1010, 1, |
| 548 | (outs SPR:$dst), (ins SPR:$a, i32imm:$fbits), |
| 549 | IIC_fpCVTIS, "vcvt", ".f32.u32\t$dst, $a, $fbits", |
| 550 | [/* For disassembly only; pattern left blank */]>; |
| 551 | |
| 552 | def VSHTOD : AVConv1XI<0b11101, 0b11, 0b1010, 0b1011, 0, |
| 553 | (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), |
| 554 | IIC_fpCVTID, "vcvt", ".f64.s16\t$dst, $a, $fbits", |
| 555 | [/* For disassembly only; pattern left blank */]>; |
| 556 | |
| 557 | def VUHTOD : AVConv1XI<0b11101, 0b11, 0b1011, 0b1011, 0, |
| 558 | (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), |
| 559 | IIC_fpCVTID, "vcvt", ".f64.u16\t$dst, $a, $fbits", |
| 560 | [/* For disassembly only; pattern left blank */]>; |
| 561 | |
| 562 | def VSLTOD : AVConv1XI<0b11101, 0b11, 0b1010, 0b1011, 1, |
| 563 | (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), |
| 564 | IIC_fpCVTID, "vcvt", ".f64.s32\t$dst, $a, $fbits", |
| 565 | [/* For disassembly only; pattern left blank */]>; |
| 566 | |
| 567 | def VULTOD : AVConv1XI<0b11101, 0b11, 0b1011, 0b1011, 1, |
| 568 | (outs DPR:$dst), (ins DPR:$a, i32imm:$fbits), |
| 569 | IIC_fpCVTID, "vcvt", ".f64.u32\t$dst, $a, $fbits", |
| 570 | [/* For disassembly only; pattern left blank */]>; |
| 571 | |
| 572 | } // End of 'let Constraints = "$src = $dst" in' |
| 573 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 574 | //===----------------------------------------------------------------------===// |
| 575 | // FP FMA Operations. |
| 576 | // |
| 577 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 578 | def VMLAD : ADbI<0b11100, 0b00, 0, 0, |
| 579 | (outs DPR:$dst), (ins DPR:$dstin, DPR:$a, DPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 580 | IIC_fpMAC64, "vmla", ".f64\t$dst, $a, $b", |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 581 | [(set DPR:$dst, (fadd (fmul DPR:$a, DPR:$b), |
| 582 | (f64 DPR:$dstin)))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 583 | RegConstraint<"$dstin = $dst">; |
| 584 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 585 | def VMLAS : ASbIn<0b11100, 0b00, 0, 0, |
| 586 | (outs SPR:$dst), (ins SPR:$dstin, SPR:$a, SPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 587 | IIC_fpMAC32, "vmla", ".f32\t$dst, $a, $b", |
David Goodwin | dd19ce4 | 2009-08-04 17:53:06 +0000 | [diff] [blame] | 588 | [(set SPR:$dst, (fadd (fmul SPR:$a, SPR:$b), SPR:$dstin))]>, |
| 589 | RegConstraint<"$dstin = $dst">; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 590 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 591 | def VNMLSD : ADbI<0b11100, 0b01, 0, 0, |
| 592 | (outs DPR:$dst), (ins DPR:$dstin, DPR:$a, DPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 593 | IIC_fpMAC64, "vnmls", ".f64\t$dst, $a, $b", |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 594 | [(set DPR:$dst, (fsub (fmul DPR:$a, DPR:$b), |
| 595 | (f64 DPR:$dstin)))]>, |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 596 | RegConstraint<"$dstin = $dst">; |
| 597 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 598 | def VNMLSS : ASbI<0b11100, 0b01, 0, 0, |
| 599 | (outs SPR:$dst), (ins SPR:$dstin, SPR:$a, SPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 600 | IIC_fpMAC32, "vnmls", ".f32\t$dst, $a, $b", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 601 | [(set SPR:$dst, (fsub (fmul SPR:$a, SPR:$b), SPR:$dstin))]>, |
| 602 | RegConstraint<"$dstin = $dst">; |
| 603 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 604 | def VMLSD : ADbI<0b11100, 0b00, 1, 0, |
| 605 | (outs DPR:$dst), (ins DPR:$dstin, DPR:$a, DPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 606 | IIC_fpMAC64, "vmls", ".f64\t$dst, $a, $b", |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 607 | [(set DPR:$dst, (fadd (fneg (fmul DPR:$a, DPR:$b)), |
| 608 | (f64 DPR:$dstin)))]>, |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 609 | RegConstraint<"$dstin = $dst">; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 610 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 611 | def VMLSS : ASbIn<0b11100, 0b00, 1, 0, |
| 612 | (outs SPR:$dst), (ins SPR:$dstin, SPR:$a, SPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 613 | IIC_fpMAC32, "vmls", ".f32\t$dst, $a, $b", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 614 | [(set SPR:$dst, (fadd (fneg (fmul SPR:$a, SPR:$b)), SPR:$dstin))]>, |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 615 | RegConstraint<"$dstin = $dst">; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 616 | |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 617 | def : Pat<(fsub DPR:$dstin, (fmul DPR:$a, (f64 DPR:$b))), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 618 | (VMLSD DPR:$dstin, DPR:$a, DPR:$b)>, Requires<[DontUseNEONForFP]>; |
David Goodwin | f31748c | 2009-08-04 18:44:29 +0000 | [diff] [blame] | 619 | def : Pat<(fsub SPR:$dstin, (fmul SPR:$a, SPR:$b)), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 620 | (VMLSS SPR:$dstin, SPR:$a, SPR:$b)>, Requires<[DontUseNEONForFP]>; |
David Goodwin | f31748c | 2009-08-04 18:44:29 +0000 | [diff] [blame] | 621 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 622 | def VNMLAD : ADbI<0b11100, 0b01, 1, 0, |
| 623 | (outs DPR:$dst), (ins DPR:$dstin, DPR:$a, DPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 624 | IIC_fpMAC64, "vnmla", ".f64\t$dst, $a, $b", |
Chris Lattner | 4e62472 | 2010-03-08 18:51:21 +0000 | [diff] [blame] | 625 | [(set DPR:$dst, (fsub (fneg (fmul DPR:$a, DPR:$b)), |
| 626 | (f64 DPR:$dstin)))]>, |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 627 | RegConstraint<"$dstin = $dst">; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 628 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 629 | def VNMLAS : ASbI<0b11100, 0b01, 1, 0, |
| 630 | (outs SPR:$dst), (ins SPR:$dstin, SPR:$a, SPR:$b), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 631 | IIC_fpMAC32, "vnmla", ".f32\t$dst, $a, $b", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 632 | [(set SPR:$dst, (fsub (fneg (fmul SPR:$a, SPR:$b)), SPR:$dstin))]>, |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 633 | RegConstraint<"$dstin = $dst">; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 634 | |
| 635 | //===----------------------------------------------------------------------===// |
| 636 | // FP Conditional moves. |
| 637 | // |
| 638 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 639 | def VMOVDcc : ADuI<0b11101, 0b11, 0b0000, 0b01, 0, |
Evan Cheng | 9d3cc18 | 2008-11-11 19:40:26 +0000 | [diff] [blame] | 640 | (outs DPR:$dst), (ins DPR:$false, DPR:$true), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 641 | IIC_fpUNA64, "vmov", ".f64\t$dst, $true", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 642 | [/*(set DPR:$dst, (ARMcmov DPR:$false, DPR:$true, imm:$cc))*/]>, |
| 643 | RegConstraint<"$false = $dst">; |
| 644 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 645 | def VMOVScc : ASuI<0b11101, 0b11, 0b0000, 0b01, 0, |
Evan Cheng | 9d3cc18 | 2008-11-11 19:40:26 +0000 | [diff] [blame] | 646 | (outs SPR:$dst), (ins SPR:$false, SPR:$true), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 647 | IIC_fpUNA32, "vmov", ".f32\t$dst, $true", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 648 | [/*(set SPR:$dst, (ARMcmov SPR:$false, SPR:$true, imm:$cc))*/]>, |
| 649 | RegConstraint<"$false = $dst">; |
| 650 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 651 | def VNEGDcc : ADuI<0b11101, 0b11, 0b0001, 0b01, 0, |
Evan Cheng | 9d3cc18 | 2008-11-11 19:40:26 +0000 | [diff] [blame] | 652 | (outs DPR:$dst), (ins DPR:$false, DPR:$true), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 653 | IIC_fpUNA64, "vneg", ".f64\t$dst, $true", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 654 | [/*(set DPR:$dst, (ARMcneg DPR:$false, DPR:$true, imm:$cc))*/]>, |
| 655 | RegConstraint<"$false = $dst">; |
| 656 | |
Johnny Chen | f363f2b | 2010-01-29 23:21:10 +0000 | [diff] [blame] | 657 | def VNEGScc : ASuI<0b11101, 0b11, 0b0001, 0b01, 0, |
Evan Cheng | 9d3cc18 | 2008-11-11 19:40:26 +0000 | [diff] [blame] | 658 | (outs SPR:$dst), (ins SPR:$false, SPR:$true), |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 659 | IIC_fpUNA32, "vneg", ".f32\t$dst, $true", |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 660 | [/*(set SPR:$dst, (ARMcneg SPR:$false, SPR:$true, imm:$cc))*/]>, |
| 661 | RegConstraint<"$false = $dst">; |
Evan Cheng | 9d3cc18 | 2008-11-11 19:40:26 +0000 | [diff] [blame] | 662 | |
| 663 | |
| 664 | //===----------------------------------------------------------------------===// |
| 665 | // Misc. |
| 666 | // |
| 667 | |
Evan Cheng | 979c7ab | 2009-11-10 19:44:56 +0000 | [diff] [blame] | 668 | // APSR is the application level alias of CPSR. This FPSCR N, Z, C, V flags |
| 669 | // to APSR. |
Evan Cheng | df6703e | 2009-07-20 02:12:31 +0000 | [diff] [blame] | 670 | let Defs = [CPSR], Uses = [FPSCR] in |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 671 | def FMSTAT : VFPAI<(outs), (ins), VFPMiscFrm, IIC_fpSTAT, "vmrs", |
Jim Grosbach | 0b6f987 | 2009-11-13 01:17:22 +0000 | [diff] [blame] | 672 | "\tapsr_nzcv, fpscr", |
Evan Cheng | c1db4e5 | 2009-10-27 00:20:49 +0000 | [diff] [blame] | 673 | [(arm_fmstat)]> { |
Evan Cheng | bb786b3 | 2008-11-11 21:48:44 +0000 | [diff] [blame] | 674 | let Inst{27-20} = 0b11101111; |
| 675 | let Inst{19-16} = 0b0001; |
| 676 | let Inst{15-12} = 0b1111; |
| 677 | let Inst{11-8} = 0b1010; |
| 678 | let Inst{7} = 0; |
| 679 | let Inst{4} = 1; |
| 680 | } |
Evan Cheng | 7c7a3ff | 2009-10-28 01:44:26 +0000 | [diff] [blame] | 681 | |
Johnny Chen | 1bfdc74 | 2010-02-09 22:35:38 +0000 | [diff] [blame] | 682 | // FPSCR <-> GPR (for disassembly only) |
| 683 | |
| 684 | let Uses = [FPSCR] in { |
| 685 | def VMRS : VFPAI<(outs GPR:$dst), (ins), VFPMiscFrm, IIC_fpSTAT, "vmrs", |
| 686 | "\t$dst, fpscr", |
| 687 | [/* For disassembly only; pattern left blank */]> { |
| 688 | let Inst{27-20} = 0b11101111; |
| 689 | let Inst{19-16} = 0b0001; |
| 690 | let Inst{11-8} = 0b1010; |
| 691 | let Inst{7} = 0; |
| 692 | let Inst{4} = 1; |
| 693 | } |
| 694 | } |
| 695 | |
| 696 | let Defs = [FPSCR] in { |
| 697 | def VMSR : VFPAI<(outs), (ins GPR:$src), VFPMiscFrm, IIC_fpSTAT, "vmsr", |
| 698 | "\tfpscr, $src", |
| 699 | [/* For disassembly only; pattern left blank */]> { |
| 700 | let Inst{27-20} = 0b11101110; |
| 701 | let Inst{19-16} = 0b0001; |
| 702 | let Inst{11-8} = 0b1010; |
| 703 | let Inst{7} = 0; |
| 704 | let Inst{4} = 1; |
| 705 | } |
| 706 | } |
Evan Cheng | 7c7a3ff | 2009-10-28 01:44:26 +0000 | [diff] [blame] | 707 | |
| 708 | // Materialize FP immediates. VFP3 only. |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 709 | let isReMaterializable = 1 in { |
| 710 | def FCONSTD : VFPAI<(outs DPR:$dst), (ins vfp_f64imm:$imm), |
| 711 | VFPMiscFrm, IIC_VMOVImm, |
Evan Cheng | 9f433ab | 2009-11-24 01:05:23 +0000 | [diff] [blame] | 712 | "vmov", ".f64\t$dst, $imm", |
Jim Grosbach | e2fda53 | 2009-11-09 00:11:35 +0000 | [diff] [blame] | 713 | [(set DPR:$dst, vfp_f64imm:$imm)]>, Requires<[HasVFP3]> { |
| 714 | let Inst{27-23} = 0b11101; |
| 715 | let Inst{21-20} = 0b11; |
| 716 | let Inst{11-9} = 0b101; |
| 717 | let Inst{8} = 1; |
| 718 | let Inst{7-4} = 0b0000; |
| 719 | } |
| 720 | |
Evan Cheng | 7c7a3ff | 2009-10-28 01:44:26 +0000 | [diff] [blame] | 721 | def FCONSTS : VFPAI<(outs SPR:$dst), (ins vfp_f32imm:$imm), |
| 722 | VFPMiscFrm, IIC_VMOVImm, |
Evan Cheng | 9f433ab | 2009-11-24 01:05:23 +0000 | [diff] [blame] | 723 | "vmov", ".f32\t$dst, $imm", |
Evan Cheng | 7c7a3ff | 2009-10-28 01:44:26 +0000 | [diff] [blame] | 724 | [(set SPR:$dst, vfp_f32imm:$imm)]>, Requires<[HasVFP3]> { |
| 725 | let Inst{27-23} = 0b11101; |
| 726 | let Inst{21-20} = 0b11; |
| 727 | let Inst{11-9} = 0b101; |
| 728 | let Inst{8} = 0; |
| 729 | let Inst{7-4} = 0b0000; |
| 730 | } |
Evan Cheng | 7c7a3ff | 2009-10-28 01:44:26 +0000 | [diff] [blame] | 731 | } |