[TRITON][LANG] Added support for bitcast

This commit is contained in:
Philippe Tillet
2020-02-09 20:09:27 -05:00
parent 0767c27b3b
commit a099c6f7f3
8 changed files with 42 additions and 3 deletions

View File

@@ -646,6 +646,9 @@ void UnaryOp::TypeChecking() {
case '!':
return UnaryArithmOpTypeChecking();
case Token::BITCAST:
return BitcastOpTypeChecking();
case Token::CAST:
return CastOpTypeChecking();
@@ -722,6 +725,11 @@ void UnaryOp::UnaryArithmOpTypeChecking() {
}
}
void UnaryOp::BitcastOpTypeChecking() {
auto operandType = Type::MayCast(operand_->Type());
if(type_->Width() != operandType->Width())
Error(this, "cannot bitcast to type of different width");
}
void UnaryOp::CastOpTypeChecking() {
auto operandType = Type::MayCast(operand_->Type());