Skip to content

Commit

Permalink
[CIR][ABI] Add AArch64 singed integer and floating point CC lowering (l…
Browse files Browse the repository at this point in the history
  • Loading branch information
sitio-couto authored and lanza committed Oct 2, 2024
1 parent af619a8 commit 843f553
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ mlir::Type LowerTypes::convertType(Type T) {
/// keeping it here for parity's sake.

// Certain CIR types are already ABI-specific, so we just return them.
if (isa<BoolType, IntType>(T)) {
if (isa<BoolType, IntType, SingleType, DoubleType>(T)) {
return T;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,46 @@ unsigned long long ULongLong(unsigned long long l) {
// CHECK: cir.call @_Z9ULongLongy(%2) : (!u64i) -> !u64i
return ULongLong(l);
}


/// Test call conv lowering for trivial signed cases. ///

// CHECK: cir.func @_Z4Chara(%arg0: !s8i loc({{.+}})) -> !s8i
char Char(signed char c) {
// CHECK: cir.call @_Z4Chara(%{{.+}}) : (!s8i) -> !s8i
return Char(c);
}
// CHECK: cir.func @_Z5Shorts(%arg0: !s16i loc({{.+}})) -> !s16i
short Short(short s) {
// CHECK: cir.call @_Z5Shorts(%{{.+}}) : (!s16i) -> !s16i
return Short(s);
}
// CHECK: cir.func @_Z3Inti(%arg0: !s32i loc({{.+}})) -> !s32i
int Int(int i) {
// CHECK: cir.call @_Z3Inti(%{{.+}}) : (!s32i) -> !s32i
return Int(i);
}
// CHECK: cir.func @_Z4Longl(%arg0: !s64i loc({{.+}})) -> !s64i
long Long(long l) {
// CHECK: cir.call @_Z4Longl(%{{.+}}) : (!s64i) -> !s64i
return Long(l);
}
// CHECK: cir.func @_Z8LongLongx(%arg0: !s64i loc({{.+}})) -> !s64i
long long LongLong(long long l) {
// CHECK: cir.call @_Z8LongLongx(%{{.+}}) : (!s64i) -> !s64i
return LongLong(l);
}


/// Test call conv lowering for floating point. ///

// CHECK: cir.func @_Z5Floatf(%arg0: !cir.float loc({{.+}})) -> !cir.float
float Float(float f) {
// cir.call @_Z5Floatf(%{{.+}}) : (!cir.float) -> !cir.float
return Float(f);
}
// CHECK: cir.func @_Z6Doubled(%arg0: !cir.double loc({{.+}})) -> !cir.double
double Double(double d) {
// cir.call @_Z6Doubled(%{{.+}}) : (!cir.double) -> !cir.double
return Double(d);
}

0 comments on commit 843f553

Please sign in to comment.