I have encountered an issue when compiling the code with powerpc-eabivle-gcc.exe 4.9.4 with -mspe2 option using an s32R274 e200z7 core. It builds and runs fine without the -mspe2, but it crashes during runtime and gets trapped in a watchdog timer interrupt vector #12 with the -mspe2 option. I am using S32 Design Studio for Power Architecture v2017.R1.
The offending line of code is a simple typecast to a float:
tmpFloat = (float)tmpInt64;
Where tmpFloat is of type float and tmpInt64 is of type int64_t.
According to the disassembly, the code compiles into the following assembly instructions:
e_bl 0x10c2d88 <__floatdisf>
se_mr r7,r3 <-------- Crashes here
To add to the confusion, I get the same assembly output whether the -mspe2 option is included or not.
Of course, after posting the question I found a solution. The SPE must be enabled in the core prior to using it.
This can be done as follows: