Files
TheRock/compiler/amd-llvm/llvm/test/CodeGen/AArch64/arm64-fmadd.ll
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

244 lines
8.2 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=arm64-eabi < %s | FileCheck %s
define float @fma32(float %a, float %b, float %c) nounwind readnone ssp {
; CHECK-LABEL: fma32:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fmadd s0, s0, s1, s2
; CHECK-NEXT: ret
entry:
%0 = tail call float @llvm.fma.f32(float %a, float %b, float %c)
ret float %0
}
define float @fnma32(float %a, float %b, float %c) nounwind readnone ssp {
; CHECK-LABEL: fnma32:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fnmadd s0, s0, s1, s2
; CHECK-NEXT: ret
entry:
%0 = tail call float @llvm.fma.f32(float %a, float %b, float %c)
%mul = fmul float %0, -1.000000e+00
ret float %mul
}
define float @fms32(float %a, float %b, float %c) nounwind readnone ssp {
; CHECK-LABEL: fms32:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fmsub s0, s0, s1, s2
; CHECK-NEXT: ret
entry:
%mul = fmul float %b, -1.000000e+00
%0 = tail call float @llvm.fma.f32(float %a, float %mul, float %c)
ret float %0
}
define float @fms32_com(float %a, float %b, float %c) nounwind readnone ssp {
; CHECK-LABEL: fms32_com:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fmsub s0, s1, s0, s2
; CHECK-NEXT: ret
entry:
%mul = fmul float %b, -1.000000e+00
%0 = tail call float @llvm.fma.f32(float %mul, float %a, float %c)
ret float %0
}
define float @fnms32(float %a, float %b, float %c) nounwind readnone ssp {
; CHECK-LABEL: fnms32:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fnmsub s0, s0, s1, s2
; CHECK-NEXT: ret
entry:
%mul = fmul float %c, -1.000000e+00
%0 = tail call float @llvm.fma.f32(float %a, float %b, float %mul)
ret float %0
}
define double @fma64(double %a, double %b, double %c) nounwind readnone ssp {
; CHECK-LABEL: fma64:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fmadd d0, d0, d1, d2
; CHECK-NEXT: ret
entry:
%0 = tail call double @llvm.fma.f64(double %a, double %b, double %c)
ret double %0
}
define double @fnma64(double %a, double %b, double %c) nounwind readnone ssp {
; CHECK-LABEL: fnma64:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fnmadd d0, d0, d1, d2
; CHECK-NEXT: ret
entry:
%0 = tail call double @llvm.fma.f64(double %a, double %b, double %c)
%mul = fmul double %0, -1.000000e+00
ret double %mul
}
define double @fms64(double %a, double %b, double %c) nounwind readnone ssp {
; CHECK-LABEL: fms64:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fmsub d0, d0, d1, d2
; CHECK-NEXT: ret
entry:
%mul = fneg double %b
%0 = tail call double @llvm.fma.f64(double %a, double %mul, double %c)
ret double %0
}
define double @fms64_com(double %a, double %b, double %c) nounwind readnone ssp {
; CHECK-LABEL: fms64_com:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fmsub d0, d1, d0, d2
; CHECK-NEXT: ret
entry:
%mul = fneg double %b
%0 = tail call double @llvm.fma.f64(double %mul, double %a, double %c)
ret double %0
}
define double @fnms64(double %a, double %b, double %c) nounwind readnone ssp {
; CHECK-LABEL: fnms64:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fnmsub d0, d0, d1, d2
; CHECK-NEXT: ret
entry:
%mul = fneg double %c
%0 = tail call double @llvm.fma.f64(double %a, double %b, double %mul)
ret double %0
}
define float @fma32_strict(float %a, float %b, float %c) nounwind readnone ssp strictfp {
; CHECK-LABEL: fma32_strict:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fmadd s0, s0, s1, s2
; CHECK-NEXT: ret
entry:
%0 = tail call float @llvm.experimental.constrained.fma.f32(float %a, float %b, float %c, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
ret float %0
}
define float @fnma32_strict(float %a, float %b, float %c) nounwind readnone ssp strictfp {
; CHECK-LABEL: fnma32_strict:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fnmadd s0, s0, s1, s2
; CHECK-NEXT: ret
entry:
%0 = tail call float @llvm.experimental.constrained.fma.f32(float %a, float %b, float %c, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
%neg = fneg float %0
ret float %neg
}
define float @fms32_strict(float %a, float %b, float %c) nounwind readnone ssp strictfp {
; CHECK-LABEL: fms32_strict:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fmsub s0, s0, s1, s2
; CHECK-NEXT: ret
entry:
%neg = fneg float %b
%0 = tail call float @llvm.experimental.constrained.fma.f32(float %a, float %neg, float %c, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
ret float %0
}
define float @fms32_com_strict(float %a, float %b, float %c) nounwind readnone ssp strictfp {
; CHECK-LABEL: fms32_com_strict:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fmsub s0, s0, s1, s2
; CHECK-NEXT: ret
entry:
%neg = fneg float %b
%0 = tail call float @llvm.experimental.constrained.fma.f32(float %neg, float %a, float %c, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
ret float %0
}
define float @fnms32_strict(float %a, float %b, float %c) nounwind readnone ssp strictfp {
; CHECK-LABEL: fnms32_strict:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fnmsub s0, s0, s1, s2
; CHECK-NEXT: ret
entry:
%neg = fneg float %c
%0 = tail call float @llvm.experimental.constrained.fma.f32(float %a, float %b, float %neg, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
ret float %0
}
define double @fma64_strict(double %a, double %b, double %c) nounwind readnone ssp strictfp {
; CHECK-LABEL: fma64_strict:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fmadd d0, d0, d1, d2
; CHECK-NEXT: ret
entry:
%0 = tail call double @llvm.experimental.constrained.fma.f64(double %a, double %b, double %c, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
ret double %0
}
define double @fnma64_strict(double %a, double %b, double %c) nounwind readnone ssp strictfp {
; CHECK-LABEL: fnma64_strict:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fnmadd d0, d0, d1, d2
; CHECK-NEXT: ret
entry:
%0 = tail call double @llvm.experimental.constrained.fma.f64(double %a, double %b, double %c, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
%neg = fneg double %0
ret double %neg
}
define double @fms64_strict(double %a, double %b, double %c) nounwind readnone ssp strictfp {
; CHECK-LABEL: fms64_strict:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fmsub d0, d0, d1, d2
; CHECK-NEXT: ret
entry:
%neg = fneg double %b
%0 = tail call double @llvm.experimental.constrained.fma.f64(double %a, double %neg, double %c, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
ret double %0
}
define double @fms64_com_strict(double %a, double %b, double %c) nounwind readnone ssp strictfp {
; CHECK-LABEL: fms64_com_strict:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fmsub d0, d0, d1, d2
; CHECK-NEXT: ret
entry:
%neg = fneg double %b
%0 = tail call double @llvm.experimental.constrained.fma.f64(double %neg, double %a, double %c, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
ret double %0
}
define double @fnms64_strict(double %a, double %b, double %c) nounwind readnone ssp strictfp {
; CHECK-LABEL: fnms64_strict:
; CHECK: // %bb.0: // %entry
; CHECK-NEXT: fnmsub d0, d0, d1, d2
; CHECK-NEXT: ret
entry:
%neg = fneg double %c
%0 = tail call double @llvm.experimental.constrained.fma.f64(double %a, double %b, double %neg, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
ret double %0
}
; This would crash while trying getNegatedExpression().
define float @negated_constant(float %x) {
; CHECK-LABEL: negated_constant:
; CHECK: // %bb.0:
; CHECK-NEXT: mov w8, #-1037565952 // =0xc2280000
; CHECK-NEXT: fmov s1, w8
; CHECK-NEXT: mov w8, #1109917696 // =0x42280000
; CHECK-NEXT: fmov s2, w8
; CHECK-NEXT: fmul s1, s0, s1
; CHECK-NEXT: fmadd s0, s0, s2, s1
; CHECK-NEXT: ret
%m = fmul float %x, 42.0
%fma = call nsz float @llvm.fma.f32(float %x, float -42.0, float %m)
%nfma = fneg float %fma
ret float %nfma
}
attributes #0 = { strictfp }
declare float @llvm.fma.f32(float, float, float) nounwind readnone
declare double @llvm.fma.f64(double, double, double) nounwind readnone
declare float @llvm.experimental.constrained.fma.f32(float, float, float, metadata, metadata)
declare double @llvm.experimental.constrained.fma.f64(double, double, double, metadata, metadata)