OLD | NEW |
1 //===- subzero/src/IceInstARM32.cpp - ARM32 instruction implementation ----===// | 1 //===- subzero/src/IceInstARM32.cpp - ARM32 instruction implementation ----===// |
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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 case IceType_v8i1: | 828 case IceType_v8i1: |
829 case IceType_v16i1: | 829 case IceType_v16i1: |
830 case IceType_v16i8: | 830 case IceType_v16i8: |
831 case IceType_v8i16: | 831 case IceType_v8i16: |
832 case IceType_v4i32: { | 832 case IceType_v4i32: { |
833 const Type ElmtTy = typeElementType(DestTy); | 833 const Type ElmtTy = typeElementType(DestTy); |
834 assert(Sign != InstARM32::FS_None); | 834 assert(Sign != InstARM32::FS_None); |
835 switch (Sign) { | 835 switch (Sign) { |
836 case InstARM32::FS_None: // defaults to unsigned. | 836 case InstARM32::FS_None: // defaults to unsigned. |
837 case InstARM32::FS_Unsigned: | 837 case InstARM32::FS_Unsigned: |
838 Asm->vshlqu(ElmtTy, Dest, getSrc(0), getSrc(1)); | 838 if (const auto *Imm6 = llvm::dyn_cast<ConstantInteger32>(getSrc(1))) { |
| 839 Asm->vshlqc(ElmtTy, Dest, getSrc(0), Imm6); |
| 840 } else { |
| 841 Asm->vshlqu(ElmtTy, Dest, getSrc(0), getSrc(1)); |
| 842 } |
839 break; | 843 break; |
840 case InstARM32::FS_Signed: | 844 case InstARM32::FS_Signed: |
841 Asm->vshlqi(ElmtTy, Dest, getSrc(0), getSrc(1)); | 845 if (const auto *Imm6 = llvm::dyn_cast<ConstantInteger32>(getSrc(1))) { |
| 846 Asm->vshlqc(ElmtTy, Dest, getSrc(0), Imm6); |
| 847 } else { |
| 848 Asm->vshlqi(ElmtTy, Dest, getSrc(0), getSrc(1)); |
| 849 } |
842 break; | 850 break; |
843 } | 851 } |
844 } break; | 852 } break; |
| 853 } |
| 854 } |
| 855 |
| 856 template <> void InstARM32Vshr::emitIAS(const Cfg *Func) const { |
| 857 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
| 858 const Variable *Dest = getDest(); |
| 859 const Type DestTy = Dest->getType(); |
| 860 switch (DestTy) { |
| 861 default: |
| 862 llvm::report_fatal_error("Vshr not defined on type " + |
| 863 typeStdString(Dest->getType())); |
| 864 case IceType_v4i1: |
| 865 case IceType_v8i1: |
| 866 case IceType_v16i1: |
| 867 case IceType_v16i8: |
| 868 case IceType_v8i16: |
| 869 case IceType_v4i32: { |
| 870 const Type ElmtTy = typeElementType(DestTy); |
| 871 const auto *Imm6 = llvm::cast<ConstantInteger32>(getSrc(1)); |
| 872 assert(Sign != InstARM32::FS_None); |
| 873 switch (Sign) { |
| 874 case InstARM32::FS_None: // defaults to unsigned. |
| 875 case InstARM32::FS_Unsigned: |
| 876 Asm->vshrquc(ElmtTy, Dest, getSrc(0), Imm6); |
| 877 break; |
| 878 case InstARM32::FS_Signed: |
| 879 Asm->vshrqic(ElmtTy, Dest, getSrc(0), Imm6); |
| 880 break; |
| 881 } |
| 882 } break; |
845 } | 883 } |
846 } | 884 } |
847 | 885 |
848 template <> void InstARM32Vsub::emitIAS(const Cfg *Func) const { | 886 template <> void InstARM32Vsub::emitIAS(const Cfg *Func) const { |
849 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | 887 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
850 const Variable *Dest = getDest(); | 888 const Variable *Dest = getDest(); |
851 Type DestTy = Dest->getType(); | 889 Type DestTy = Dest->getType(); |
852 switch (DestTy) { | 890 switch (DestTy) { |
853 default: | 891 default: |
854 llvm::report_fatal_error("Vsub not defined on type " + | 892 llvm::report_fatal_error("Vsub not defined on type " + |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 template <> const char *InstARM32Vadd::Opcode = "vadd"; | 1497 template <> const char *InstARM32Vadd::Opcode = "vadd"; |
1460 template <> const char *InstARM32Vand::Opcode = "vand"; | 1498 template <> const char *InstARM32Vand::Opcode = "vand"; |
1461 template <> const char *InstARM32Vdiv::Opcode = "vdiv"; | 1499 template <> const char *InstARM32Vdiv::Opcode = "vdiv"; |
1462 template <> const char *InstARM32Veor::Opcode = "veor"; | 1500 template <> const char *InstARM32Veor::Opcode = "veor"; |
1463 template <> const char *InstARM32Vmla::Opcode = "vmla"; | 1501 template <> const char *InstARM32Vmla::Opcode = "vmla"; |
1464 template <> const char *InstARM32Vmls::Opcode = "vmls"; | 1502 template <> const char *InstARM32Vmls::Opcode = "vmls"; |
1465 template <> const char *InstARM32Vmul::Opcode = "vmul"; | 1503 template <> const char *InstARM32Vmul::Opcode = "vmul"; |
1466 template <> const char *InstARM32Vorr::Opcode = "vorr"; | 1504 template <> const char *InstARM32Vorr::Opcode = "vorr"; |
1467 template <> const char *InstARM32UnaryopFP<InstARM32::Vneg>::Opcode = "vneg"; | 1505 template <> const char *InstARM32UnaryopFP<InstARM32::Vneg>::Opcode = "vneg"; |
1468 template <> const char *InstARM32ThreeAddrFP<InstARM32::Vshl>::Opcode = "vshl"; | 1506 template <> const char *InstARM32ThreeAddrFP<InstARM32::Vshl>::Opcode = "vshl"; |
| 1507 template <> const char *InstARM32ThreeAddrFP<InstARM32::Vshr>::Opcode = "vshr"; |
1469 template <> const char *InstARM32Vsub::Opcode = "vsub"; | 1508 template <> const char *InstARM32Vsub::Opcode = "vsub"; |
1470 // Four-addr ops | 1509 // Four-addr ops |
1471 template <> const char *InstARM32Mla::Opcode = "mla"; | 1510 template <> const char *InstARM32Mla::Opcode = "mla"; |
1472 template <> const char *InstARM32Mls::Opcode = "mls"; | 1511 template <> const char *InstARM32Mls::Opcode = "mls"; |
1473 // Cmp-like ops | 1512 // Cmp-like ops |
1474 template <> const char *InstARM32Cmn::Opcode = "cmn"; | 1513 template <> const char *InstARM32Cmn::Opcode = "cmn"; |
1475 template <> const char *InstARM32Cmp::Opcode = "cmp"; | 1514 template <> const char *InstARM32Cmp::Opcode = "cmp"; |
1476 template <> const char *InstARM32Tst::Opcode = "tst"; | 1515 template <> const char *InstARM32Tst::Opcode = "tst"; |
1477 | 1516 |
1478 void InstARM32::dump(const Cfg *Func) const { | 1517 void InstARM32::dump(const Cfg *Func) const { |
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2445 case InstARM32Vcvt::D2ui: | 2484 case InstARM32Vcvt::D2ui: |
2446 return ".u32.f64"; | 2485 return ".u32.f64"; |
2447 case InstARM32Vcvt::Si2d: | 2486 case InstARM32Vcvt::Si2d: |
2448 return ".f64.s32"; | 2487 return ".f64.s32"; |
2449 case InstARM32Vcvt::Ui2d: | 2488 case InstARM32Vcvt::Ui2d: |
2450 return ".f64.u32"; | 2489 return ".f64.u32"; |
2451 case InstARM32Vcvt::S2d: | 2490 case InstARM32Vcvt::S2d: |
2452 return ".f64.f32"; | 2491 return ".f64.f32"; |
2453 case InstARM32Vcvt::D2s: | 2492 case InstARM32Vcvt::D2s: |
2454 return ".f32.f64"; | 2493 return ".f32.f64"; |
| 2494 case InstARM32Vcvt::Vs2si: |
| 2495 return ".s32.f32"; |
| 2496 case InstARM32Vcvt::Vs2ui: |
| 2497 return ".u32.f32"; |
| 2498 case InstARM32Vcvt::Vsi2s: |
| 2499 return ".f32.s32"; |
| 2500 case InstARM32Vcvt::Vui2s: |
| 2501 return ".f32.u32"; |
2455 } | 2502 } |
2456 llvm::report_fatal_error("Invalid VcvtVariant enum."); | 2503 llvm::report_fatal_error("Invalid VcvtVariant enum."); |
2457 } | 2504 } |
2458 } // end of anonymous namespace | 2505 } // end of anonymous namespace |
2459 | 2506 |
2460 void InstARM32Vcvt::emit(const Cfg *Func) const { | 2507 void InstARM32Vcvt::emit(const Cfg *Func) const { |
2461 if (!BuildDefs::dump()) | 2508 if (!BuildDefs::dump()) |
2462 return; | 2509 return; |
2463 Ostream &Str = Func->getContext()->getStrEmit(); | 2510 Ostream &Str = Func->getContext()->getStrEmit(); |
2464 assert(getSrcSize() == 1); | 2511 assert(getSrcSize() == 1); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2496 break; | 2543 break; |
2497 case Ui2d: | 2544 case Ui2d: |
2498 Asm->vcvtdu(getDest(), getSrc(0), getPredicate()); | 2545 Asm->vcvtdu(getDest(), getSrc(0), getPredicate()); |
2499 break; | 2546 break; |
2500 case S2d: | 2547 case S2d: |
2501 Asm->vcvtds(getDest(), getSrc(0), getPredicate()); | 2548 Asm->vcvtds(getDest(), getSrc(0), getPredicate()); |
2502 break; | 2549 break; |
2503 case D2s: | 2550 case D2s: |
2504 Asm->vcvtsd(getDest(), getSrc(0), getPredicate()); | 2551 Asm->vcvtsd(getDest(), getSrc(0), getPredicate()); |
2505 break; | 2552 break; |
| 2553 case Vs2si: |
| 2554 Asm->vcvtqsi(getDest(), getSrc(0)); |
| 2555 break; |
| 2556 case Vs2ui: |
| 2557 Asm->vcvtqsu(getDest(), getSrc(0)); |
| 2558 break; |
| 2559 case Vsi2s: |
| 2560 Asm->vcvtqis(getDest(), getSrc(0)); |
| 2561 break; |
| 2562 case Vui2s: |
| 2563 Asm->vcvtqus(getDest(), getSrc(0)); |
| 2564 break; |
2506 } | 2565 } |
2507 assert(!Asm->needsTextFixup()); | 2566 assert(!Asm->needsTextFixup()); |
2508 } | 2567 } |
2509 | 2568 |
2510 void InstARM32Vcvt::dump(const Cfg *Func) const { | 2569 void InstARM32Vcvt::dump(const Cfg *Func) const { |
2511 if (!BuildDefs::dump()) | 2570 if (!BuildDefs::dump()) |
2512 return; | 2571 return; |
2513 Ostream &Str = Func->getContext()->getStrDump(); | 2572 Ostream &Str = Func->getContext()->getStrDump(); |
2514 dumpDest(Func); | 2573 dumpDest(Func); |
2515 Str << " = " | 2574 Str << " = " |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2906 template class InstARM32ThreeAddrGPR<InstARM32::Udiv>; | 2965 template class InstARM32ThreeAddrGPR<InstARM32::Udiv>; |
2907 | 2966 |
2908 template class InstARM32ThreeAddrFP<InstARM32::Vadd>; | 2967 template class InstARM32ThreeAddrFP<InstARM32::Vadd>; |
2909 template class InstARM32ThreeAddrFP<InstARM32::Vdiv>; | 2968 template class InstARM32ThreeAddrFP<InstARM32::Vdiv>; |
2910 template class InstARM32ThreeAddrFP<InstARM32::Veor>; | 2969 template class InstARM32ThreeAddrFP<InstARM32::Veor>; |
2911 template class InstARM32FourAddrFP<InstARM32::Vmla>; | 2970 template class InstARM32FourAddrFP<InstARM32::Vmla>; |
2912 template class InstARM32FourAddrFP<InstARM32::Vmls>; | 2971 template class InstARM32FourAddrFP<InstARM32::Vmls>; |
2913 template class InstARM32ThreeAddrFP<InstARM32::Vmul>; | 2972 template class InstARM32ThreeAddrFP<InstARM32::Vmul>; |
2914 template class InstARM32UnaryopSignAwareFP<InstARM32::Vneg>; | 2973 template class InstARM32UnaryopSignAwareFP<InstARM32::Vneg>; |
2915 template class InstARM32ThreeAddrSignAwareFP<InstARM32::Vshl>; | 2974 template class InstARM32ThreeAddrSignAwareFP<InstARM32::Vshl>; |
| 2975 template class InstARM32ThreeAddrSignAwareFP<InstARM32::Vshr>; |
2916 template class InstARM32ThreeAddrFP<InstARM32::Vsub>; | 2976 template class InstARM32ThreeAddrFP<InstARM32::Vsub>; |
2917 | 2977 |
2918 template class InstARM32LoadBase<InstARM32::Ldr>; | 2978 template class InstARM32LoadBase<InstARM32::Ldr>; |
2919 template class InstARM32LoadBase<InstARM32::Ldrex>; | 2979 template class InstARM32LoadBase<InstARM32::Ldrex>; |
2920 | 2980 |
2921 template class InstARM32TwoAddrGPR<InstARM32::Movt>; | 2981 template class InstARM32TwoAddrGPR<InstARM32::Movt>; |
2922 | 2982 |
2923 template class InstARM32UnaryopGPR<InstARM32::Movw, false>; | 2983 template class InstARM32UnaryopGPR<InstARM32::Movw, false>; |
2924 template class InstARM32UnaryopGPR<InstARM32::Clz, false>; | 2984 template class InstARM32UnaryopGPR<InstARM32::Clz, false>; |
2925 template class InstARM32UnaryopGPR<InstARM32::Mvn, false>; | 2985 template class InstARM32UnaryopGPR<InstARM32::Mvn, false>; |
2926 template class InstARM32UnaryopGPR<InstARM32::Rbit, false>; | 2986 template class InstARM32UnaryopGPR<InstARM32::Rbit, false>; |
2927 template class InstARM32UnaryopGPR<InstARM32::Rev, false>; | 2987 template class InstARM32UnaryopGPR<InstARM32::Rev, false>; |
2928 template class InstARM32UnaryopGPR<InstARM32::Sxt, true>; | 2988 template class InstARM32UnaryopGPR<InstARM32::Sxt, true>; |
2929 template class InstARM32UnaryopGPR<InstARM32::Uxt, true>; | 2989 template class InstARM32UnaryopGPR<InstARM32::Uxt, true>; |
2930 template class InstARM32UnaryopFP<InstARM32::Vsqrt>; | 2990 template class InstARM32UnaryopFP<InstARM32::Vsqrt>; |
2931 | 2991 |
2932 template class InstARM32FourAddrGPR<InstARM32::Mla>; | 2992 template class InstARM32FourAddrGPR<InstARM32::Mla>; |
2933 template class InstARM32FourAddrGPR<InstARM32::Mls>; | 2993 template class InstARM32FourAddrGPR<InstARM32::Mls>; |
2934 | 2994 |
2935 template class InstARM32CmpLike<InstARM32::Cmn>; | 2995 template class InstARM32CmpLike<InstARM32::Cmn>; |
2936 template class InstARM32CmpLike<InstARM32::Cmp>; | 2996 template class InstARM32CmpLike<InstARM32::Cmp>; |
2937 template class InstARM32CmpLike<InstARM32::Tst>; | 2997 template class InstARM32CmpLike<InstARM32::Tst>; |
2938 | 2998 |
2939 } // end of namespace ARM32 | 2999 } // end of namespace ARM32 |
2940 } // end of namespace Ice | 3000 } // end of namespace Ice |
OLD | NEW |