[TRITON][LANG] Added support for bitcast

This commit is contained in:
Philippe Tillet
2020-02-09 20:09:27 -05:00
committed by Philippe Tillet
parent 7a40077bfd
commit d22cf4f717
8 changed files with 42 additions and 3 deletions

View File

@@ -197,7 +197,8 @@ void Generator::VisitUnaryOp(UnaryOp* unary) {
case Token::MINUS: return set_ret(GenUnaryMinus(arg));
case '~': return error_not_implemented();
case '!': return error_not_implemented();
case Token::CAST: return set_ret(GenCastOp(arg, GenIRType(unary->Type(), *ctx_)));
case Token::BITCAST: return set_ret(GenBitCastOp(arg, GenIRType(unary->Type(), *ctx_)));
case Token::CAST: return set_ret(GenSemCastOp(arg, GenIRType(unary->Type(), *ctx_)));
case Token::REDUCE: {
int ax, tag;
UnaryOp::decodeRed(unary->info_, ax, tag);
@@ -579,10 +580,15 @@ ir::value* Generator::GenNumcastOp(ir::value*src, ir::type* dst_ty) {
}
}
ir::value* Generator::GenCastOp(ir::value* src, ir::type* dst_ty) {
ir::value* Generator::GenSemCastOp(ir::value* src, ir::type* dst_ty) {
return GenNumcastOp(GenBroadcastOp(src, dst_ty), dst_ty);
}
ir::value* Generator::GenBitCastOp(ir::value* src, ir::type* dst_ty) {
return bld_->create_cast(ir::BitCast, GenBroadcastOp(src, dst_ty), dst_ty);
}
// Triton-IR Attr
ir::attribute Generator::GenIRAttr(ASTNode::Attr attr) {
if(attr.kind == ASTNode::Attr::MULTIPLEOF) {