This is an archive of the discontinued LLVM Phabricator instance.

[X86] Add the movbe instruction intrinsics from icc.
ClosedPublic

Authored by craig.topper on Sep 26 2018, 6:25 PM.

Details

Summary

These intrinsics exist in icc. They can be found on the Intel Intrinsics Guide website.

All the backend support is in place to pattern match a load+bswap or a bswap+store pattern to the MOVBE instructions. So we just need to get the frontend to emit the correct IR. The pointer arguments in icc are declared as void so I had to jump through a packed struct to forcing a specific alignment on the load/store. Same trick we use in the unaligned vector load/store intrinsics

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Sep 26 2018, 6:25 PM

The struct hack isn't obvious to me. Without that, we would produce a load with default alignment based on the size of the load (i132 -> align 4, etc)? But we want to force align 1 regardless of the load size, so the packed attribute on the struct gets us that IIUC. What does may_alias do?

Explain this in a code comment in the header to make this less tricky?

lib/Headers/immintrin.h
359 ↗(On Diff #167228)

MOVEBE -> MOVBE

Add comment. Fix typo. Add preprocessor define checks to the various CPUs that have MOVBE

spatel accepted this revision.Sep 28 2018, 6:48 AM

LGTM

This revision is now accepted and ready to land.Sep 28 2018, 6:48 AM
This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.