This is an archive of the discontinued LLVM Phabricator instance.

[COFF, ARM64] Add _ReadStatusReg and_WriteStatusReg intrinsics
ClosedPublic

Authored by mgrang on Oct 10 2018, 3:49 PM.

Diff Detail

Repository
rC Clang

Event Timeline

mgrang created this revision.Oct 10 2018, 3:49 PM

_ReadStatusReg and _WriteStatusReg intrinsics take ARM64_REGNO as input. These are defined in https://www.codemachine.com/downloads/win10/winnt.h.
LLVM already has intrinsics to read/write status regs: builtin_arm_rsr/builtin_arm_wsr. But these take the string concatenation of the byte repesentation of a register (like "1:2:3:4:5"). So I convert ARM64_REGNO to this string format and invoke read_register/write_register intrinsics.

mgrang added inline comments.Oct 10 2018, 3:55 PM
test/CodeGen/arm64-microsoft-status-reg.cpp
2

I had to create a new test file here as the existing file arm64-microsoft-intrinsics.cpp has a check for metadata and it seems I cannot have 2 different tests checking different metadata in the same test file.

If I understand correctly, when trying to match the metadata for one test the lit parser reaches the end of the generated IR and then cannot go up again to match the other checks.

Missing Sema changes?

mgrang updated this revision to Diff 169127.Oct 10 2018, 4:42 PM
efriedma added inline comments.Oct 10 2018, 6:18 PM
lib/Sema/SemaChecking.cpp
1754

I agree we shouldn't try to figure out whether the register is valid, but we probably want a range check anyway: if the value is greater than 0x7FFF, it can't be encoded.

dmajor added a subscriber: dmajor.Oct 12 2018, 7:05 AM
mgrang updated this revision to Diff 170133.Oct 18 2018, 4:33 PM
mgrang marked an inline comment as done.
This revision is now accepted and ready to land.Oct 18 2018, 4:35 PM
This revision was automatically updated to reflect the committed changes.