-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
RzIL TriCore Support #3478
RzIL TriCore Support #3478
Conversation
8b4c418
to
f719ba5
Compare
@imbillow for FPU see RzILFloat:
Some are probably still missing, e.g. no square root yet for
|
This comment was marked as resolved.
This comment was marked as resolved.
7411b7e
to
a4fe14c
Compare
cedc1c0
to
7bfd0fc
Compare
This comment was marked as resolved.
This comment was marked as resolved.
4026cce
to
7037dab
Compare
It is not possible to do it in RzIL for the moment. And I don't think it would be a good idea either, since the format of a float is the part of its type and should be statically known in the IL. A workaround for this (and what I also did in x86 floating-point instructions lifting) is to use the An example macro (not linking the x86 code since that PR is yet to be merged): /**
* \brief Execute the function \p f with the correct op mode argument
*
* \param f function which takes in the rounding mode as the first argument
*
* 0 -> RNE
* 1 -> RTN
* 2 -> RTP
* 3 -> RTZ
*/
#define EXEC_WITH_RMODE(f, ...) \
ITE(EQ(VARL("_rmode"), UN(2, 0)), f(RZ_FLOAT_RMODE_RNE, __VA_ARGS__), \
(EQ(VARL("_rmode"), UN(2, 1)), f(RZ_FLOAT_RMODE_RTN, __VA_ARGS__), \
(EQ(VARL("_rmode"), UN(2, 2)), f(RZ_FLOAT_RMODE_RTP, __VA_ARGS__), \
(f(RZ_FLOAT_RMODE_RTZ, __VA_ARGS__)))))
/* Need this because we want a function which takes in the rounding mode as the first argument. */
RzILOpFloat *convert_floating_helper(RzFloatRMode rmode, RzFloatFormat format, RzILOpFloat *val) {
return FCONVERT(format, rmode, val);
}
void example(RzILOpPure *x, RzILOpPure *y, RzFloatFormat fmt) {
/* We need to use DUP here so that the macro does not use reuse the same pure value everywhere. Not using DUP will lead to double-free. */
RzILOpPure *_rounded_convert = EXEC_WITH_RMODE(convert_floating_helper, format, DUP(x));
RzILOpPure *_rounded_add = EXEC_WITH_RMODE(FADD, DUP(x), DUP(y);
} |
cc4d403
to
81a35a6
Compare
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.
Ok, looks good now. I wonder if it makes sense for you to wait until TCG plugin API is implemented (for tracetesting), just like @DMaroo wants. Meanwhile, please split PRs as I suggested, and let's merge some of these.
No problem, I can wait for the implementation of the TCG plugin API. |
@imbillow merged those, please rebase this one and mark ready for review |
52fb62c
to
e43ab01
Compare
@imbillow, I found few missing/problematic opcodes:
Also
Moreover, when I tried
|
The main reason is that I only referenced tc1.6.2, so other versions of the instructions may be a bit problematic. |
@imbillow strange, because those instructions are in the binary compiled for the tc1.6.2-compatible SoC. |
strange, I can't seem to find a description of the
|
Oh my bad. |
875381e
to
f144f61
Compare
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.
OK, now it's in quite good condition. Since we postponed trace-testing after TCG APIs were implemented, let's merge it as is. It works quite well already on most files I tried. It can be improved further incrementally, when necessary, and also during the trace testing.
tc1.6.2
https://www.infineon.com/dgdl/Infineon-AURIX_TC3xx_Architecture_vol1-UserManual-v01_00-EN.pdf?fileId=5546d46276fb756a01771bc4c2e33bdd
https://www.infineon.com/dgdl/Infineon-AURIX_TC3xx_Architecture_vol2-UserManual-v01_00-EN.pdf?fileId=5546d46276fb756a01771bc4a6d73b70
Your checklist for this pull request
Detailed description
Test plan
CI is green