1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[InstSimplify] add tests for FP with undef operand; NFC

Are any of these correct?

llvm-svn: 326241
This commit is contained in:
Sanjay Patel 2018-02-27 20:17:18 +00:00
parent dead908059
commit 5a4c6b79aa
2 changed files with 89 additions and 18 deletions

View File

@ -17,24 +17,6 @@ define float @frem_constant_fold() {
ret float %f
}
define double @fdiv_of_undef(double %X) {
; CHECK-LABEL: @fdiv_of_undef(
; CHECK-NEXT: ret double undef
;
; undef / X -> undef
%r = fdiv double undef, %X
ret double %r
}
define double @fdiv_by_undef(double %X) {
; CHECK-LABEL: @fdiv_by_undef(
; CHECK-NEXT: ret double undef
;
; X / undef -> undef
%r = fdiv double %X, undef
ret double %r
}
define double @fmul_fdiv_common_operand(double %x, double %y) {
; CHECK-LABEL: @fmul_fdiv_common_operand(
; CHECK-NEXT: ret double %x

View File

@ -0,0 +1,89 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instsimplify -S | FileCheck %s
define float @fadd_undef_op0(float %x) {
; CHECK-LABEL: @fadd_undef_op0(
; CHECK-NEXT: [[R:%.*]] = fadd float undef, [[X:%.*]]
; CHECK-NEXT: ret float [[R]]
;
%r = fadd float undef, %x
ret float %r
}
define float @fadd_undef_op1(float %x) {
; CHECK-LABEL: @fadd_undef_op1(
; CHECK-NEXT: [[R:%.*]] = fadd float [[X:%.*]], undef
; CHECK-NEXT: ret float [[R]]
;
%r = fadd float %x, undef
ret float %r
}
define float @fsub_undef_op0(float %x) {
; CHECK-LABEL: @fsub_undef_op0(
; CHECK-NEXT: [[R:%.*]] = fsub float undef, [[X:%.*]]
; CHECK-NEXT: ret float [[R]]
;
%r = fsub float undef, %x
ret float %r
}
define float @fsub_undef_op1(float %x) {
; CHECK-LABEL: @fsub_undef_op1(
; CHECK-NEXT: [[R:%.*]] = fsub float [[X:%.*]], undef
; CHECK-NEXT: ret float [[R]]
;
%r = fsub float %x, undef
ret float %r
}
define float @fmul_undef_op0(float %x) {
; CHECK-LABEL: @fmul_undef_op0(
; CHECK-NEXT: [[R:%.*]] = fmul float undef, [[X:%.*]]
; CHECK-NEXT: ret float [[R]]
;
%r = fmul float undef, %x
ret float %r
}
define float @fmul_undef_op1(float %x) {
; CHECK-LABEL: @fmul_undef_op1(
; CHECK-NEXT: [[R:%.*]] = fmul float [[X:%.*]], undef
; CHECK-NEXT: ret float [[R]]
;
%r = fmul float %x, undef
ret float %r
}
define float @fdiv_undef_op0(float %x) {
; CHECK-LABEL: @fdiv_undef_op0(
; CHECK-NEXT: ret float undef
;
%r = fdiv float undef, %x
ret float %r
}
define float @fdiv_undef_op1(float %x) {
; CHECK-LABEL: @fdiv_undef_op1(
; CHECK-NEXT: ret float undef
;
%r = fdiv float %x, undef
ret float %r
}
define float @frem_undef_op0(float %x) {
; CHECK-LABEL: @frem_undef_op0(
; CHECK-NEXT: ret float undef
;
%r = frem float undef, %x
ret float %r
}
define float @frem_undef_op1(float %x) {
; CHECK-LABEL: @frem_undef_op1(
; CHECK-NEXT: ret float undef
;
%r = frem float %x, undef
ret float %r
}