-
Notifications
You must be signed in to change notification settings - Fork 152
[CIR][CIRGen][Builtin][X86] Lower __rdtscp #1686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@@ -144,5 +144,26 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned BuiltinID, | |||
getLoc(E->getExprLoc()), builder.getStringAttr("x86.rdtsc"), intTy) | |||
.getResult(); | |||
} | |||
case X86::BI__builtin_ia32_rdtscp: { | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for this PR, but something to note here: in OG CGM.getIntrinsic
seems to be able to figure out the type of the intrinsic, we should do the same in CIR to make writing these easier:
case X86::BI__builtin_ia32_rdtscp: {
Value *Call = Builder.CreateCall(CGM.getIntrinsic(Intrinsic::x86_rdtscp));
Builder.CreateDefaultAlignedStore(Builder.CreateExtractValue(Call, 1),
Ops[0]);
return Builder.CreateExtractValue(Call, 0);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your suggestion, will definitely help as I wanna cover these intrinsics.
Good to land once conflict is fixed |
👍 |
Moved rd related intrinsic tests, to a different file similar to
clang/test/CodeGen/X86/rd-builtins.c
. Let me know if that's the right call.related: #1404