OLD | NEW |
1 //===- subzero/src/IceTargetLoweringARM32.cpp - ARM32 lowering ------------===// | 1 //===- subzero/src/IceTargetLoweringARM32.cpp - ARM32 lowering ------------===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 /// | 9 /// |
10 /// \file | 10 /// \file |
(...skipping 2787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2798 } | 2798 } |
2799 | 2799 |
2800 if (isVectorType(DestTy)) { | 2800 if (isVectorType(DestTy)) { |
2801 switch (Instr->getOp()) { | 2801 switch (Instr->getOp()) { |
2802 default: | 2802 default: |
2803 UnimplementedLoweringError(this, Instr); | 2803 UnimplementedLoweringError(this, Instr); |
2804 return; | 2804 return; |
2805 // Explicitly whitelist vector instructions we have implemented/enabled. | 2805 // Explicitly whitelist vector instructions we have implemented/enabled. |
2806 case InstArithmetic::Fadd: | 2806 case InstArithmetic::Fadd: |
2807 case InstArithmetic::Add: | 2807 case InstArithmetic::Add: |
| 2808 case InstArithmetic::Fsub: |
| 2809 case InstArithmetic::Sub: |
2808 break; | 2810 break; |
2809 } | 2811 } |
2810 } | 2812 } |
2811 | 2813 |
2812 Variable *T = makeReg(DestTy); | 2814 Variable *T = makeReg(DestTy); |
2813 | 2815 |
2814 // * Handle div/rem separately. They require a non-legalized Src1 to inspect | 2816 // * Handle div/rem separately. They require a non-legalized Src1 to inspect |
2815 // whether or not Src1 is a non-zero constant. Once legalized it is more | 2817 // whether or not Src1 is a non-zero constant. Once legalized it is more |
2816 // difficult to determine (constant may be moved to a register). | 2818 // difficult to determine (constant may be moved to a register). |
2817 // * Handle floating point arithmetic separately: they require Src1 to be | 2819 // * Handle floating point arithmetic separately: they require Src1 to be |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2967 } | 2969 } |
2968 case InstArithmetic::Xor: { | 2970 case InstArithmetic::Xor: { |
2969 Variable *Src0R = Srcs.src0R(this); | 2971 Variable *Src0R = Srcs.src0R(this); |
2970 Operand *Src1RF = Srcs.src1RF(this); | 2972 Operand *Src1RF = Srcs.src1RF(this); |
2971 _eor(T, Src0R, Src1RF); | 2973 _eor(T, Src0R, Src1RF); |
2972 _mov(Dest, T); | 2974 _mov(Dest, T); |
2973 return; | 2975 return; |
2974 } | 2976 } |
2975 case InstArithmetic::Sub: { | 2977 case InstArithmetic::Sub: { |
2976 if (const Inst *Src1Producer = Computations.getProducerOf(Src1)) { | 2978 if (const Inst *Src1Producer = Computations.getProducerOf(Src1)) { |
| 2979 assert(!isVectorType(DestTy)); |
2977 Variable *Src0R = legalizeToReg(Src0); | 2980 Variable *Src0R = legalizeToReg(Src0); |
2978 Variable *Src1R = legalizeToReg(Src1Producer->getSrc(0)); | 2981 Variable *Src1R = legalizeToReg(Src1Producer->getSrc(0)); |
2979 Variable *Src2R = legalizeToReg(Src1Producer->getSrc(1)); | 2982 Variable *Src2R = legalizeToReg(Src1Producer->getSrc(1)); |
2980 _mls(T, Src1R, Src2R, Src0R); | 2983 _mls(T, Src1R, Src2R, Src0R); |
2981 _mov(Dest, T); | 2984 _mov(Dest, T); |
2982 return; | 2985 return; |
2983 } | 2986 } |
2984 | 2987 |
2985 if (Srcs.hasConstOperand()) { | 2988 if (Srcs.hasConstOperand()) { |
| 2989 assert(!isVectorType(DestTy)); |
2986 if (Srcs.immediateIsFlexEncodable()) { | 2990 if (Srcs.immediateIsFlexEncodable()) { |
2987 Variable *Src0R = Srcs.src0R(this); | 2991 Variable *Src0R = Srcs.src0R(this); |
2988 Operand *Src1RF = Srcs.src1RF(this); | 2992 Operand *Src1RF = Srcs.src1RF(this); |
2989 if (Srcs.swappedOperands()) { | 2993 if (Srcs.swappedOperands()) { |
2990 _rsb(T, Src0R, Src1RF); | 2994 _rsb(T, Src0R, Src1RF); |
2991 } else { | 2995 } else { |
2992 _sub(T, Src0R, Src1RF); | 2996 _sub(T, Src0R, Src1RF); |
2993 } | 2997 } |
2994 _mov(Dest, T); | 2998 _mov(Dest, T); |
2995 return; | 2999 return; |
2996 } | 3000 } |
2997 if (!Srcs.swappedOperands() && Srcs.negatedImmediateIsFlexEncodable()) { | 3001 if (!Srcs.swappedOperands() && Srcs.negatedImmediateIsFlexEncodable()) { |
2998 Variable *Src0R = Srcs.src0R(this); | 3002 Variable *Src0R = Srcs.src0R(this); |
2999 Operand *Src1F = Srcs.negatedSrc1F(this); | 3003 Operand *Src1F = Srcs.negatedSrc1F(this); |
3000 _add(T, Src0R, Src1F); | 3004 _add(T, Src0R, Src1F); |
3001 _mov(Dest, T); | 3005 _mov(Dest, T); |
3002 return; | 3006 return; |
3003 } | 3007 } |
3004 } | 3008 } |
3005 Variable *Src0R = Srcs.unswappedSrc0R(this); | 3009 Variable *Src0R = Srcs.unswappedSrc0R(this); |
3006 Variable *Src1R = Srcs.unswappedSrc1R(this); | 3010 Variable *Src1R = Srcs.unswappedSrc1R(this); |
3007 _sub(T, Src0R, Src1R); | 3011 if (isVectorType(DestTy)) { |
| 3012 _vsub(T, Src0R, Src1R); |
| 3013 } else { |
| 3014 _sub(T, Src0R, Src1R); |
| 3015 } |
3008 _mov(Dest, T); | 3016 _mov(Dest, T); |
3009 return; | 3017 return; |
3010 } | 3018 } |
3011 case InstArithmetic::Mul: { | 3019 case InstArithmetic::Mul: { |
3012 const bool OptM1 = Ctx->getFlags().getOptLevel() == Opt_m1; | 3020 const bool OptM1 = Ctx->getFlags().getOptLevel() == Opt_m1; |
3013 if (!OptM1 && Srcs.hasConstOperand()) { | 3021 if (!OptM1 && Srcs.hasConstOperand()) { |
3014 constexpr std::size_t MaxShifts = 4; | 3022 constexpr std::size_t MaxShifts = 4; |
3015 std::array<StrengthReduction::AggregationElement, MaxShifts> Shifts; | 3023 std::array<StrengthReduction::AggregationElement, MaxShifts> Shifts; |
3016 SizeT NumOperations; | 3024 SizeT NumOperations; |
3017 int32_t Const = Srcs.getConstantValue(); | 3025 int32_t Const = Srcs.getConstantValue(); |
(...skipping 3461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6479 // Technically R9 is used for TLS with Sandboxing, and we reserve it. | 6487 // Technically R9 is used for TLS with Sandboxing, and we reserve it. |
6480 // However, for compatibility with current NaCl LLVM, don't claim that. | 6488 // However, for compatibility with current NaCl LLVM, don't claim that. |
6481 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; | 6489 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; |
6482 } | 6490 } |
6483 | 6491 |
6484 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM]; | 6492 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM]; |
6485 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; | 6493 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; |
6486 | 6494 |
6487 } // end of namespace ARM32 | 6495 } // end of namespace ARM32 |
6488 } // end of namespace Ice | 6496 } // end of namespace Ice |
OLD | NEW |