Page MenuHomePhabricator

[X86] [CodeGen] Compiler not using SHLD/SHRD instructions when doing double shift pattern combine for 16bit or 8bit arguments (PR35155)
Needs ReviewPublic

Authored by kbelochapka on Nov 6 2017, 3:06 PM.

Details

Summary

Use SHLD/SHRD instruction when performing double shift pattern combine for any unsigned integer type.

template<typename T, typename SH>
T shld(T x, T, y, SH bits) {

return (x << bits)  | ( y >> (sizeof(T) *8- bits))

}
T - any of unsigned integer type
SH - any of signed or unsigned integer type

Diff Detail

Event Timeline

kbelochapka created this revision.Nov 6 2017, 3:06 PM
RKSimon added inline comments.Nov 10 2017, 5:48 AM
test/CodeGen/X86/shift-double-x86_64.ll
116

Most of these tests should probably be in shift-double.ll (tested on 32 and 64bit targets) and just the 2*i64 cases kept here in shift-double-x86_64.ll

kbelochapka edited the summary of this revision. (Show Details)

Updates the fix to support 32bit mode, moved all non 64 bit tests into shift-double.ll

@kbelochapka If you're still interested in SHLD/SHRD optimization you might want to keep an eye on D49242