[llvm-dev] Dealing with boolean values in GlobalISel
Nicolai Hähnle-Montoro via llvm-dev
llvm-dev at lists.llvm.org
Sat Sep 28 13:45:28 PDT 2019
On Fri, Sep 27, 2019 at 9:47 PM Arsenault, Matthew via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> define i32 @foo(i32 %a, i32 %b, i32 %c) {
> %cc = trunc i32 %a to i1
> %r = select i1 %cc, i32 %b, i32 %c
> ret i32 %r
> }
[snip]
> Can we make truncates to s1 illegal? [...]
You're saying that in the example above, we'd first generate a G_TRUNC
to s1, which would then be legalized to a compare against 0 (which has
an s1 result)?
That actually seems quite reasonable to me.
What if the program has an s32 input value which is known for whatever
reason to be either 0 or 1? In that case, we may still want to be able
to convert the value to an s1 with a no-op operation. Any idea how
that would be represented?
Cheers,
Nicolai
>
>
>
> -Matt
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
--
Lerne, wie die Welt wirklich ist,
aber vergiss niemals, wie sie sein sollte.
More information about the llvm-dev
mailing list