[llvm-commits] [llvm-gcc-4.2] r112772 - /llvm-gcc-4.2/trunk/gcc/config/arm/llvm-arm.cpp
Bob Wilson
bob.wilson at apple.com
Wed Sep 1 16:46:59 PDT 2010
Author: bwilson
Date: Wed Sep 1 18:46:58 2010
New Revision: 112772
URL: http://llvm.org/viewvc/llvm-project?rev=112772&view=rev
Log:
Translate NEON vmull, vmlal, and vmlsl builtins to llvm multiply-add/sub with
zext/sext operations, instead of to llvm intrinsics.
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=112772&r1=112771&r2=112772&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 Wed Sep 1 18:46:58 2010
@@ -929,15 +929,17 @@
return UnexpectedError("%Hinvalid lane number", exp, Result);
Ops[2] = BuildDupLane(Ops[2], LaneVal, NUnits, Builder);
}
- if (datatype == neon_datatype_signed)
- intID = Intrinsic::arm_neon_vmlals;
- else if (datatype == neon_datatype_unsigned)
- intID = Intrinsic::arm_neon_vmlalu;
- else
+ if (datatype == neon_datatype_signed) {
+ Ops[1] = Builder.CreateSExt(Ops[1], ResultType);
+ Ops[2] = Builder.CreateSExt(Ops[2], ResultType);
+ } else if (datatype == neon_datatype_unsigned) {
+ Ops[1] = Builder.CreateZExt(Ops[1], ResultType);
+ Ops[2] = Builder.CreateZExt(Ops[2], ResultType);
+ } else
return BadImmediateError(exp, Result);
- intFn = Intrinsic::getDeclaration(TheModule, intID, &ResultType, 1);
- Result = Builder.CreateCall3(intFn, Ops[0], Ops[1], Ops[2]);
+ Ops[1] = Builder.CreateMul(Ops[1], Ops[2]);
+ Result = Builder.CreateAdd(Ops[0], Ops[1]);
break;
case NEON_BUILTIN_vmlsl_lane:
@@ -952,15 +954,17 @@
return UnexpectedError("%Hinvalid lane number", exp, Result);
Ops[2] = BuildDupLane(Ops[2], LaneVal, NUnits, Builder);
}
- if (datatype == neon_datatype_signed)
- intID = Intrinsic::arm_neon_vmlsls;
- else if (datatype == neon_datatype_unsigned)
- intID = Intrinsic::arm_neon_vmlslu;
- else
+ if (datatype == neon_datatype_signed) {
+ Ops[1] = Builder.CreateSExt(Ops[1], ResultType);
+ Ops[2] = Builder.CreateSExt(Ops[2], ResultType);
+ } else if (datatype == neon_datatype_unsigned) {
+ Ops[1] = Builder.CreateZExt(Ops[1], ResultType);
+ Ops[2] = Builder.CreateZExt(Ops[2], ResultType);
+ } else
return BadImmediateError(exp, Result);
- intFn = Intrinsic::getDeclaration(TheModule, intID, &ResultType, 1);
- Result = Builder.CreateCall3(intFn, Ops[0], Ops[1], Ops[2]);
+ Ops[1] = Builder.CreateMul(Ops[1], Ops[2]);
+ Result = Builder.CreateSub(Ops[0], Ops[1]);
break;
case NEON_BUILTIN_vqdmulh_lane:
@@ -1040,17 +1044,22 @@
return UnexpectedError("%Hinvalid lane number", exp, Result);
Ops[1] = BuildDupLane(Ops[1], LaneVal, NUnits, Builder);
}
- if (datatype == neon_datatype_polynomial)
+ if (datatype == neon_datatype_polynomial) {
intID = Intrinsic::arm_neon_vmullp;
- else if (datatype == neon_datatype_signed)
- intID = Intrinsic::arm_neon_vmulls;
- else if (datatype == neon_datatype_unsigned)
- intID = Intrinsic::arm_neon_vmullu;
- else
+ intFn = Intrinsic::getDeclaration(TheModule, intID, &ResultType, 1);
+ Result = Builder.CreateCall2(intFn, Ops[0], Ops[1]);
+ break;
+ }
+ if (datatype == neon_datatype_signed) {
+ Ops[0] = Builder.CreateSExt(Ops[0], ResultType);
+ Ops[1] = Builder.CreateSExt(Ops[1], ResultType);
+ } else if (datatype == neon_datatype_unsigned) {
+ Ops[0] = Builder.CreateZExt(Ops[0], ResultType);
+ Ops[1] = Builder.CreateZExt(Ops[1], ResultType);
+ } else
return BadImmediateError(exp, Result);
- intFn = Intrinsic::getDeclaration(TheModule, intID, &ResultType, 1);
- Result = Builder.CreateCall2(intFn, Ops[0], Ops[1]);
+ Result = Builder.CreateMul(Ops[0], Ops[1]);
break;
case NEON_BUILTIN_vqdmull_n:
More information about the llvm-commits
mailing list