1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -O0 -run-pass=legalizer %s -o - | FileCheck --check-prefix=GCN %s
3 # RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx900 -O0 -run-pass=legalizer %s -o - | FileCheck --check-prefix=GCN %s
4 # RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1010 -O0 -run-pass=legalizer %s -o - | FileCheck --check-prefix=GCN %s
10 liveins: $vgpr0, $vgpr1, $vgpr2
12 ; GCN-LABEL: name: test_ubfx_s32
13 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2
15 ; GCN-NEXT: %copy:_(s32) = COPY $vgpr0
16 ; GCN-NEXT: %offset:_(s32) = COPY $vgpr1
17 ; GCN-NEXT: %width:_(s32) = COPY $vgpr2
18 ; GCN-NEXT: %ubfx:_(s32) = G_UBFX %copy, %offset(s32), %width
19 ; GCN-NEXT: $vgpr0 = COPY %ubfx(s32)
20 %copy:_(s32) = COPY $vgpr0
21 %offset:_(s32) = COPY $vgpr1
22 %width:_(s32) = COPY $vgpr2
23 %ubfx:_(s32) = G_UBFX %copy, %offset(s32), %width
24 $vgpr0 = COPY %ubfx(s32)
31 liveins: $vgpr0_vgpr1, $vgpr2, $vgpr3
33 ; GCN-LABEL: name: test_ubfx_s64
34 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2, $vgpr3
36 ; GCN-NEXT: %copy:_(s64) = COPY $vgpr0_vgpr1
37 ; GCN-NEXT: %offset:_(s32) = COPY $vgpr2
38 ; GCN-NEXT: %width:_(s32) = COPY $vgpr3
39 ; GCN-NEXT: %ubfx:_(s64) = G_UBFX %copy, %offset(s32), %width
40 ; GCN-NEXT: $vgpr0_vgpr1 = COPY %ubfx(s64)
41 %copy:_(s64) = COPY $vgpr0_vgpr1
42 %offset:_(s32) = COPY $vgpr2
43 %width:_(s32) = COPY $vgpr3
44 %ubfx:_(s64) = G_UBFX %copy, %offset(s32), %width
45 $vgpr0_vgpr1 = COPY %ubfx(s64)
52 liveins: $vgpr0, $vgpr1, $vgpr2
54 ; GCN-LABEL: name: test_ubfx_s8
55 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2
57 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
58 ; GCN-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
59 ; GCN-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
60 ; GCN-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
61 ; GCN-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
62 ; GCN-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
63 ; GCN-NEXT: [[UBFX:%[0-9]+]]:_(s32) = G_UBFX [[COPY]], [[AND]](s32), [[AND1]]
64 ; GCN-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND [[UBFX]], [[C]]
65 ; GCN-NEXT: $vgpr0 = COPY [[AND2]](s32)
66 %0:_(s32) = COPY $vgpr0
67 %1:_(s32) = COPY $vgpr1
68 %2:_(s32) = COPY $vgpr2
69 %copy:_(s8) = G_TRUNC %0
70 %offset:_(s8) = G_TRUNC %1
71 %width:_(s8) = G_TRUNC %2
72 %ubfx:_(s8) = G_UBFX %copy, %offset, %width
73 %4:_(s32) = G_ZEXT %ubfx
81 liveins: $vgpr0, $vgpr1, $vgpr2
83 ; GCN-LABEL: name: test_ubfx_s16
84 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2
86 ; GCN-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
87 ; GCN-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
88 ; GCN-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
89 ; GCN-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
90 ; GCN-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
91 ; GCN-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
92 ; GCN-NEXT: [[UBFX:%[0-9]+]]:_(s32) = G_UBFX [[COPY]], [[AND]](s32), [[AND1]]
93 ; GCN-NEXT: [[AND2:%[0-9]+]]:_(s32) = G_AND [[UBFX]], [[C]]
94 ; GCN-NEXT: $vgpr0 = COPY [[AND2]](s32)
95 %0:_(s32) = COPY $vgpr0
96 %1:_(s32) = COPY $vgpr1
97 %2:_(s32) = COPY $vgpr2
98 %copy:_(s16) = G_TRUNC %0
99 %offset:_(s16) = G_TRUNC %1
100 %width:_(s16) = G_TRUNC %2
101 %sbfx:_(s16) = G_UBFX %copy, %offset, %width
102 %4:_(s32) = G_ZEXT %sbfx