-
Notifications
You must be signed in to change notification settings - Fork 15.2k
AMDGPU: Make v2f64 -> v2f16 conversion Legal only when unsafe fast math is set #134738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
9bdaf1d
6d970b0
62078af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,199 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test belongs in the existing fptrunc.f16.ll test
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The existing fptrunc.f16.ll only checks when unsafe fpmath is set. This patch actually fixes the codegen when unsafe fpmath is not set for v2f16 only. Maybe we should not include scalar and wider in this file? |
||
| ; RUN: llc -mtriple=amdgcn -mcpu=gfx950 -global-isel=0 < %s | FileCheck -check-prefixes=GFX950,GFX950-SAFE-SDAG %s | ||
| ; RUN: llc -mtriple=amdgcn -mcpu=gfx950 -global-isel=1 < %s | FileCheck -check-prefixes=GFX950,GFX950-SAFE-GISEL %s | ||
| ; RUN: llc -mtriple=amdgcn -mcpu=gfx950 -global-isel=0 -enable-unsafe-fp-math < %s | FileCheck -check-prefixes=GFX950,GFX950-UNSAFE %s | ||
| ; RUN: llc -mtriple=amdgcn -mcpu=gfx950 -global-isel=1 -enable-unsafe-fp-math < %s | FileCheck -check-prefixes=GFX950,GFX950-UNSAFE %s | ||
|
|
||
| define amdgpu_ps <2 x half> @v_test_cvt_v2f32_v2f16(<2 x float> %src) { | ||
|
||
| ; GFX950-LABEL: v_test_cvt_v2f32_v2f16: | ||
| ; GFX950: ; %bb.0: | ||
| ; GFX950-NEXT: v_cvt_pk_f16_f32 v0, v0, v1 | ||
| ; GFX950-NEXT: ; return to shader part epilog | ||
| %res = fptrunc <2 x float> %src to <2 x half> | ||
| ret <2 x half> %res | ||
| } | ||
|
|
||
| define amdgpu_ps <2 x half> @v_test_cvt_v2f64_v2f16(<2 x double> %src) { | ||
| ; GFX950-SAFE-SDAG-LABEL: v_test_cvt_v2f64_v2f16: | ||
| ; GFX950-SAFE-SDAG: ; %bb.0: | ||
| ; GFX950-SAFE-SDAG-NEXT: s_movk_i32 s0, 0x1ff | ||
| ; GFX950-SAFE-SDAG-NEXT: v_and_or_b32 v0, v1, s0, v0 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cmp_ne_u32_e32 vcc, 0, v0 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_lshrrev_b32_e32 v4, 8, v1 | ||
| ; GFX950-SAFE-SDAG-NEXT: s_movk_i32 s1, 0xffe | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc | ||
| ; GFX950-SAFE-SDAG-NEXT: v_bfe_u32 v5, v1, 20, 11 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_and_or_b32 v0, v4, s1, v0 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_sub_u32_e32 v6, 0x3f1, v5 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_or_b32_e32 v4, 0x1000, v0 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_med3_i32 v6, v6, 0, 13 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_lshrrev_b32_e32 v7, v6, v4 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_lshlrev_b32_e32 v6, v6, v7 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cmp_ne_u32_e32 vcc, v6, v4 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_add_u32_e32 v5, 0xfffffc10, v5 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_lshl_or_b32 v6, v5, 12, v0 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cndmask_b32_e64 v4, 0, 1, vcc | ||
| ; GFX950-SAFE-SDAG-NEXT: v_or_b32_e32 v4, v7, v4 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cmp_gt_i32_e32 vcc, 1, v5 | ||
| ; GFX950-SAFE-SDAG-NEXT: s_movk_i32 s2, 0x40f | ||
| ; GFX950-SAFE-SDAG-NEXT: v_lshrrev_b32_e32 v1, 16, v1 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cndmask_b32_e32 v4, v6, v4, vcc | ||
| ; GFX950-SAFE-SDAG-NEXT: v_and_b32_e32 v6, 7, v4 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cmp_lt_i32_e32 vcc, 5, v6 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_lshrrev_b32_e32 v4, 2, v4 | ||
| ; GFX950-SAFE-SDAG-NEXT: s_mov_b32 s3, 0x8000 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cndmask_b32_e64 v7, 0, 1, vcc | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, 3, v6 | ||
| ; GFX950-SAFE-SDAG-NEXT: s_nop 1 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cndmask_b32_e64 v6, 0, 1, vcc | ||
| ; GFX950-SAFE-SDAG-NEXT: v_or_b32_e32 v6, v6, v7 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_add_u32_e32 v4, v4, v6 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_mov_b32_e32 v6, 0x7c00 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cmp_gt_i32_e32 vcc, 31, v5 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_mov_b32_e32 v7, 0x7e00 | ||
| ; GFX950-SAFE-SDAG-NEXT: s_nop 0 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cndmask_b32_e32 v4, v6, v4, vcc | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cmp_ne_u32_e32 vcc, 0, v0 | ||
| ; GFX950-SAFE-SDAG-NEXT: s_nop 1 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cndmask_b32_e32 v0, v6, v7, vcc | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, s2, v5 | ||
| ; GFX950-SAFE-SDAG-NEXT: s_nop 1 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cndmask_b32_e32 v0, v4, v0, vcc | ||
| ; GFX950-SAFE-SDAG-NEXT: v_and_or_b32 v0, v1, s3, v0 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_and_or_b32 v1, v3, s0, v2 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cmp_ne_u32_e32 vcc, 0, v1 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_lshrrev_b32_e32 v2, 8, v3 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_bfe_u32 v4, v3, 20, 11 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cndmask_b32_e64 v1, 0, 1, vcc | ||
| ; GFX950-SAFE-SDAG-NEXT: v_and_or_b32 v1, v2, s1, v1 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_sub_u32_e32 v5, 0x3f1, v4 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_or_b32_e32 v2, 0x1000, v1 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_med3_i32 v5, v5, 0, 13 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_lshrrev_b32_e32 v8, v5, v2 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_lshlrev_b32_e32 v5, v5, v8 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cmp_ne_u32_e32 vcc, v5, v2 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_add_u32_e32 v4, 0xfffffc10, v4 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_lshl_or_b32 v5, v4, 12, v1 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc | ||
| ; GFX950-SAFE-SDAG-NEXT: v_or_b32_e32 v2, v8, v2 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cmp_gt_i32_e32 vcc, 1, v4 | ||
| ; GFX950-SAFE-SDAG-NEXT: s_mov_b32 s0, 0x5040100 | ||
| ; GFX950-SAFE-SDAG-NEXT: s_nop 0 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cndmask_b32_e32 v2, v5, v2, vcc | ||
| ; GFX950-SAFE-SDAG-NEXT: v_and_b32_e32 v5, 7, v2 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cmp_lt_i32_e32 vcc, 5, v5 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_lshrrev_b32_e32 v2, 2, v2 | ||
| ; GFX950-SAFE-SDAG-NEXT: s_nop 0 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cndmask_b32_e64 v8, 0, 1, vcc | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, 3, v5 | ||
| ; GFX950-SAFE-SDAG-NEXT: s_nop 1 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cndmask_b32_e64 v5, 0, 1, vcc | ||
| ; GFX950-SAFE-SDAG-NEXT: v_or_b32_e32 v5, v5, v8 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_add_u32_e32 v2, v2, v5 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cmp_gt_i32_e32 vcc, 31, v4 | ||
| ; GFX950-SAFE-SDAG-NEXT: s_nop 1 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cndmask_b32_e32 v2, v6, v2, vcc | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cmp_ne_u32_e32 vcc, 0, v1 | ||
| ; GFX950-SAFE-SDAG-NEXT: s_nop 1 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cndmask_b32_e32 v1, v6, v7, vcc | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cmp_eq_u32_e32 vcc, s2, v4 | ||
| ; GFX950-SAFE-SDAG-NEXT: s_nop 1 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_cndmask_b32_e32 v1, v2, v1, vcc | ||
| ; GFX950-SAFE-SDAG-NEXT: v_lshrrev_b32_e32 v2, 16, v3 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_and_or_b32 v1, v2, s3, v1 | ||
| ; GFX950-SAFE-SDAG-NEXT: v_perm_b32 v0, v1, v0, s0 | ||
| ; GFX950-SAFE-SDAG-NEXT: ; return to shader part epilog | ||
| ; | ||
| ; GFX950-SAFE-GISEL-LABEL: v_test_cvt_v2f64_v2f16: | ||
| ; GFX950-SAFE-GISEL: ; %bb.0: | ||
| ; GFX950-SAFE-GISEL-NEXT: v_mov_b32_e32 v7, 0x1ff | ||
| ; GFX950-SAFE-GISEL-NEXT: v_and_or_b32 v0, v1, v7, v0 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_bfe_u32 v4, v1, 20, 11 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cmp_ne_u32_e32 vcc, 0, v0 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_add_u32_e32 v4, 0xfffffc10, v4 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_lshrrev_b32_e32 v5, 8, v1 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_mov_b32_e32 v6, 0xffe | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc | ||
| ; GFX950-SAFE-GISEL-NEXT: v_and_or_b32 v0, v5, v6, v0 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_sub_u32_e32 v10, 1, v4 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cmp_ne_u32_e32 vcc, 0, v0 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_lshl_or_b32 v9, v4, 12, v0 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_med3_i32 v10, v10, 0, 13 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_or_b32_e32 v0, 0x1000, v0 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_lshrrev_b32_e32 v11, v10, v0 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_lshlrev_b32_e32 v10, v10, v11 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cndmask_b32_e64 v5, 0, 1, vcc | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cmp_ne_u32_e32 vcc, v10, v0 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_mov_b32_e32 v8, 0x7c00 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_lshl_or_b32 v5, v5, 9, v8 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc | ||
| ; GFX950-SAFE-GISEL-NEXT: v_or_b32_e32 v0, v11, v0 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cmp_gt_i32_e32 vcc, 1, v4 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_lshrrev_b32_e32 v1, 16, v1 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_and_or_b32 v2, v3, v7, v2 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cndmask_b32_e32 v0, v9, v0, vcc | ||
| ; GFX950-SAFE-GISEL-NEXT: v_and_b32_e32 v9, 7, v0 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, 3, v9 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cmp_lt_i32_e64 s[0:1], 5, v9 | ||
| ; GFX950-SAFE-GISEL-NEXT: s_or_b64 s[0:1], vcc, s[0:1] | ||
| ; GFX950-SAFE-GISEL-NEXT: v_lshrrev_b32_e32 v0, 2, v0 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cndmask_b32_e64 v9, 0, 1, s[0:1] | ||
| ; GFX950-SAFE-GISEL-NEXT: v_add_u32_e32 v0, v0, v9 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cmp_lt_i32_e32 vcc, 30, v4 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_mov_b32_e32 v9, 0x40f | ||
| ; GFX950-SAFE-GISEL-NEXT: s_nop 0 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cndmask_b32_e32 v0, v0, v8, vcc | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v4, v9 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_mov_b32_e32 v4, 0x8000 | ||
| ; GFX950-SAFE-GISEL-NEXT: s_nop 0 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cndmask_b32_e32 v0, v0, v5, vcc | ||
| ; GFX950-SAFE-GISEL-NEXT: v_and_or_b32 v0, v1, v4, v0 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_bfe_u32 v1, v3, 20, 11 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cmp_ne_u32_e32 vcc, 0, v2 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_add_u32_e32 v1, 0xfffffc10, v1 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_lshrrev_b32_e32 v5, 8, v3 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc | ||
| ; GFX950-SAFE-GISEL-NEXT: v_and_or_b32 v2, v5, v6, v2 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_sub_u32_e32 v7, 1, v1 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cmp_ne_u32_e32 vcc, 0, v2 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_lshl_or_b32 v6, v1, 12, v2 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_med3_i32 v7, v7, 0, 13 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_or_b32_e32 v2, 0x1000, v2 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_lshrrev_b32_e32 v10, v7, v2 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_lshlrev_b32_e32 v7, v7, v10 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cndmask_b32_e64 v5, 0, 1, vcc | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cmp_ne_u32_e32 vcc, v7, v2 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_lshl_or_b32 v5, v5, 9, v8 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_and_b32_e32 v0, 0xffff, v0 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cndmask_b32_e64 v2, 0, 1, vcc | ||
| ; GFX950-SAFE-GISEL-NEXT: v_or_b32_e32 v2, v10, v2 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cmp_gt_i32_e32 vcc, 1, v1 | ||
| ; GFX950-SAFE-GISEL-NEXT: s_nop 1 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cndmask_b32_e32 v2, v6, v2, vcc | ||
| ; GFX950-SAFE-GISEL-NEXT: v_and_b32_e32 v6, 7, v2 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, 3, v6 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cmp_lt_i32_e64 s[0:1], 5, v6 | ||
| ; GFX950-SAFE-GISEL-NEXT: s_or_b64 s[0:1], vcc, s[0:1] | ||
| ; GFX950-SAFE-GISEL-NEXT: v_lshrrev_b32_e32 v2, 2, v2 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cndmask_b32_e64 v6, 0, 1, s[0:1] | ||
| ; GFX950-SAFE-GISEL-NEXT: v_add_u32_e32 v2, v2, v6 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cmp_lt_i32_e32 vcc, 30, v1 | ||
| ; GFX950-SAFE-GISEL-NEXT: s_nop 1 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cndmask_b32_e32 v2, v2, v8, vcc | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cmp_eq_u32_e32 vcc, v1, v9 | ||
| ; GFX950-SAFE-GISEL-NEXT: s_nop 1 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_cndmask_b32_e32 v1, v2, v5, vcc | ||
| ; GFX950-SAFE-GISEL-NEXT: v_lshrrev_b32_e32 v2, 16, v3 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_and_or_b32 v1, v2, v4, v1 | ||
| ; GFX950-SAFE-GISEL-NEXT: v_lshl_or_b32 v0, v1, 16, v0 | ||
| ; GFX950-SAFE-GISEL-NEXT: ; return to shader part epilog | ||
| ; | ||
| ; GFX950-UNSAFE-LABEL: v_test_cvt_v2f64_v2f16: | ||
| ; GFX950-UNSAFE: ; %bb.0: | ||
| ; GFX950-UNSAFE-NEXT: v_cvt_f32_f64_e32 v2, v[2:3] | ||
| ; GFX950-UNSAFE-NEXT: v_cvt_f32_f64_e32 v0, v[0:1] | ||
| ; GFX950-UNSAFE-NEXT: v_cvt_pk_f16_f32 v0, v0, v2 | ||
| ; GFX950-UNSAFE-NEXT: ; return to shader part epilog | ||
| %res = fptrunc <2 x double> %src to <2 x half> | ||
| ret <2 x half> %res | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It disables it not just from v2f64, but also from v2f32, right? How is that lowered then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though we also have a pattern for v2f64->v2f16, but we will do splitting the vector and then Custom lowering of f64 ->f16 first.
llvm-project/llvm/lib/Target/AMDGPU/VOP3Instructions.td
Line 1196 in 9b63a92
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the pattern shall not work for operation which is not legal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my observation is that, if we do not Expand/Custom/Promote, the pattern will be picked up, no matter you specify Legal or not. So it doesn't matter whether you specify Legal or not, pattern for v2f32->v2f16 wil always be picked up.
This is similar to f32 -> f16, even though we did not specify Legal, v_cvt_f16_f32 will still be selected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default is Legal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Legal is default:
https://llvm.org/docs/WritingAnLLVMBackend.html#legal
The reason we need to explicitly specify Legal sometimes is because we need to specify different Actions based on different hardware features.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am still learning. I think even though we specify Custom lowering but actually doing nothing, like:
if (SrcVT. != MVT::f64)
return Op; // f32 is legal for fp_round
This is essentially "Legal", which means either there is a native instruction, or a pattern to match to native instructions. The compiler will throw an error if there is nothing to select.