Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/IceTargetLoweringX8632.cpp

Issue 402253002: Use lowerCast instead of inlined _movzx, to get legalization, for memset. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 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 // This file implements the TargetLoweringX8632 class, which 10 // This file implements the TargetLoweringX8632 class, which
(...skipping 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 // is used. 2094 // is used.
2095 Context.insert(InstFakeDef::create(Func, Spill)); 2095 Context.insert(InstFakeDef::create(Func, Spill));
2096 _store(T_Lo, SpillLo); 2096 _store(T_Lo, SpillLo);
2097 _mov(T_Hi, hiOperand(Src0)); 2097 _mov(T_Hi, hiOperand(Src0));
2098 _store(T_Hi, SpillHi); 2098 _store(T_Hi, SpillHi);
2099 _movq(Dest, Spill); 2099 _movq(Dest, Spill);
2100 } break; 2100 } break;
2101 case IceType_v8i1: { 2101 case IceType_v8i1: {
2102 assert(Src0->getType() == IceType_i8); 2102 assert(Src0->getType() == IceType_i8);
2103 InstCall *Call = makeHelperCall("Sz_bitcast_i8_to_v8i1", Dest, 1); 2103 InstCall *Call = makeHelperCall("Sz_bitcast_i8_to_v8i1", Dest, 1);
2104 Variable *Src0AsI32 = Func->makeVariable(IceType_i32, Context.getNode()); 2104 Variable *Src0AsI32 = Func->makeVariable(stackSlotType(),
2105 Context.getNode());
2105 // Arguments to functions are required to be at least 32 bits wide. 2106 // Arguments to functions are required to be at least 32 bits wide.
2106 lowerCast(InstCast::create(Func, InstCast::Zext, Src0AsI32, Src0)); 2107 lowerCast(InstCast::create(Func, InstCast::Zext, Src0AsI32, Src0));
2107 Call->addArg(Src0AsI32); 2108 Call->addArg(Src0AsI32);
2108 lowerCall(Call); 2109 lowerCall(Call);
2109 } break; 2110 } break;
2110 case IceType_v16i1: { 2111 case IceType_v16i1: {
2111 assert(Src0->getType() == IceType_i16); 2112 assert(Src0->getType() == IceType_i16);
2112 InstCall *Call = makeHelperCall("Sz_bitcast_i16_to_v16i1", Dest, 1); 2113 InstCall *Call = makeHelperCall("Sz_bitcast_i16_to_v16i1", Dest, 1);
2113 Variable *Src0AsI32 = Func->makeVariable(IceType_i32, Context.getNode()); 2114 Variable *Src0AsI32 = Func->makeVariable(stackSlotType(),
2115 Context.getNode());
2114 // Arguments to functions are required to be at least 32 bits wide. 2116 // Arguments to functions are required to be at least 32 bits wide.
2115 lowerCast(InstCast::create(Func, InstCast::Zext, Src0AsI32, Src0)); 2117 lowerCast(InstCast::create(Func, InstCast::Zext, Src0AsI32, Src0));
2116 Call->addArg(Src0AsI32); 2118 Call->addArg(Src0AsI32);
2117 lowerCall(Call); 2119 lowerCall(Call);
2118 } break; 2120 } break;
2119 case IceType_v8i16: 2121 case IceType_v8i16:
2120 case IceType_v16i8: 2122 case IceType_v16i8:
2121 case IceType_v4i32: 2123 case IceType_v4i32:
2122 case IceType_v4f32: { 2124 case IceType_v4f32: {
2123 _movp(Dest, legalizeToVar(Src0)); 2125 _movp(Dest, legalizeToVar(Src0));
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
2701 Call->addArg(Instr->getArg(1)); 2703 Call->addArg(Instr->getArg(1));
2702 Call->addArg(Instr->getArg(2)); 2704 Call->addArg(Instr->getArg(2));
2703 lowerCall(Call); 2705 lowerCall(Call);
2704 return; 2706 return;
2705 } 2707 }
2706 case Intrinsics::Memset: { 2708 case Intrinsics::Memset: {
2707 // The value operand needs to be extended to a stack slot size 2709 // The value operand needs to be extended to a stack slot size
2708 // because "push" only works for a specific operand size. 2710 // because "push" only works for a specific operand size.
2709 Operand *ValOp = Instr->getArg(1); 2711 Operand *ValOp = Instr->getArg(1);
2710 assert(ValOp->getType() == IceType_i8); 2712 assert(ValOp->getType() == IceType_i8);
2711 Variable *ValExt = makeReg(stackSlotType()); 2713 Variable *ValExt = Func->makeVariable(stackSlotType(), Context.getNode());
2712 _movzx(ValExt, ValOp); 2714 lowerCast(InstCast::create(Func, InstCast::Zext, ValExt, ValOp));
2713 InstCall *Call = makeHelperCall("memset", NULL, 3); 2715 InstCall *Call = makeHelperCall("memset", NULL, 3);
2714 Call->addArg(Instr->getArg(0)); 2716 Call->addArg(Instr->getArg(0));
2715 Call->addArg(ValExt); 2717 Call->addArg(ValExt);
2716 Call->addArg(Instr->getArg(2)); 2718 Call->addArg(Instr->getArg(2));
2717 lowerCall(Call); 2719 lowerCall(Call);
2718 return; 2720 return;
2719 } 2721 }
2720 case Intrinsics::NaClReadTP: { 2722 case Intrinsics::NaClReadTP: {
2721 Constant *Zero = Ctx->getConstantZero(IceType_i32); 2723 Constant *Zero = Ctx->getConstantZero(IceType_i32);
2722 Operand *Src = OperandX8632Mem::create(Func, IceType_i32, NULL, Zero, NULL, 2724 Operand *Src = OperandX8632Mem::create(Func, IceType_i32, NULL, Zero, NULL,
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
3749 for (SizeT i = 0; i < Size; ++i) { 3751 for (SizeT i = 0; i < Size; ++i) {
3750 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; 3752 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n";
3751 } 3753 }
3752 Str << "\t.size\t" << MangledName << ", " << Size << "\n"; 3754 Str << "\t.size\t" << MangledName << ", " << Size << "\n";
3753 } 3755 }
3754 Str << "\t" << (IsInternal ? ".local" : ".global") << "\t" << MangledName 3756 Str << "\t" << (IsInternal ? ".local" : ".global") << "\t" << MangledName
3755 << "\n"; 3757 << "\n";
3756 } 3758 }
3757 3759
3758 } // end of namespace Ice 3760 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/nacl-other-intrinsics.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698