[InstSimplify] add tests for constant folding fmin/fmax with undef op; NFC

This commit is contained in:
Sanjay Patel 2020-09-18 10:36:24 -04:00
parent 7c2d83347f
commit d3b0644e22
1 changed files with 68 additions and 0 deletions

View File

@ -1,6 +1,11 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instsimplify -S | FileCheck %s
declare <2 x double> @llvm.minnum.v2f64(<2 x double>, <2 x double>)
declare <2 x double> @llvm.maxnum.v2f64(<2 x double>, <2 x double>)
declare <2 x double> @llvm.minimum.v2f64(<2 x double>, <2 x double>)
declare <2 x double> @llvm.maximum.v2f64(<2 x double>, <2 x double>)
; Constant folding - undef undef.
define double @fadd_undef_undef(double %x) {
@ -533,3 +538,66 @@ define <2 x double> @frem_undef_op0_constant_vec(<2 x double> %x) {
ret <2 x double> %r
}
define <2 x double> @maximum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x) {
; CHECK-LABEL: @maximum_nan_op0_vec_partial_undef_op1_undef(
; CHECK-NEXT: ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
;
%r = call <2 x double> @llvm.maximum.v2f64(<2 x double> <double 0x7ff8000000000000, double undef>, <2 x double> undef)
ret <2 x double> %r
}
define <2 x double> @maximum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x) {
; CHECK-LABEL: @maximum_nan_op1_vec_partial_undef_op0_undef(
; CHECK-NEXT: ret <2 x double> <double 0x7FF8000000000000, double undef>
;
%r = call <2 x double> @llvm.maximum.v2f64(<2 x double> undef, <2 x double> <double 0x7ff8000000000000, double undef>)
ret <2 x double> %r
}
define <2 x double> @minimum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x) {
; CHECK-LABEL: @minimum_nan_op0_vec_partial_undef_op1_undef(
; CHECK-NEXT: ret <2 x double> <double 0x7FF8000000000000, double 0x7FF8000000000000>
;
%r = call <2 x double> @llvm.minimum.v2f64(<2 x double> <double 0x7ff8000000000000, double undef>, <2 x double> undef)
ret <2 x double> %r
}
define <2 x double> @minimum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x) {
; CHECK-LABEL: @minimum_nan_op1_vec_partial_undef_op0_undef(
; CHECK-NEXT: ret <2 x double> <double 0x7FF8000000000000, double undef>
;
%r = call <2 x double> @llvm.minimum.v2f64(<2 x double> undef, <2 x double> <double 0x7ff8000000000000, double undef>)
ret <2 x double> %r
}
define <2 x double> @maxnum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x) {
; CHECK-LABEL: @maxnum_nan_op0_vec_partial_undef_op1_undef(
; CHECK-NEXT: ret <2 x double> undef
;
%r = call <2 x double> @llvm.maxnum.v2f64(<2 x double> <double 0x7ff8000000000000, double undef>, <2 x double> undef)
ret <2 x double> %r
}
define <2 x double> @maxnum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x) {
; CHECK-LABEL: @maxnum_nan_op1_vec_partial_undef_op0_undef(
; CHECK-NEXT: ret <2 x double> <double 0x7FF8000000000000, double undef>
;
%r = call <2 x double> @llvm.maxnum.v2f64(<2 x double> undef, <2 x double> <double 0x7ff8000000000000, double undef>)
ret <2 x double> %r
}
define <2 x double> @minnum_nan_op0_vec_partial_undef_op1_undef(<2 x double> %x) {
; CHECK-LABEL: @minnum_nan_op0_vec_partial_undef_op1_undef(
; CHECK-NEXT: ret <2 x double> undef
;
%r = call <2 x double> @llvm.minnum.v2f64(<2 x double> <double 0x7ff8000000000000, double undef>, <2 x double> undef)
ret <2 x double> %r
}
define <2 x double> @minnum_nan_op1_vec_partial_undef_op0_undef(<2 x double> %x) {
; CHECK-LABEL: @minnum_nan_op1_vec_partial_undef_op0_undef(
; CHECK-NEXT: ret <2 x double> <double 0x7FF8000000000000, double undef>
;
%r = call <2 x double> @llvm.minnum.v2f64(<2 x double> undef, <2 x double> <double 0x7ff8000000000000, double undef>)
ret <2 x double> %r
}