1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[ValueTracking] add tests for smin/smax; NFC

This commit is contained in:
Sanjay Patel 2020-04-04 13:43:27 -04:00
parent 024f788a82
commit 1e300cdd8c

View File

@ -462,6 +462,54 @@ TEST_F(MatchSelectPatternTest, DoubleCastBad) {
expectPattern({SPF_UNKNOWN, SPNB_NA, false});
}
TEST_F(MatchSelectPatternTest, NotNotSMin) {
parseAssembly(
"define i8 @test(i8 %a, i8 %b) {\n"
" %cmp = icmp sgt i8 %a, %b\n"
" %an = xor i8 %a, -1\n"
" %bn = xor i8 %b, -1\n"
" %A = select i1 %cmp, i8 %an, i8 %bn\n"
" ret i8 %A\n"
"}\n");
expectPattern({SPF_UNKNOWN, SPNB_NA, false});
}
TEST_F(MatchSelectPatternTest, NotNotSMinSwap) {
parseAssembly(
"define i8 @test(i8 %a, i8 %b) {\n"
" %cmp = icmp slt i8 %a, %b\n"
" %an = xor i8 %a, -1\n"
" %bn = xor i8 %b, -1\n"
" %A = select i1 %cmp, i8 %bn, i8 %an\n"
" ret i8 %A\n"
"}\n");
expectPattern({SPF_UNKNOWN, SPNB_NA, false});
}
TEST_F(MatchSelectPatternTest, NotNotSMax) {
parseAssembly(
"define i8 @test(i8 %a, i8 %b) {\n"
" %cmp = icmp slt i8 %a, %b\n"
" %an = xor i8 %a, -1\n"
" %bn = xor i8 %b, -1\n"
" %A = select i1 %cmp, i8 %an, i8 %bn\n"
" ret i8 %A\n"
"}\n");
expectPattern({SPF_UNKNOWN, SPNB_NA, false});
}
TEST_F(MatchSelectPatternTest, NotNotSMaxSwap) {
parseAssembly(
"define i8 @test(i8 %a, i8 %b) {\n"
" %cmp = icmp sgt i8 %a, %b\n"
" %an = xor i8 %a, -1\n"
" %bn = xor i8 %b, -1\n"
" %A = select i1 %cmp, i8 %bn, i8 %an\n"
" ret i8 %A\n"
"}\n");
expectPattern({SPF_UNKNOWN, SPNB_NA, false});
}
TEST(ValueTracking, GuaranteedToTransferExecutionToSuccessor) {
StringRef Assembly =
"declare void @nounwind_readonly(i32*) nounwind readonly "