From 8fb384d7eeb3ff0afb3b32b58a01a3b691cbabc8 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Wed, 13 Feb 2019 23:27:31 +0000 Subject: [PATCH] [ConstProp] add IR tests to show miscompiles; NFC A fix for these is proposed in D51216. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353992 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/ConstProp/bitcast.ll | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/Transforms/ConstProp/bitcast.ll b/test/Transforms/ConstProp/bitcast.ll index 353062ee3fe..f914702f3ad 100644 --- a/test/Transforms/ConstProp/bitcast.ll +++ b/test/Transforms/ConstProp/bitcast.ll @@ -22,3 +22,39 @@ define i1 @bad_icmp_constexpr_bitcast() { %cmp = icmp eq i32 ptrtoint (i16* @a to i32), bitcast (float fadd (float bitcast (i32 ptrtoint (i16* @b to i32) to float), float 2.0) to i32) ret i1 %cmp } + +; FIXME: If the bitcasts result in a NaN FP value, then "ordered and equal" would be false. + +define i1 @fcmp_constexpr_oeq(float %conv) { +; CHECK-LABEL: @fcmp_constexpr_oeq( +; CHECK-NEXT: ret i1 true +; + %cmp = fcmp oeq float bitcast (i32 ptrtoint (i16* @a to i32) to float), bitcast (i32 ptrtoint (i16* @a to i32) to float) + ret i1 %cmp +} + +; FIXME: If the bitcasts result in a NaN FP value, then "unordered or not equal" would be true. + +define i1 @fcmp_constexpr_une(float %conv) { +; CHECK-LABEL: @fcmp_constexpr_une( +; CHECK-NEXT: ret i1 false +; + %cmp = fcmp une float bitcast (i32 ptrtoint (i16* @a to i32) to float), bitcast (i32 ptrtoint (i16* @a to i32) to float) + ret i1 %cmp +} + +define i1 @fcmp_constexpr_ueq(float %conv) { +; CHECK-LABEL: @fcmp_constexpr_ueq( +; CHECK-NEXT: ret i1 true +; + %cmp = fcmp ueq float bitcast (i32 ptrtoint (i16* @a to i32) to float), bitcast (i32 ptrtoint (i16* @a to i32) to float) + ret i1 %cmp +} + +define i1 @fcmp_constexpr_one(float %conv) { +; CHECK-LABEL: @fcmp_constexpr_one( +; CHECK-NEXT: ret i1 false +; + %cmp = fcmp one float bitcast (i32 ptrtoint (i16* @a to i32) to float), bitcast (i32 ptrtoint (i16* @a to i32) to float) + ret i1 %cmp +} -- 2.40.0