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: %copy:_(s32) = COPY $vgpr0
14 ; GCN: %offset:_(s32) = COPY $vgpr1
15 ; GCN: %width:_(s32) = COPY $vgpr2
16 ; GCN: %ubfx:_(s32) = G_UBFX %copy, %offset(s32), %width
17 ; GCN: $vgpr0 = COPY %ubfx(s32)
18 %copy:_(s32) = COPY $vgpr0
19 %offset:_(s32) = COPY $vgpr1
20 %width:_(s32) = COPY $vgpr2
21 %ubfx:_(s32) = G_UBFX %copy, %offset(s32), %width
22 $vgpr0 = COPY %ubfx(s32)
29 liveins: $vgpr0_vgpr1, $vgpr2, $vgpr3
31 ; GCN-LABEL: name: test_ubfx_s64
32 ; GCN: %copy:_(s64) = COPY $vgpr0_vgpr1
33 ; GCN: %offset:_(s32) = COPY $vgpr2
34 ; GCN: %width:_(s32) = COPY $vgpr3
35 ; GCN: %ubfx:_(s64) = G_UBFX %copy, %offset(s32), %width
36 ; GCN: $vgpr0_vgpr1 = COPY %ubfx(s64)
37 %copy:_(s64) = COPY $vgpr0_vgpr1
38 %offset:_(s32) = COPY $vgpr2
39 %width:_(s32) = COPY $vgpr3
40 %ubfx:_(s64) = G_UBFX %copy, %offset(s32), %width
41 $vgpr0_vgpr1 = COPY %ubfx(s64)
48 liveins: $vgpr0, $vgpr1, $vgpr2
50 ; GCN-LABEL: name: test_ubfx_s8
51 ; GCN: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
52 ; GCN: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
53 ; GCN: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
54 ; GCN: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
55 ; GCN: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
56 ; GCN: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
57 ; GCN: [[UBFX:%[0-9]+]]:_(s32) = G_UBFX [[COPY]], [[AND]](s32), [[AND1]]
58 ; GCN: [[AND2:%[0-9]+]]:_(s32) = G_AND [[UBFX]], [[C]]
59 ; GCN: $vgpr0 = COPY [[AND2]](s32)
60 %0:_(s32) = COPY $vgpr0
61 %1:_(s32) = COPY $vgpr1
62 %2:_(s32) = COPY $vgpr2
63 %copy:_(s8) = G_TRUNC %0
64 %offset:_(s8) = G_TRUNC %1
65 %width:_(s8) = G_TRUNC %2
66 %ubfx:_(s8) = G_UBFX %copy, %offset, %width
67 %4:_(s32) = G_ZEXT %ubfx
75 liveins: $vgpr0, $vgpr1, $vgpr2
77 ; GCN-LABEL: name: test_ubfx_s16
78 ; GCN: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
79 ; GCN: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
80 ; GCN: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
81 ; GCN: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
82 ; GCN: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
83 ; GCN: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
84 ; GCN: [[UBFX:%[0-9]+]]:_(s32) = G_UBFX [[COPY]], [[AND]](s32), [[AND1]]
85 ; GCN: [[AND2:%[0-9]+]]:_(s32) = G_AND [[UBFX]], [[C]]
86 ; GCN: $vgpr0 = COPY [[AND2]](s32)
87 %0:_(s32) = COPY $vgpr0
88 %1:_(s32) = COPY $vgpr1
89 %2:_(s32) = COPY $vgpr2
90 %copy:_(s16) = G_TRUNC %0
91 %offset:_(s16) = G_TRUNC %1
92 %width:_(s16) = G_TRUNC %2
93 %sbfx:_(s16) = G_UBFX %copy, %offset, %width
94 %4:_(s32) = G_ZEXT %sbfx