Roman Lebedev
|
745046c23f
|
[InstCombine][NFC] Tests for 'unsigned add overflow' check
----------------------------------------
Name: unsigned add, overflow, v0
%add = add i8 %x, %y
%ov = icmp ult i8 %add, %x
=>
%agg = uadd_overflow i8 %x, %y
%add = extractvalue {i8, i1} %agg, 0
%ov = extractvalue {i8, i1} %agg, 1
Done: 1
Optimization is correct!
----------------------------------------
Name: unsigned add, overflow, v1
%add = add i8 %x, %y
%ov = icmp ult i8 %add, %y
=>
%agg = uadd_overflow i8 %x, %y
%add = extractvalue {i8, i1} %agg, 0
%ov = extractvalue {i8, i1} %agg, 1
Done: 1
Optimization is correct!
----------------------------------------
Name: unsigned add, no overflow, v0
%add = add i8 %x, %y
%ov = icmp uge i8 %add, %x
=>
%agg = uadd_overflow i8 %x, %y
%add = extractvalue {i8, i1} %agg, 0
%not.ov = extractvalue {i8, i1} %agg, 1
%ov = xor %not.ov, -1
Done: 1
Optimization is correct!
----------------------------------------
Name: unsigned add, no overflow, v1
%add = add i8 %x, %y
%ov = icmp uge i8 %add, %y
=>
%agg = uadd_overflow i8 %x, %y
%add = extractvalue {i8, i1} %agg, 0
%not.ov = extractvalue {i8, i1} %agg, 1
%ov = xor %not.ov, -1
Done: 1
Optimization is correct!
llvm-svn: 371098
|
2019-09-05 17:40:28 +00:00 |