Chromium Code Reviews| 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 // this explicitly whitelists vector instructions we have some reason to | |
|
John
2016/01/25 20:58:57
I would phrase this like
Explicitly whitelists ve
| |
| 2806 // believe works. | |
| 2807 case InstArithmetic::Fadd: | |
| 2808 case InstArithmetic::Add: | |
| 2809 break; | |
| 2810 } | |
| 2803 } | 2811 } |
| 2804 | 2812 |
| 2805 // DestTy is a non-i64 scalar. | 2813 // DestTy is a non-i64 scalar. |
| 2806 Variable *T = makeReg(DestTy); | 2814 Variable *T = makeReg(DestTy); |
| 2807 | 2815 |
| 2808 // * 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 |
| 2809 // 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 |
| 2810 // difficult to determine (constant may be moved to a register). | 2818 // difficult to determine (constant may be moved to a register). |
| 2811 // * Handle floating point arithmetic separately: they require Src1 to be | 2819 // * Handle floating point arithmetic separately: they require Src1 to be |
| 2812 // legalized to a register. | 2820 // legalized to a register. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2893 } | 2901 } |
| 2894 | 2902 |
| 2895 // Handle everything else here. | 2903 // Handle everything else here. |
| 2896 Int32Operands Srcs(Src0, Src1); | 2904 Int32Operands Srcs(Src0, Src1); |
| 2897 switch (Instr->getOp()) { | 2905 switch (Instr->getOp()) { |
| 2898 case InstArithmetic::_num: | 2906 case InstArithmetic::_num: |
| 2899 llvm::report_fatal_error("Unknown arithmetic operator"); | 2907 llvm::report_fatal_error("Unknown arithmetic operator"); |
| 2900 return; | 2908 return; |
| 2901 case InstArithmetic::Add: { | 2909 case InstArithmetic::Add: { |
| 2902 if (const Inst *Src1Producer = Computations.getProducerOf(Src1)) { | 2910 if (const Inst *Src1Producer = Computations.getProducerOf(Src1)) { |
| 2911 assert(!isVectorType(DestTy)); | |
| 2903 Variable *Src0R = legalizeToReg(Src0); | 2912 Variable *Src0R = legalizeToReg(Src0); |
| 2904 Variable *Src1R = legalizeToReg(Src1Producer->getSrc(0)); | 2913 Variable *Src1R = legalizeToReg(Src1Producer->getSrc(0)); |
| 2905 Variable *Src2R = legalizeToReg(Src1Producer->getSrc(1)); | 2914 Variable *Src2R = legalizeToReg(Src1Producer->getSrc(1)); |
| 2906 _mla(T, Src1R, Src2R, Src0R); | 2915 _mla(T, Src1R, Src2R, Src0R); |
| 2907 _mov(Dest, T); | 2916 _mov(Dest, T); |
| 2908 return; | 2917 return; |
| 2909 } | 2918 } |
| 2910 | 2919 |
| 2911 if (Srcs.hasConstOperand()) { | 2920 if (Srcs.hasConstOperand()) { |
| 2912 if (!Srcs.immediateIsFlexEncodable() && | 2921 if (!Srcs.immediateIsFlexEncodable() && |
| 2913 Srcs.negatedImmediateIsFlexEncodable()) { | 2922 Srcs.negatedImmediateIsFlexEncodable()) { |
| 2923 assert(!isVectorType(DestTy)); | |
| 2914 Variable *Src0R = Srcs.src0R(this); | 2924 Variable *Src0R = Srcs.src0R(this); |
| 2915 Operand *Src1F = Srcs.negatedSrc1F(this); | 2925 Operand *Src1F = Srcs.negatedSrc1F(this); |
| 2916 if (!Srcs.swappedOperands()) { | 2926 if (!Srcs.swappedOperands()) { |
| 2917 _sub(T, Src0R, Src1F); | 2927 _sub(T, Src0R, Src1F); |
| 2918 } else { | 2928 } else { |
| 2919 _rsb(T, Src0R, Src1F); | 2929 _rsb(T, Src0R, Src1F); |
| 2920 } | 2930 } |
| 2921 _mov(Dest, T); | 2931 _mov(Dest, T); |
| 2922 return; | 2932 return; |
| 2923 } | 2933 } |
| 2924 } | 2934 } |
| 2925 Variable *Src0R = Srcs.src0R(this); | 2935 Variable *Src0R = Srcs.src0R(this); |
| 2926 Operand *Src1RF = Srcs.src1RF(this); | 2936 if (isVectorType(DestTy)) { |
| 2927 _add(T, Src0R, Src1RF); | 2937 Variable *Src1R = legalizeToReg(Src1); |
| 2938 _vadd(T, Src0R, Src1R); | |
| 2939 } | |
| 2940 else { | |
| 2941 Operand *Src1RF = Srcs.src1RF(this); | |
| 2942 _add(T, Src0R, Src1RF); | |
| 2943 } | |
| 2928 _mov(Dest, T); | 2944 _mov(Dest, T); |
| 2929 return; | 2945 return; |
| 2930 } | 2946 } |
| 2931 case InstArithmetic::And: { | 2947 case InstArithmetic::And: { |
| 2932 if (Srcs.hasConstOperand()) { | 2948 if (Srcs.hasConstOperand()) { |
| 2933 if (!Srcs.immediateIsFlexEncodable() && | 2949 if (!Srcs.immediateIsFlexEncodable() && |
| 2934 Srcs.invertedImmediateIsFlexEncodable()) { | 2950 Srcs.invertedImmediateIsFlexEncodable()) { |
| 2935 Variable *Src0R = Srcs.src0R(this); | 2951 Variable *Src0R = Srcs.src0R(this); |
| 2936 Operand *Src1F = Srcs.invertedSrc1F(this); | 2952 Operand *Src1F = Srcs.invertedSrc1F(this); |
| 2937 _bic(T, Src0R, Src1F); | 2953 _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. | 6482 // Technically R9 is used for TLS with Sandboxing, and we reserve it. |
| 6467 // However, for compatibility with current NaCl LLVM, don't claim that. | 6483 // 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"; | 6484 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; |
| 6469 } | 6485 } |
| 6470 | 6486 |
| 6471 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM]; | 6487 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM]; |
| 6472 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; | 6488 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; |
| 6473 | 6489 |
| 6474 } // end of namespace ARM32 | 6490 } // end of namespace ARM32 |
| 6475 } // end of namespace Ice | 6491 } // end of namespace Ice |
| OLD | NEW |