[InstCombine] add test for fsub+fneg with extra use; NFC

llvm-svn: 329418
This commit is contained in:
Sanjay Patel 2018-04-06 16:30:52 +00:00
parent b9d298ecf2
commit a6823f0e67
1 changed files with 15 additions and 0 deletions

View File

@ -27,6 +27,21 @@ define float @neg_sub_nsz(float %x, float %y) {
ret float %t2
}
declare void @use(float)
define float @neg_sub_nsz_extra_use(float %x, float %y) {
; CHECK-LABEL: @neg_sub_nsz_extra_use(
; CHECK-NEXT: [[T1:%.*]] = fsub float [[X:%.*]], [[Y:%.*]]
; CHECK-NEXT: [[T2:%.*]] = fsub nsz float [[Y]], [[X]]
; CHECK-NEXT: call void @use(float [[T1]])
; CHECK-NEXT: ret float [[T2]]
;
%t1 = fsub float %x, %y
%t2 = fsub nsz float -0.0, %t1
call void @use(float %t1)
ret float %t2
}
; With nsz: Z - (X - Y) --> Z + (Y - X)
define float @sub_sub_nsz(float %x, float %y, float %z) {