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

Side by Side Diff: src/IceTargetLoweringARM32.cpp

Issue 1211243005: ARM: lowerSelect for integers. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 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 | « src/IceTargetLowering.cpp ('k') | tests_lit/llvm2ice_tests/64bit.pnacl.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/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 // This file implements the TargetLoweringARM32 class, which consists almost 10 // This file implements the TargetLoweringARM32 class, which consists almost
(...skipping 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after
2002 // Add a fake use of sp to make sure sp stays alive for the entire 2002 // Add a fake use of sp to make sure sp stays alive for the entire
2003 // function. Otherwise post-call sp adjustments get dead-code 2003 // function. Otherwise post-call sp adjustments get dead-code
2004 // eliminated. TODO: Are there more places where the fake use 2004 // eliminated. TODO: Are there more places where the fake use
2005 // should be inserted? E.g. "void f(int n){while(1) g(n);}" may not 2005 // should be inserted? E.g. "void f(int n){while(1) g(n);}" may not
2006 // have a ret instruction. 2006 // have a ret instruction.
2007 Variable *SP = Func->getTarget()->getPhysicalRegister(RegARM32::Reg_sp); 2007 Variable *SP = Func->getTarget()->getPhysicalRegister(RegARM32::Reg_sp);
2008 Context.insert(InstFakeUse::create(Func, SP)); 2008 Context.insert(InstFakeUse::create(Func, SP));
2009 } 2009 }
2010 2010
2011 void TargetARM32::lowerSelect(const InstSelect *Inst) { 2011 void TargetARM32::lowerSelect(const InstSelect *Inst) {
2012 (void)Inst; 2012 Variable *Dest = Inst->getDest();
2013 UnimplementedError(Func->getContext()->getFlags()); 2013 Type DestTy = Dest->getType();
2014 Operand *SrcT = Inst->getTrueOperand();
2015 Operand *SrcF = Inst->getFalseOperand();
2016 Operand *Condition = Inst->getCondition();
2017
2018 if (isVectorType(DestTy)) {
2019 UnimplementedError(Func->getContext()->getFlags());
2020 return;
2021 }
2022 if (isFloatingType(DestTy)) {
2023 UnimplementedError(Func->getContext()->getFlags());
2024 return;
2025 }
2026 // TODO(jvoung): handle folding opportunities.
2027 // cmp cond, #0; mov t, SrcF; mov_cond t, SrcT; mov dest, t
2028 Variable *CmpOpnd0 = legalizeToVar(Condition);
2029 Operand *CmpOpnd1 = Ctx->getConstantZero(IceType_i32);
2030 _cmp(CmpOpnd0, CmpOpnd1);
2031 CondARM32::Cond Cond = CondARM32::NE;
2032 if (DestTy == IceType_i64) {
2033 // Set the low portion.
2034 Variable *DestLo = llvm::cast<Variable>(loOperand(Dest));
2035 Variable *TLo = nullptr;
2036 Operand *SrcFLo = legalize(loOperand(SrcF), Legal_Reg | Legal_Flex);
2037 _mov(TLo, SrcFLo);
2038 Operand *SrcTLo = legalize(loOperand(SrcT), Legal_Reg | Legal_Flex);
2039 _mov_nonkillable(TLo, SrcTLo, Cond);
2040 _mov(DestLo, TLo);
2041 // Set the high portion.
2042 Variable *DestHi = llvm::cast<Variable>(hiOperand(Dest));
2043 Variable *THi = nullptr;
2044 Operand *SrcFHi = legalize(hiOperand(SrcF), Legal_Reg | Legal_Flex);
2045 _mov(THi, SrcFHi);
2046 Operand *SrcTHi = legalize(hiOperand(SrcT), Legal_Reg | Legal_Flex);
2047 _mov_nonkillable(THi, SrcTHi, Cond);
2048 _mov(DestHi, THi);
2049 return;
2050 }
2051 Variable *T = nullptr;
2052 SrcF = legalize(SrcF, Legal_Reg | Legal_Flex);
2053 _mov(T, SrcF);
2054 SrcT = legalize(SrcT, Legal_Reg | Legal_Flex);
2055 _mov_nonkillable(T, SrcT, Cond);
2056 _mov(Dest, T);
2014 } 2057 }
2015 2058
2016 void TargetARM32::lowerStore(const InstStore *Inst) { 2059 void TargetARM32::lowerStore(const InstStore *Inst) {
2017 Operand *Value = Inst->getData(); 2060 Operand *Value = Inst->getData();
2018 Operand *Addr = Inst->getAddr(); 2061 Operand *Addr = Inst->getAddr();
2019 OperandARM32Mem *NewAddr = formMemoryOperand(Addr, Value->getType()); 2062 OperandARM32Mem *NewAddr = formMemoryOperand(Addr, Value->getType());
2020 Type Ty = NewAddr->getType(); 2063 Type Ty = NewAddr->getType();
2021 2064
2022 if (Ty == IceType_i64) { 2065 if (Ty == IceType_i64) {
2023 Variable *ValueHi = legalizeToVar(hiOperand(Value)); 2066 Variable *ValueHi = legalizeToVar(hiOperand(Value));
(...skipping 26 matching lines...) Expand all
2050 Operand *ValueHi = Ctx->getConstantInt32(Inst->getValue(I) >> 32); 2093 Operand *ValueHi = Ctx->getConstantInt32(Inst->getValue(I) >> 32);
2051 ValueLo = legalize(ValueLo, Legal_Reg | Legal_Flex); 2094 ValueLo = legalize(ValueLo, Legal_Reg | Legal_Flex);
2052 ValueHi = legalize(ValueHi, Legal_Reg | Legal_Flex); 2095 ValueHi = legalize(ValueHi, Legal_Reg | Legal_Flex);
2053 _cmp(Src0Lo, ValueLo); 2096 _cmp(Src0Lo, ValueLo);
2054 _cmp(Src0Hi, ValueHi, CondARM32::EQ); 2097 _cmp(Src0Hi, ValueHi, CondARM32::EQ);
2055 _br(Inst->getLabel(I), CondARM32::EQ); 2098 _br(Inst->getLabel(I), CondARM32::EQ);
2056 } 2099 }
2057 _br(Inst->getLabelDefault()); 2100 _br(Inst->getLabelDefault());
2058 return; 2101 return;
2059 } 2102 }
2060 2103
2061 // 32 bit integer 2104 // 32 bit integer
2062 Variable *Src0Var = legalizeToVar(Src0); 2105 Variable *Src0Var = legalizeToVar(Src0);
2063 for (SizeT I = 0; I < NumCases; ++I) { 2106 for (SizeT I = 0; I < NumCases; ++I) {
2064 Operand *Value = Ctx->getConstantInt32(Inst->getValue(I)); 2107 Operand *Value = Ctx->getConstantInt32(Inst->getValue(I));
2065 Value = legalize(Value, Legal_Reg | Legal_Flex); 2108 Value = legalize(Value, Legal_Reg | Legal_Flex);
2066 _cmp(Src0Var, Value); 2109 _cmp(Src0Var, Value);
2067 _br(Inst->getLabel(I), CondARM32::EQ); 2110 _br(Inst->getLabel(I), CondARM32::EQ);
2068 } 2111 }
2069 _br(Inst->getLabelDefault()); 2112 _br(Inst->getLabelDefault());
2070 } 2113 }
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
2406 << ".eabi_attribute 36, 1 @ Tag_FP_HP_extension\n" 2449 << ".eabi_attribute 36, 1 @ Tag_FP_HP_extension\n"
2407 << ".eabi_attribute 38, 1 @ Tag_ABI_FP_16bit_format\n" 2450 << ".eabi_attribute 38, 1 @ Tag_ABI_FP_16bit_format\n"
2408 << ".eabi_attribute 42, 1 @ Tag_MPextension_use\n" 2451 << ".eabi_attribute 42, 1 @ Tag_MPextension_use\n"
2409 << ".eabi_attribute 68, 1 @ Tag_Virtualization_use\n"; 2452 << ".eabi_attribute 68, 1 @ Tag_Virtualization_use\n";
2410 // Technically R9 is used for TLS with Sandboxing, and we reserve it. 2453 // Technically R9 is used for TLS with Sandboxing, and we reserve it.
2411 // However, for compatibility with current NaCl LLVM, don't claim that. 2454 // However, for compatibility with current NaCl LLVM, don't claim that.
2412 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; 2455 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n";
2413 } 2456 }
2414 2457
2415 } // end of namespace Ice 2458 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLowering.cpp ('k') | tests_lit/llvm2ice_tests/64bit.pnacl.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698