llvm/llvm/test/Transforms/MergeFunc/merge-fp-intrinsics.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
;; Make sure internal constrained FP intrinsics still merge properly
; RUN: opt -passes=mergefunc -S < %s | FileCheck %s

declare float @llvm.experimental.constrained.fadd.f32(float, float, metadata, metadata)

define float @func1(float %a, float %b) {
; CHECK-LABEL: define float @func1
; CHECK-SAME: (float [[A:%.*]], float [[B:%.*]]) {
; CHECK-NEXT:    [[RESULT:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float [[A]], float [[B]], metadata !"round.dynamic", metadata !"fpexcept.strict")
; CHECK-NEXT:    [[RESULT_2:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float [[A]], float [[B]], metadata !"round.dynamic", metadata !"fpexcept.strict")
; CHECK-NEXT:    ret float [[RESULT]]
;
  %result = call float @llvm.experimental.constrained.fadd.f32(float %a, float %b, metadata !"round.dynamic", metadata !"fpexcept.strict")
  %result_2 = call float @llvm.experimental.constrained.fadd.f32(float %a, float %b, metadata !"round.dynamic", metadata !"fpexcept.strict")
  ret float %result
}

define float @func2(float %a, float %b) {
; CHECK-LABEL: define float @func2
; CHECK-SAME: (float [[TMP0:%.*]], float [[TMP1:%.*]]) {
; CHECK-NEXT:    [[TMP3:%.*]] = tail call float @func1(float [[TMP0]], float [[TMP1]])
; CHECK-NEXT:    ret float [[TMP3]]
;
  %result = call float @llvm.experimental.constrained.fadd.f32(float %a, float %b, metadata !"round.dynamic", metadata !"fpexcept.strict")
  %result_2 = call float @llvm.experimental.constrained.fadd.f32(float %a, float %b, metadata !"round.dynamic", metadata !"fpexcept.strict")
  ret float %result
}