forked from OSchip/llvm-project
28 lines
658 B
LLVM
28 lines
658 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt < %s -instcombine -S | FileCheck %s
|
|
|
|
; -x + y => y - x
|
|
|
|
define float @fneg_op0(float %x, float %y) {
|
|
; CHECK-LABEL: @fneg_op0(
|
|
; CHECK-NEXT: [[ADD:%.*]] = fsub float [[Y:%.*]], [[X:%.*]]
|
|
; CHECK-NEXT: ret float [[ADD]]
|
|
;
|
|
%neg = fsub float -0.0, %x
|
|
%add = fadd float %neg, %y
|
|
ret float %add
|
|
}
|
|
|
|
; x + -y => x - y
|
|
|
|
define float @fneg_op1(float %x, float %y) {
|
|
; CHECK-LABEL: @fneg_op1(
|
|
; CHECK-NEXT: [[ADD:%.*]] = fsub float [[X:%.*]], [[Y:%.*]]
|
|
; CHECK-NEXT: ret float [[ADD]]
|
|
;
|
|
%neg = fsub float -0.0, %y
|
|
%add = fadd float %x, %neg
|
|
ret float %add
|
|
}
|
|
|