Skip to content

Commit 4b699da

Browse files
committed
AMDGPU: Add fmed3 fold tests with flags
1 parent 08dd040 commit 4b699da

File tree

1 file changed

+34
-0
lines changed
  • llvm/test/Transforms/InstCombine/AMDGPU

1 file changed

+34
-0
lines changed

llvm/test/Transforms/InstCombine/AMDGPU/fmed3.ll

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,40 @@ define float @fmed3_x_y_poison_f32_strictfp(float %x, float %y) #2 {
578578
ret float %med3
579579
}
580580

581+
; --------------------------------------------------------------------
582+
; llvm.amdgcn.fmed3 with flags
583+
; --------------------------------------------------------------------
584+
585+
define float @fmed3_qnan0_x_y_f32_flags(float %x, float %y) #1 {
586+
; IEEE1-LABEL: define float @fmed3_qnan0_x_y_f32_flags(
587+
; IEEE1-SAME: float [[X:%.*]], float [[Y:%.*]]) #[[ATTR1]] {
588+
; IEEE1-NEXT: [[MED3:%.*]] = call ninf nsz float @llvm.minnum.f32(float [[X]], float [[Y]])
589+
; IEEE1-NEXT: ret float [[MED3]]
590+
;
591+
%med3 = call nsz ninf float @llvm.amdgcn.fmed3.f32(float 0x7FF8000000000000, float %x, float %y)
592+
ret float %med3
593+
}
594+
595+
define float @fmed3_x_qnan0_y_f32_flags(float %x, float %y) #1 {
596+
; IEEE1-LABEL: define float @fmed3_x_qnan0_y_f32_flags(
597+
; IEEE1-SAME: float [[X:%.*]], float [[Y:%.*]]) #[[ATTR1]] {
598+
; IEEE1-NEXT: [[MED3:%.*]] = call ninf nsz float @llvm.minnum.f32(float [[X]], float [[Y]])
599+
; IEEE1-NEXT: ret float [[MED3]]
600+
;
601+
%med3 = call nsz ninf float @llvm.amdgcn.fmed3.f32(float %x, float 0x7FF8000000000000, float %y)
602+
ret float %med3
603+
}
604+
605+
define float @fmed3_x_y_qnan0_f32_flags(float %x, float %y) #1 {
606+
; IEEE1-LABEL: define float @fmed3_x_y_qnan0_f32_flags(
607+
; IEEE1-SAME: float [[X:%.*]], float [[Y:%.*]]) #[[ATTR1]] {
608+
; IEEE1-NEXT: [[MED3:%.*]] = call ninf nsz float @llvm.minnum.f32(float [[X]], float [[Y]])
609+
; IEEE1-NEXT: ret float [[MED3]]
610+
;
611+
%med3 = call nsz ninf float @llvm.amdgcn.fmed3.f32(float %x, float %y, float 0x7FF8000000000000)
612+
ret float %med3
613+
}
614+
581615
attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
582616
attributes #1 = { nounwind "amdgpu-ieee"="true" }
583617
attributes #2 = { nounwind strictfp "amdgpu-ieee"="true" }

0 commit comments

Comments
 (0)