<div dir="ltr">Answering my own question, just for future reference: the ideal solution seems to be adding a custom FunctionPass based on the PatternMatch API to match and convert the patterns to the proper ICmpInst instructions, enabling the backend to generate the correct conditional jumps. Hence, this could be something to be integrated into InstCombine, unless there's a more specific pass to match and normalise the conditional jumps at the LLVM-IR level.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno mer 29 lug 2020 alle ore 18:05 Matteo Favaro <<a href="mailto:fvrmatteo@gmail.com">fvrmatteo@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I was trying to verify if it's possible to generate all the possible x86 conditional jumps from Clang, but I didn't manage to obtain 3 jumps: JA/JNA, JL/JGE, JG/JLE</div><div><br></div><div>This is an example illustrating the flags calculation (hopefully correct) and the conditional jump generation: <a href="https://godbolt.org/z/a13qPa" target="_blank">https://godbolt.org/z/a13qPa</a>. I know these jumps are not common and that the example is weird, but I still think they should be foldable.</div><div><br></div><div>My assumption is that there are no backend rules to fold the generated patterns (including Jcc and SETcc instruction) into a single conditional jump instruction, but maybe I'm just missing a command line argument.</div><div><br></div><div>Am I missing something? If the rules are missing, what would it be the best place to implement them?</div><div><br></div><div>Thanks, Matteo</div></div>
</blockquote></div>