1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ;RUN: llc < %s -mtriple=amdgcn-amd-mesa3d -mcpu=fiji -verify-machineinstrs | FileCheck -check-prefix=VI %s
3 ;RUN: llc < %s -mtriple=amdgcn-amd-mesa3d -mcpu=gfx900 -verify-machineinstrs | FileCheck -check-prefix=GFX9 %s
4 ;RUN: llc < %s -mtriple=amdgcn-amd-mesa3d -mcpu=gfx1010 -verify-machineinstrs | FileCheck -check-prefix=GFX10 %s
5 ;RUN: llc < %s -mtriple=amdgcn-amd-mesa3d -mcpu=gfx1100 -amdgpu-enable-delay-alu=0 -verify-machineinstrs | FileCheck -check-prefix=GFX10 %s
7 ; ===================================================================================
9 ; ===================================================================================
11 define amdgpu_ps float @and_or(i32 %a, i32 %b, i32 %c) {
14 ; VI-NEXT: v_and_b32_e32 v0, v0, v1
15 ; VI-NEXT: v_or_b32_e32 v0, v0, v2
16 ; VI-NEXT: ; return to shader part epilog
20 ; GFX9-NEXT: v_and_or_b32 v0, v0, v1, v2
21 ; GFX9-NEXT: ; return to shader part epilog
23 ; GFX10-LABEL: and_or:
25 ; GFX10-NEXT: v_and_or_b32 v0, v0, v1, v2
26 ; GFX10-NEXT: ; return to shader part epilog
28 %result = or i32 %x, %c
29 %bc = bitcast i32 %result to float
33 ; ThreeOp instruction variant not used due to Constant Bus Limitations
34 define amdgpu_ps float @and_or_vgpr_b(i32 inreg %a, i32 %b, i32 inreg %c) {
35 ; VI-LABEL: and_or_vgpr_b:
37 ; VI-NEXT: v_and_b32_e32 v0, s2, v0
38 ; VI-NEXT: v_or_b32_e32 v0, s3, v0
39 ; VI-NEXT: ; return to shader part epilog
41 ; GFX9-LABEL: and_or_vgpr_b:
43 ; GFX9-NEXT: v_and_b32_e32 v0, s2, v0
44 ; GFX9-NEXT: v_or_b32_e32 v0, s3, v0
45 ; GFX9-NEXT: ; return to shader part epilog
47 ; GFX10-LABEL: and_or_vgpr_b:
49 ; GFX10-NEXT: v_and_or_b32 v0, s2, v0, s3
50 ; GFX10-NEXT: ; return to shader part epilog
52 %result = or i32 %x, %c
53 %bc = bitcast i32 %result to float
57 define amdgpu_ps float @and_or_vgpr_ab(i32 %a, i32 %b, i32 inreg %c) {
58 ; VI-LABEL: and_or_vgpr_ab:
60 ; VI-NEXT: v_and_b32_e32 v0, v0, v1
61 ; VI-NEXT: v_or_b32_e32 v0, s2, v0
62 ; VI-NEXT: ; return to shader part epilog
64 ; GFX9-LABEL: and_or_vgpr_ab:
66 ; GFX9-NEXT: v_and_or_b32 v0, v0, v1, s2
67 ; GFX9-NEXT: ; return to shader part epilog
69 ; GFX10-LABEL: and_or_vgpr_ab:
71 ; GFX10-NEXT: v_and_or_b32 v0, v0, v1, s2
72 ; GFX10-NEXT: ; return to shader part epilog
74 %result = or i32 %x, %c
75 %bc = bitcast i32 %result to float
79 define amdgpu_ps float @and_or_vgpr_const(i32 %a, i32 %b) {
80 ; VI-LABEL: and_or_vgpr_const:
82 ; VI-NEXT: v_and_b32_e32 v0, 4, v0
83 ; VI-NEXT: v_or_b32_e32 v0, v0, v1
84 ; VI-NEXT: ; return to shader part epilog
86 ; GFX9-LABEL: and_or_vgpr_const:
88 ; GFX9-NEXT: v_and_or_b32 v0, v0, 4, v1
89 ; GFX9-NEXT: ; return to shader part epilog
91 ; GFX10-LABEL: and_or_vgpr_const:
93 ; GFX10-NEXT: v_and_or_b32 v0, v0, 4, v1
94 ; GFX10-NEXT: ; return to shader part epilog
96 %result = or i32 %x, %b
97 %bc = bitcast i32 %result to float
101 define amdgpu_ps float @and_or_vgpr_const_inline_const(i32 %a) {
102 ; VI-LABEL: and_or_vgpr_const_inline_const:
104 ; VI-NEXT: v_and_b32_e32 v0, 20, v0
105 ; VI-NEXT: v_or_b32_e32 v0, 0x808, v0
106 ; VI-NEXT: ; return to shader part epilog
108 ; GFX9-LABEL: and_or_vgpr_const_inline_const:
110 ; GFX9-NEXT: v_mov_b32_e32 v1, 0x808
111 ; GFX9-NEXT: v_and_or_b32 v0, v0, 20, v1
112 ; GFX9-NEXT: ; return to shader part epilog
114 ; GFX10-LABEL: and_or_vgpr_const_inline_const:
116 ; GFX10-NEXT: v_and_or_b32 v0, v0, 20, 0x808
117 ; GFX10-NEXT: ; return to shader part epilog
119 %result = or i32 %x, 2056
120 %bc = bitcast i32 %result to float
124 define amdgpu_ps float @and_or_vgpr_inline_const_x2(i32 %a) {
125 ; VI-LABEL: and_or_vgpr_inline_const_x2:
127 ; VI-NEXT: v_and_b32_e32 v0, 4, v0
128 ; VI-NEXT: v_or_b32_e32 v0, 1, v0
129 ; VI-NEXT: ; return to shader part epilog
131 ; GFX9-LABEL: and_or_vgpr_inline_const_x2:
133 ; GFX9-NEXT: v_and_or_b32 v0, v0, 4, 1
134 ; GFX9-NEXT: ; return to shader part epilog
136 ; GFX10-LABEL: and_or_vgpr_inline_const_x2:
138 ; GFX10-NEXT: v_and_or_b32 v0, v0, 4, 1
139 ; GFX10-NEXT: ; return to shader part epilog
141 %result = or i32 %x, 1
142 %bc = bitcast i32 %result to float