[InstCombine] add tests for copysign; NFC

This commit is contained in:
Sanjay Patel 2020-08-15 13:33:35 -04:00
parent babb59496b
commit 4d5fdff434
1 changed files with 22 additions and 0 deletions

View File

@ -89,3 +89,25 @@ define float @copysign_sign_arg(float %x, float %y, float %z) {
%r = call ninf float @llvm.copysign.f32(float %x, float %s)
ret float %r
}
define float @fneg_mag(float %x, float %y) {
; CHECK-LABEL: @fneg_mag(
; CHECK-NEXT: [[N:%.*]] = fneg float [[X:%.*]]
; CHECK-NEXT: [[R:%.*]] = call float @llvm.copysign.f32(float [[N]], float [[Y:%.*]])
; CHECK-NEXT: ret float [[R]]
;
%n = fneg float %x
%r = call float @llvm.copysign.f32(float %n, float %y)
ret float %r
}
define float @fabs_mag(float %x, float %y) {
; CHECK-LABEL: @fabs_mag(
; CHECK-NEXT: [[A:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]])
; CHECK-NEXT: [[R:%.*]] = call float @llvm.copysign.f32(float [[A]], float [[Y:%.*]])
; CHECK-NEXT: ret float [[R]]
;
%a = call float @llvm.fabs.f32(float %x)
%r = call float @llvm.copysign.f32(float %a, float %y)
ret float %r
}