Skip to content

Commit

Permalink
[InstCombine] add tests for copysign; NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
rotateright committed Aug 16, 2020
1 parent babb594 commit 4d5fdff
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions llvm/test/Transforms/InstCombine/copysign.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 4d5fdff

Please sign in to comment.