llvm.org GIT mirror llvm / testing test / Transforms / InstSimplify / fdiv.ll
testing

Tree @testing (Download .tar.gz)

fdiv.ll @testingraw · history · blame

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instsimplify -S | FileCheck %s

define float @fdiv_constant_fold() {
; CHECK-LABEL: @fdiv_constant_fold(
; CHECK-NEXT:    ret float 1.500000e+00
;
  %f = fdiv float 3.0, 2.0
  ret float %f
}

define float @frem_constant_fold() {
; CHECK-LABEL: @frem_constant_fold(
; CHECK-NEXT:    ret float 1.000000e+00
;
  %f = frem float 3.0, 2.0
  ret float %f
}

define double @fdiv_of_undef(double %X) {
; CHECK-LABEL: @fdiv_of_undef(
; CHECK-NEXT:    ret double undef
;
; undef / X -> undef
  %r = fdiv double undef, %X
  ret double %r
}

define double @fdiv_by_undef(double %X) {
; CHECK-LABEL: @fdiv_by_undef(
; CHECK-NEXT:    ret double undef
;
; X / undef -> undef
  %r = fdiv double %X, undef
  ret double %r
}