[llvm-commits] [llvm-gcc-4.2] r103275 - /llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp
Bob Wilson
bob.wilson at apple.com
Fri May 7 11:14:28 PDT 2010
Author: bwilson
Date: Fri May 7 13:14:27 2010
New Revision: 103275
URL: http://llvm.org/viewvc/llvm-project?rev=103275&view=rev
Log:
Use fadd, fsub, etc. for floating-point operations.
Modified:
llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp
Modified: llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp?rev=103275&r1=103274&r2=103275&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp Fri May 7 13:14:27 2010
@@ -781,7 +781,10 @@
case NEON_BUILTIN_vadd:
if (datatype == neon_datatype_polynomial)
return BadImmediateError(exp, Result);
- Result = Builder.CreateAdd(Ops[0], Ops[1]);
+ if (datatype == neon_datatype_float)
+ Result = Builder.CreateFAdd(Ops[0], Ops[1]);
+ else
+ Result = Builder.CreateAdd(Ops[0], Ops[1]);
break;
case NEON_BUILTIN_vaddl:
@@ -868,7 +871,9 @@
intID = Intrinsic::arm_neon_vmulp;
intFn = Intrinsic::getDeclaration(TheModule, intID, &ResultType, 1);
Result = Builder.CreateCall2(intFn, Ops[0], Ops[1]);
- } else
+ } else if (datatype == neon_datatype_float)
+ Result = Builder.CreateFMul(Ops[0], Ops[1]);
+ else
Result = Builder.CreateMul(Ops[0], Ops[1]);
break;
@@ -886,7 +891,10 @@
}
if (datatype == neon_datatype_polynomial)
return BadImmediateError(exp, Result);
- Result = Builder.CreateAdd(Ops[0], Builder.CreateMul(Ops[1], Ops[2]));
+ if (datatype == neon_datatype_float)
+ Result = Builder.CreateFAdd(Ops[0], Builder.CreateFMul(Ops[1], Ops[2]));
+ else
+ Result = Builder.CreateAdd(Ops[0], Builder.CreateMul(Ops[1], Ops[2]));
break;
case NEON_BUILTIN_vmls_lane:
@@ -903,7 +911,10 @@
}
if (datatype == neon_datatype_polynomial)
return BadImmediateError(exp, Result);
- Result = Builder.CreateSub(Ops[0], Builder.CreateMul(Ops[1], Ops[2]));
+ if (datatype == neon_datatype_float)
+ Result = Builder.CreateFSub(Ops[0], Builder.CreateFMul(Ops[1], Ops[2]));
+ else
+ Result = Builder.CreateSub(Ops[0], Builder.CreateMul(Ops[1], Ops[2]));
break;
case NEON_BUILTIN_vmlal_lane:
@@ -1233,7 +1244,10 @@
case NEON_BUILTIN_vsub:
if (datatype == neon_datatype_polynomial)
return BadImmediateError(exp, Result);
- Result = Builder.CreateSub(Ops[0], Ops[1]);
+ if (datatype == neon_datatype_float)
+ Result = Builder.CreateFSub(Ops[0], Ops[1]);
+ else
+ Result = Builder.CreateSub(Ops[0], Ops[1]);
break;
case NEON_BUILTIN_vsubl:
@@ -1573,7 +1587,10 @@
if (datatype != neon_datatype_signed &&
datatype != neon_datatype_float)
return BadImmediateError(exp, Result);
- Result = Builder.CreateNeg(Ops[0]);
+ if (datatype == neon_datatype_float)
+ Result = Builder.CreateFNeg(Ops[0]);
+ else
+ Result = Builder.CreateNeg(Ops[0]);
break;
case NEON_BUILTIN_vqneg:
More information about the llvm-commits
mailing list