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_sbfx_s32
13 ; GCN: %copy:_(s32) = COPY $vgpr0
14 ; GCN: %offset:_(s32) = COPY $vgpr1
15 ; GCN: %width:_(s32) = COPY $vgpr2
16 ; GCN: %sbfx:_(s32) = G_SBFX %copy, %offset(s32), %width
17 ; GCN: $vgpr0 = COPY %sbfx(s32)
18 %copy:_(s32) = COPY $vgpr0
19 %offset:_(s32) = COPY $vgpr1
20 %width:_(s32) = COPY $vgpr2
21 %sbfx:_(s32) = G_SBFX %copy, %offset(s32), %width
22 $vgpr0 = COPY %sbfx(s32)
29 liveins: $vgpr0_vgpr1, $vgpr2, $vgpr3
31 ; GVN-LABEL: name: test_sbfx_s64
32 ; GVN: %copy:_(s64) = COPY $vgpr0_vgpr1
33 ; GVN: %offset:_(s32) = COPY $vgpr2
34 ; GVN: %width:_(s32) = COPY $vgpr3
35 ; GVN: %sbfx:_(s64) = G_SBFX %copy, %offset(s32), %width
36 ; GVN: $vgpr0_vgpr1 = COPY %sbfx(s64)
37 %copy:_(s64) = COPY $vgpr0_vgpr1
38 %offset:_(s32) = COPY $vgpr2
39 %width:_(s32) = COPY $vgpr3
40 %sbfx:_(s64) = G_SBFX %copy, %offset(s32), %width
41 $vgpr0_vgpr1 = COPY %sbfx(s64)
48 liveins: $vgpr0, $vgpr1, $vgpr2
50 ; GVN-LABEL: name: test_sbfx_s8
51 ; GVN: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
52 ; GVN: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
53 ; GVN: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
54 ; GVN: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
55 ; GVN: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
56 ; GVN: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
57 ; GVN: [[COPY4:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
58 ; GVN: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY4]], [[C]]
59 ; GVN: [[COPY5:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
60 ; GVN: [[SBFX:%[0-9]+]]:_(s32) = G_SBFX [[COPY5]], [[AND]](s32), [[AND1]]
61 ; GVN: [[COPY6:%[0-9]+]]:_(s32) = COPY [[SBFX]](s32)
62 ; GVN: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY6]], 8
63 ; GVN: $vgpr0 = COPY [[SEXT_INREG]](s32)
64 %0:_(s32) = COPY $vgpr0
65 %1:_(s32) = COPY $vgpr1
66 %2:_(s32) = COPY $vgpr2
67 %copy:_(s8) = G_TRUNC %0
68 %offset:_(s8) = G_TRUNC %1
69 %width:_(s8) = G_TRUNC %2
70 %sbfx:_(s8) = G_SBFX %copy, %offset, %width
71 %4:_(s32) = G_SEXT %sbfx
79 liveins: $vgpr0, $vgpr1, $vgpr2
81 ; GVN-LABEL: name: test_sbfx_s16
82 ; GVN: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
83 ; GVN: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
84 ; GVN: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr2
85 ; GVN: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
86 ; GVN: [[COPY3:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
87 ; GVN: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY3]], [[C]]
88 ; GVN: [[COPY4:%[0-9]+]]:_(s32) = COPY [[COPY2]](s32)
89 ; GVN: [[AND1:%[0-9]+]]:_(s32) = G_AND [[COPY4]], [[C]]
90 ; GVN: [[COPY5:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
91 ; GVN: [[SBFX:%[0-9]+]]:_(s32) = G_SBFX [[COPY5]], [[AND]](s32), [[AND1]]
92 ; GVN: [[COPY6:%[0-9]+]]:_(s32) = COPY [[SBFX]](s32)
93 ; GVN: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY6]], 16
94 ; GVN: $vgpr0 = COPY [[SEXT_INREG]](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_SBFX %copy, %offset, %width
102 %4:_(s32) = G_SEXT %sbfx