Skip to content
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

u32 -> f32 pattern not always detected #12

Open
simonlindholm opened this issue Sep 18, 2018 · 1 comment
Open

u32 -> f32 pattern not always detected #12

simonlindholm opened this issue Sep 18, 2018 · 1 comment

Comments

@simonlindholm
Copy link
Collaborator

We detect

bgez  $a3, .L00400100
 cvt.s.w $reg, whatever
lui   $at, 0x4f80
mtc1  $at, $temp
nop
add.s $reg, $reg, $temp
.L00400100:

but I once saw

cvt.s.w $reg, whatever
bgez  $a3, .L00400100
 something unrelated
lui   $at, 0x4f80
mtc1  $at, $temp
nop
add.s $reg, $reg, $temp
.L00400100:

in some piece of -O2-compiled code (IIRC). Can we work around this with the current framework? Or are these patterns arbitrarily reordered together with other code, making a more complex approach necessary? Needs to be investigated.

@simonlindholm
Copy link
Collaborator Author

I've also seen

/* 0D88B4 8031D8B4 44864000 */  mtc1  $a2, $f8
/* 0D88B8 8031D8B8 3C014F80 */  li    $at, 0x4F800000 # 4294967296.000000
/* 0D88BC 8031D8BC 04C10004 */  bgez  $a2, .L8031D8D0
/* 0D88C0 8031D8C0 468041A0 */   cvt.s.w $f6, $f8
/* 0D88C4 8031D8C4 44815000 */  mtc1  $at, $f10
/* 0D88C8 8031D8C8 00000000 */  nop
/* 0D88CC 8031D8CC 460A3180 */  add.s $f6, $f6, $f10
.L8031D8D0:
/* 0D88E4 8031D8E4 44858000 */  mtc1  $a1, $f16
/* 0D88E8 8031D8E8 3C014F80 */  li    $at, 0x4F800000 # 4294967296.000000
/* 0D88EC 8031D8EC 468084A0 */  cvt.s.w $f18, $f16
/* 0D88F0 8031D8F0 46202220 */  unrelated 
/* 0D88F4 8031D8F4 04A10004 */  bgez  $a1, .L8031D908
/* 0D88F8 8031D8F8 460A4181 */   unrelated 
/* 0D88FC 8031D8FC 44812000 */  mtc1  $at, $f4
/* 0D8900 8031D900 00000000 */  nop
/* 0D8904 8031D904 46049480 */  add.s $f18, $f18, $f4
.L8031D908:

so yeah, it looks like mostly arbitrary reorderings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant