1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Add new built-in operations for vmull and vmull_n

so they can be implemented without requiring clang builtins.
Radar 8446238.

llvm-svn: 121173
This commit is contained in:
Bob Wilson 2010-12-07 20:02:45 +00:00
parent 0295c17fbc
commit 8079f3377d
2 changed files with 22 additions and 0 deletions

View File

@ -508,6 +508,15 @@ static std::string GenMacroLocals(const std::string &proto, StringRef typestr) {
return s; return s;
} }
// Use the vmovl builtin to sign-extend or zero-extend a vector.
static std::string Extend(const std::string &proto, StringRef typestr,
const std::string &a) {
std::string s;
s = MangleName("vmovl", typestr, ClassS);
s += "(" + a + ")";
return s;
}
static std::string Duplicate(unsigned nElts, StringRef typestr, static std::string Duplicate(unsigned nElts, StringRef typestr,
const std::string &a) { const std::string &a) {
std::string s; std::string s;
@ -587,6 +596,15 @@ static std::string GenOpString(OpKind op, const std::string &proto,
case OpMul: case OpMul:
s += "__a * __b;"; s += "__a * __b;";
break; break;
case OpMullN:
s += Extend(proto, typestr, "__a") + " * " +
Extend(proto, typestr,
Duplicate(nElts << (int)quad, typestr, "__b")) + ";";
break;
case OpMull:
s += Extend(proto, typestr, "__a") + " * " +
Extend(proto, typestr, "__b") + ";";
break;
case OpMlaN: case OpMlaN:
s += "__a + (__b * " + Duplicate(nElts, typestr, "__c") + ");"; s += "__a + (__b * " + Duplicate(nElts, typestr, "__c") + ");";
break; break;

View File

@ -26,9 +26,11 @@ enum OpKind {
OpAdd, OpAdd,
OpSub, OpSub,
OpMul, OpMul,
OpMull,
OpMla, OpMla,
OpMls, OpMls,
OpMulN, OpMulN,
OpMullN,
OpMlaN, OpMlaN,
OpMlsN, OpMlsN,
OpMulLane, OpMulLane,
@ -79,9 +81,11 @@ namespace llvm {
OpMap["OP_ADD"] = OpAdd; OpMap["OP_ADD"] = OpAdd;
OpMap["OP_SUB"] = OpSub; OpMap["OP_SUB"] = OpSub;
OpMap["OP_MUL"] = OpMul; OpMap["OP_MUL"] = OpMul;
OpMap["OP_MULL"] = OpMull;
OpMap["OP_MLA"] = OpMla; OpMap["OP_MLA"] = OpMla;
OpMap["OP_MLS"] = OpMls; OpMap["OP_MLS"] = OpMls;
OpMap["OP_MUL_N"] = OpMulN; OpMap["OP_MUL_N"] = OpMulN;
OpMap["OP_MULL_N"]= OpMullN;
OpMap["OP_MLA_N"] = OpMlaN; OpMap["OP_MLA_N"] = OpMlaN;
OpMap["OP_MLS_N"] = OpMlsN; OpMap["OP_MLS_N"] = OpMlsN;
OpMap["OP_MUL_LN"]= OpMulLane; OpMap["OP_MUL_LN"]= OpMulLane;