“Retard” the verb has one perfectly acceptable meaning but saying a thing is “retarded” is a non-politically-correct equivalent to “mentally challenged”.
I wouldn’t call it a swear word but it certainly is crude and insensitive.
Something like “gcc optimizes like a girl” certainly wouldn’t be any better.