-
Notifications
You must be signed in to change notification settings - Fork 15k
Milestone
Description
The Problem
When using the __atomic_fetch_min and __atomic_fetch_max compiler builtins it is possible to generate instructions introduced in mips4 despite compiling for mips2. Following the code below compiling with -mips2, using __atomic_fetch_min generates a movz instruction while __atomic_fetch_max generates a movn instruction.
Here is C code that demonstrates this problem along with a Godbolt link demonstrating this miscompilation.
int min(int* x, int y) {
return __atomic_fetch_min(x, y, __ATOMIC_SEQ_CST);
}
int max(int* x, int y) {
return __atomic_fetch_max(x, y, __ATOMIC_SEQ_CST);
}Expected Behavior
I would expect that instructions like movz and movn would not be emitted when compiling for -mips2 since these instructions were introduced in MIPS IV, they are not present in the MIPS II standard.
Metadata
Metadata
Assignees
Type
Projects
Status
Done