| 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 2780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2791 } | 2791 } |
| 2792 | 2792 |
| 2793 Operand *Src0 = legalizeUndef(Instr->getSrc(0)); | 2793 Operand *Src0 = legalizeUndef(Instr->getSrc(0)); |
| 2794 Operand *Src1 = legalizeUndef(Instr->getSrc(1)); | 2794 Operand *Src1 = legalizeUndef(Instr->getSrc(1)); |
| 2795 if (DestTy == IceType_i64) { | 2795 if (DestTy == IceType_i64) { |
| 2796 lowerInt64Arithmetic(Instr->getOp(), Instr->getDest(), Src0, Src1); | 2796 lowerInt64Arithmetic(Instr->getOp(), Instr->getDest(), Src0, Src1); |
| 2797 return; | 2797 return; |
| 2798 } | 2798 } |
| 2799 | 2799 |
| 2800 if (isVectorType(DestTy)) { | 2800 if (isVectorType(DestTy)) { |
| 2801 UnimplementedLoweringError(this, Instr); | 2801 switch (Instr->getOp()) { |
| 2802 return; | 2802 default: |
| 2803 UnimplementedLoweringError(this, Instr); |
| 2804 return; |
| 2805 // Explicitly whitelist vector instructions we have implemented/enabled. |
| 2806 case InstArithmetic::Fadd: |
| 2807 case InstArithmetic::Add: |
| 2808 break; |
| 2809 } |
| 2803 } | 2810 } |
| 2804 | 2811 |
| 2805 // DestTy is a non-i64 scalar. | |
| 2806 Variable *T = makeReg(DestTy); | 2812 Variable *T = makeReg(DestTy); |
| 2807 | 2813 |
| 2808 // * Handle div/rem separately. They require a non-legalized Src1 to inspect | 2814 // * Handle div/rem separately. They require a non-legalized Src1 to inspect |
| 2809 // whether or not Src1 is a non-zero constant. Once legalized it is more | 2815 // whether or not Src1 is a non-zero constant. Once legalized it is more |
| 2810 // difficult to determine (constant may be moved to a register). | 2816 // difficult to determine (constant may be moved to a register). |
| 2811 // * Handle floating point arithmetic separately: they require Src1 to be | 2817 // * Handle floating point arithmetic separately: they require Src1 to be |
| 2812 // legalized to a register. | 2818 // legalized to a register. |
| 2813 switch (Instr->getOp()) { | 2819 switch (Instr->getOp()) { |
| 2814 default: | 2820 default: |
| 2815 break; | 2821 break; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2893 } | 2899 } |
| 2894 | 2900 |
| 2895 // Handle everything else here. | 2901 // Handle everything else here. |
| 2896 Int32Operands Srcs(Src0, Src1); | 2902 Int32Operands Srcs(Src0, Src1); |
| 2897 switch (Instr->getOp()) { | 2903 switch (Instr->getOp()) { |
| 2898 case InstArithmetic::_num: | 2904 case InstArithmetic::_num: |
| 2899 llvm::report_fatal_error("Unknown arithmetic operator"); | 2905 llvm::report_fatal_error("Unknown arithmetic operator"); |
| 2900 return; | 2906 return; |
| 2901 case InstArithmetic::Add: { | 2907 case InstArithmetic::Add: { |
| 2902 if (const Inst *Src1Producer = Computations.getProducerOf(Src1)) { | 2908 if (const Inst *Src1Producer = Computations.getProducerOf(Src1)) { |
| 2909 assert(!isVectorType(DestTy)); |
| 2903 Variable *Src0R = legalizeToReg(Src0); | 2910 Variable *Src0R = legalizeToReg(Src0); |
| 2904 Variable *Src1R = legalizeToReg(Src1Producer->getSrc(0)); | 2911 Variable *Src1R = legalizeToReg(Src1Producer->getSrc(0)); |
| 2905 Variable *Src2R = legalizeToReg(Src1Producer->getSrc(1)); | 2912 Variable *Src2R = legalizeToReg(Src1Producer->getSrc(1)); |
| 2906 _mla(T, Src1R, Src2R, Src0R); | 2913 _mla(T, Src1R, Src2R, Src0R); |
| 2907 _mov(Dest, T); | 2914 _mov(Dest, T); |
| 2908 return; | 2915 return; |
| 2909 } | 2916 } |
| 2910 | 2917 |
| 2911 if (Srcs.hasConstOperand()) { | 2918 if (Srcs.hasConstOperand()) { |
| 2912 if (!Srcs.immediateIsFlexEncodable() && | 2919 if (!Srcs.immediateIsFlexEncodable() && |
| 2913 Srcs.negatedImmediateIsFlexEncodable()) { | 2920 Srcs.negatedImmediateIsFlexEncodable()) { |
| 2921 assert(!isVectorType(DestTy)); |
| 2914 Variable *Src0R = Srcs.src0R(this); | 2922 Variable *Src0R = Srcs.src0R(this); |
| 2915 Operand *Src1F = Srcs.negatedSrc1F(this); | 2923 Operand *Src1F = Srcs.negatedSrc1F(this); |
| 2916 if (!Srcs.swappedOperands()) { | 2924 if (!Srcs.swappedOperands()) { |
| 2917 _sub(T, Src0R, Src1F); | 2925 _sub(T, Src0R, Src1F); |
| 2918 } else { | 2926 } else { |
| 2919 _rsb(T, Src0R, Src1F); | 2927 _rsb(T, Src0R, Src1F); |
| 2920 } | 2928 } |
| 2921 _mov(Dest, T); | 2929 _mov(Dest, T); |
| 2922 return; | 2930 return; |
| 2923 } | 2931 } |
| 2924 } | 2932 } |
| 2925 Variable *Src0R = Srcs.src0R(this); | 2933 Variable *Src0R = Srcs.src0R(this); |
| 2926 Operand *Src1RF = Srcs.src1RF(this); | 2934 if (isVectorType(DestTy)) { |
| 2927 _add(T, Src0R, Src1RF); | 2935 Variable *Src1R = legalizeToReg(Src1); |
| 2936 _vadd(T, Src0R, Src1R); |
| 2937 } else { |
| 2938 Operand *Src1RF = Srcs.src1RF(this); |
| 2939 _add(T, Src0R, Src1RF); |
| 2940 } |
| 2928 _mov(Dest, T); | 2941 _mov(Dest, T); |
| 2929 return; | 2942 return; |
| 2930 } | 2943 } |
| 2931 case InstArithmetic::And: { | 2944 case InstArithmetic::And: { |
| 2932 if (Srcs.hasConstOperand()) { | 2945 if (Srcs.hasConstOperand()) { |
| 2933 if (!Srcs.immediateIsFlexEncodable() && | 2946 if (!Srcs.immediateIsFlexEncodable() && |
| 2934 Srcs.invertedImmediateIsFlexEncodable()) { | 2947 Srcs.invertedImmediateIsFlexEncodable()) { |
| 2935 Variable *Src0R = Srcs.src0R(this); | 2948 Variable *Src0R = Srcs.src0R(this); |
| 2936 Operand *Src1F = Srcs.invertedSrc1F(this); | 2949 Operand *Src1F = Srcs.invertedSrc1F(this); |
| 2937 _bic(T, Src0R, Src1F); | 2950 _bic(T, Src0R, Src1F); |
| (...skipping 3528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6466 // Technically R9 is used for TLS with Sandboxing, and we reserve it. | 6479 // Technically R9 is used for TLS with Sandboxing, and we reserve it. |
| 6467 // However, for compatibility with current NaCl LLVM, don't claim that. | 6480 // However, for compatibility with current NaCl LLVM, don't claim that. |
| 6468 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; | 6481 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; |
| 6469 } | 6482 } |
| 6470 | 6483 |
| 6471 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM]; | 6484 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM]; |
| 6472 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; | 6485 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; |
| 6473 | 6486 |
| 6474 } // end of namespace ARM32 | 6487 } // end of namespace ARM32 |
| 6475 } // end of namespace Ice | 6488 } // end of namespace Ice |
| OLD | NEW |