aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_abi.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-04-01 10:06:00 +0100
committergingerBill <bill@gingerbill.org>2021-04-01 10:06:00 +0100
commit54e6c507698bf68b040400783f05686cacaddff1 (patch)
treeebe699d8a059f4e76e0a99494823d4cc3e3bcc1d /src/llvm_abi.cpp
parenta00d7cc705668da8a8b1a6ebd52668b5e9087bb9 (diff)
Implement `f16` functionality
Diffstat (limited to 'src/llvm_abi.cpp')
-rw-r--r--src/llvm_abi.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp
index 5c72c0345..65e3b2c58 100644
--- a/src/llvm_abi.cpp
+++ b/src/llvm_abi.cpp
@@ -158,6 +158,8 @@ i64 lb_sizeof(LLVMTypeRef type) {
unsigned w = LLVMGetIntTypeWidth(type);
return (w + 7)/8;
}
+ case LLVMHalfTypeKind:
+ return 2;
case LLVMFloatTypeKind:
return 4;
case LLVMDoubleTypeKind:
@@ -222,6 +224,8 @@ i64 lb_alignof(LLVMTypeRef type) {
unsigned w = LLVMGetIntTypeWidth(type);
return gb_clamp((w + 7)/8, 1, build_context.max_align);
}
+ case LLVMHalfTypeKind:
+ return 2;
case LLVMFloatTypeKind:
return 4;
case LLVMDoubleTypeKind:
@@ -584,6 +588,7 @@ namespace lbAbiAmd64SysV {
LLVMTypeKind kind = LLVMGetTypeKind(type);
switch (kind) {
case LLVMIntegerTypeKind:
+ case LLVMHalfTypeKind:
case LLVMFloatTypeKind:
case LLVMDoubleTypeKind:
case LLVMPointerTypeKind:
@@ -799,6 +804,7 @@ namespace lbAbiAmd64SysV {
switch (LLVMGetTypeKind(t)) {
case LLVMIntegerTypeKind:
case LLVMPointerTypeKind:
+ case LLVMHalfTypeKind:
unify(cls, ix + off/8, RegClass_Int);
break;
case LLVMFloatTypeKind:
@@ -842,6 +848,7 @@ namespace lbAbiAmd64SysV {
RegClass reg = RegClass_NoClass;
switch (elem_kind) {
case LLVMIntegerTypeKind:
+ case LLVMHalfTypeKind:
switch (LLVMGetIntTypeWidth(elem)) {
case 8: reg = RegClass_SSEInt8;
case 16: reg = RegClass_SSEInt16;
@@ -934,6 +941,7 @@ namespace lbAbiArm64 {
LLVMTypeKind kind = LLVMGetTypeKind(type);
switch (kind) {
case LLVMIntegerTypeKind:
+ case LLVMHalfTypeKind:
case LLVMFloatTypeKind:
case LLVMDoubleTypeKind:
case LLVMPointerTypeKind: