Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

__builtin_convertvector broken w/ __fp16 under WASM #51079

Open Quuxplusone opened 3 years ago

Quuxplusone commented 3 years ago
Bugzilla Link PR52112
Status CONFIRMED
Importance P normal
Reported by Domagoj Šarić (dsaritz@gmail.com)
Reported on 2021-10-08 02:26:39 -0700
Last modified on 2021-10-11 12:14:59 -0700
Version trunk
Hardware PC Windows NT
CC llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk, tlively@google.com
Fixed by commit(s)
Attachments
Blocks
Blocked by PR23305
See also
Broken codegen for __builtin_convertvector under WASM when the source vector
uses __fp16.

Repro: https://godbolt.org/z/vTq165xvr
note: if you make the lp variable const the correct result is generated.
Quuxplusone commented 3 years ago

Can you explain a little more why you think this behavior is wrong? Without looking too much into it, my guess is that this can be explained by the fact that WebAssembly does not support an f16 type, so f16s would be widened to f32s.

Quuxplusone commented 3 years ago
(In reply to Thomas Lively from comment #1)
> Can you explain a little more why you think this behavior is wrong? Without
> looking too much into it, my guess is that this can be explained by the fact
> that WebAssembly does not support an f16 type, so f16s would be widened to
> f32s.

Because __fp16 is documented as portable - on platforms where there is no
hardware support it is emulated - e.g. it works on x86. Even if it is not
supposed to work a compiler error should be generated, not erroneous codegen.

ps. this could be a duplicate of https://bugs.llvm.org/show_bug.cgi?id=23305 ...
Quuxplusone commented 3 years ago

Ah, thanks. Yes, even if this is not an exact duplicate of PR23305, it looks like this would at least be blocked on that bug.