https://bugs.llvm.org/show_bug.cgi?id=45668
Bug ID: 45668
Summary: Legalize integer divisions with enough signbits as a
smaller operation
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Common Code Generator Code
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected]
Split off from [Bug #45649]:
We don't have much support for arbitrary sized integer division, and once we
can't legalize to a wider type it does tend to fail - I'm not sure if this is
likely to change anytime soon.
We don't even handle the likes of:
define i129 @div_i31_sext_i129(i31 %0, i31 %1) {
%3 = sext i31 %0 to i129
%4 = sext i31 %1 to i129
%5 = sdiv i129 %3, %4
ret i129 %5
}
I may be wrong here but we should be able to legalize to:
define i129 @div_i31_sext_i129(i31 %0, i31 %1) {
%3 = sext i31 %0 to i64
%4 = sext i31 %1 to i64
%5 = sdiv i64 %3, %4
%6 = sext i64 %5 to i129
ret i129 %6
}
Alive2 (with smaller types): http://volta.cs.utah.edu:8080/z/FtCZCa
----------------------------------------
define i19 @src(i7 %0, i7 %1) {
%2:
%3 = sext i7 %0 to i19
%4 = sext i7 %1 to i19
%5 = sdiv i19 %3, %4
ret i19 %5
}
=>
define i19 @tgt(i7 %0, i7 %1) {
%2:
%3 = sext i7 %0 to i16
%4 = sext i7 %1 to i16
%5 = sdiv i16 %3, %4
%6 = sext i16 %5 to i19
ret i19 %6
}
Transformation seems to be correct!
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs