[llvm] [AArch64][GlobalISel] Generate libcall for s128 G_FPTRUNC (PR #96602)

Madhur Amilkanthwar via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 26 09:37:47 PDT 2024


================
@@ -50,6 +50,41 @@ entry:
   ret double %c
 }
 
+define half @fptrunc_f128_f16(fp128 %a) {
+; CHECK-SD-LABEL: fptrunc_f128_f16:
+; CHECK-SD:       // %bb.0: // %entry
+; CHECK-SD-NEXT:    str x30, [sp, #-16]! // 8-byte Folded Spill
+; CHECK-SD-NEXT:    .cfi_def_cfa_offset 16
+; CHECK-SD-NEXT:    .cfi_offset w30, -16
+; CHECK-SD-NEXT:    bl __trunctfhf2
+; CHECK-SD-NEXT:    ldr x30, [sp], #16 // 8-byte Folded Reload
+; CHECK-SD-NEXT:    ret
+;
+; CHECK-GI-LABEL: fptrunc_f128_f16:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    b __trunctfhf2
+entry:
+  %c = fptrunc fp128 %a to half
+  ret half %c
+}
+
+define float @fptrunc_f128_f32(fp128 %a) {
+; CHECK-SD-LABEL: fptrunc_f128_f32:
+; CHECK-SD:       // %bb.0: // %entry
+; CHECK-SD-NEXT:    str x30, [sp, #-16]! // 8-byte Folded Spill
+; CHECK-SD-NEXT:    .cfi_def_cfa_offset 16
+; CHECK-SD-NEXT:    .cfi_offset w30, -16
+; CHECK-SD-NEXT:    bl __trunctfsf2
+; CHECK-SD-NEXT:    ldr x30, [sp], #16 // 8-byte Folded Reload
+; CHECK-SD-NEXT:    ret
+;
+; CHECK-GI-LABEL: fptrunc_f128_f32:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    b __trunctfsf2
+entry:
+  %c = fptrunc fp128 %a to float
+  ret float %c
+}
----------------
madhur13490 wrote:

Done

https://github.com/llvm/llvm-project/pull/96602


More information about the llvm-commits mailing list