257 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 42; RUN: llc < %s -mtriple=ve-unknown-unknown | FileCheck %s3 4declare i128 @llvm.ctlz.i128(i128, i1)5declare i64 @llvm.ctlz.i64(i64, i1)6declare i32 @llvm.ctlz.i32(i32, i1)7declare i16 @llvm.ctlz.i16(i16, i1)8declare i8 @llvm.ctlz.i8(i8, i1)9 10define i128 @func128(i128 %p){11; CHECK-LABEL: func128:12; CHECK: # %bb.0:13; CHECK-NEXT: ldz %s2, %s114; CHECK-NEXT: ldz %s0, %s015; CHECK-NEXT: lea %s0, 64(, %s0)16; CHECK-NEXT: cmov.l.ne %s0, %s2, %s117; CHECK-NEXT: or %s1, 0, (0)118; CHECK-NEXT: b.l.t (, %s10)19 %r = tail call i128 @llvm.ctlz.i128(i128 %p, i1 true)20 ret i128 %r21}22 23define i64 @func64(i64 %p) {24; CHECK-LABEL: func64:25; CHECK: # %bb.0:26; CHECK-NEXT: ldz %s0, %s027; CHECK-NEXT: b.l.t (, %s10)28 %r = tail call i64 @llvm.ctlz.i64(i64 %p, i1 true)29 ret i64 %r30}31 32define signext i32 @func32s(i32 signext %p) {33; CHECK-LABEL: func32s:34; CHECK: # %bb.0:35; CHECK-NEXT: sll %s0, %s0, 3236; CHECK-NEXT: ldz %s0, %s037; CHECK-NEXT: b.l.t (, %s10)38 %r = tail call i32 @llvm.ctlz.i32(i32 %p, i1 true)39 ret i32 %r40}41 42define zeroext i32 @func32z(i32 zeroext %p) {43; CHECK-LABEL: func32z:44; CHECK: # %bb.0:45; CHECK-NEXT: sll %s0, %s0, 3246; CHECK-NEXT: ldz %s0, %s047; CHECK-NEXT: b.l.t (, %s10)48 %r = tail call i32 @llvm.ctlz.i32(i32 %p, i1 true)49 ret i32 %r50}51 52define signext i16 @func16s(i16 signext %p) {53; CHECK-LABEL: func16s:54; CHECK: # %bb.0:55; CHECK-NEXT: sll %s0, %s0, 4856; CHECK-NEXT: ldz %s0, %s057; CHECK-NEXT: b.l.t (, %s10)58 %r = tail call i16 @llvm.ctlz.i16(i16 %p, i1 true)59 ret i16 %r60}61 62define zeroext i16 @func16z(i16 zeroext %p) {63; CHECK-LABEL: func16z:64; CHECK: # %bb.0:65; CHECK-NEXT: sll %s0, %s0, 4866; CHECK-NEXT: ldz %s0, %s067; CHECK-NEXT: b.l.t (, %s10)68 %r = tail call i16 @llvm.ctlz.i16(i16 %p, i1 true)69 ret i16 %r70}71 72define signext i8 @func8s(i8 signext %p) {73; CHECK-LABEL: func8s:74; CHECK: # %bb.0:75; CHECK-NEXT: sll %s0, %s0, 5676; CHECK-NEXT: ldz %s0, %s077; CHECK-NEXT: b.l.t (, %s10)78 %r = tail call i8 @llvm.ctlz.i8(i8 %p, i1 true)79 ret i8 %r80}81 82define zeroext i8 @func8z(i8 zeroext %p) {83; CHECK-LABEL: func8z:84; CHECK: # %bb.0:85; CHECK-NEXT: sll %s0, %s0, 5686; CHECK-NEXT: ldz %s0, %s087; CHECK-NEXT: b.l.t (, %s10)88 %r = tail call i8 @llvm.ctlz.i8(i8 %p, i1 true)89 ret i8 %r90}91 92define i128 @func128i(){93; CHECK-LABEL: func128i:94; CHECK: # %bb.0:95; CHECK-NEXT: lea %s0, 11296; CHECK-NEXT: or %s1, 0, (0)197; CHECK-NEXT: b.l.t (, %s10)98 %r = tail call i128 @llvm.ctlz.i128(i128 65535, i1 true)99 ret i128 %r100}101 102define i64 @func64i() {103; CHECK-LABEL: func64i:104; CHECK: # %bb.0:105; CHECK-NEXT: or %s0, 48, (0)1106; CHECK-NEXT: b.l.t (, %s10)107 %r = tail call i64 @llvm.ctlz.i64(i64 65535, i1 true)108 ret i64 %r109}110 111define signext i32 @func32is() {112; CHECK-LABEL: func32is:113; CHECK: # %bb.0:114; CHECK-NEXT: or %s0, 16, (0)1115; CHECK-NEXT: b.l.t (, %s10)116 %r = tail call i32 @llvm.ctlz.i32(i32 65535, i1 true)117 ret i32 %r118}119 120define zeroext i32 @func32iz() {121; CHECK-LABEL: func32iz:122; CHECK: # %bb.0:123; CHECK-NEXT: or %s0, 16, (0)1124; CHECK-NEXT: b.l.t (, %s10)125 %r = tail call i32 @llvm.ctlz.i32(i32 65535, i1 true)126 ret i32 %r127}128 129define signext i16 @func16is() {130; CHECK-LABEL: func16is:131; CHECK: # %bb.0:132; CHECK-NEXT: or %s0, 8, (0)1133; CHECK-NEXT: b.l.t (, %s10)134 %r = tail call i16 @llvm.ctlz.i16(i16 255, i1 true)135 ret i16 %r136}137 138define zeroext i16 @func16iz() {139; CHECK-LABEL: func16iz:140; CHECK: # %bb.0:141; CHECK-NEXT: or %s0, 8, (0)1142; CHECK-NEXT: b.l.t (, %s10)143 %r = tail call i16 @llvm.ctlz.i16(i16 255, i1 true)144 ret i16 %r145}146 147define signext i8 @func8is() {148; CHECK-LABEL: func8is:149; CHECK: # %bb.0:150; CHECK-NEXT: or %s0, 0, (0)1151; CHECK-NEXT: b.l.t (, %s10)152 %r = tail call i8 @llvm.ctlz.i8(i8 255, i1 true)153 ret i8 %r154}155 156define zeroext i8 @func8iz() {157; CHECK-LABEL: func8iz:158; CHECK: # %bb.0:159; CHECK-NEXT: or %s0, 0, (0)1160; CHECK-NEXT: b.l.t (, %s10)161 %r = tail call i8 @llvm.ctlz.i8(i8 255, i1 true)162 ret i8 %r163}164 165define i128 @func128x(i128 %p){166; CHECK-LABEL: func128x:167; CHECK: # %bb.0:168; CHECK-NEXT: ldz %s2, %s1169; CHECK-NEXT: ldz %s0, %s0170; CHECK-NEXT: lea %s0, 64(, %s0)171; CHECK-NEXT: cmov.l.ne %s0, %s2, %s1172; CHECK-NEXT: or %s1, 0, (0)1173; CHECK-NEXT: b.l.t (, %s10)174 %r = tail call i128 @llvm.ctlz.i128(i128 %p, i1 false)175 ret i128 %r176}177 178define i64 @func64x(i64 %p) {179; CHECK-LABEL: func64x:180; CHECK: # %bb.0:181; CHECK-NEXT: ldz %s0, %s0182; CHECK-NEXT: b.l.t (, %s10)183 %r = tail call i64 @llvm.ctlz.i64(i64 %p, i1 false)184 ret i64 %r185}186 187define signext i32 @func32sx(i32 signext %p) {188; CHECK-LABEL: func32sx:189; CHECK: # %bb.0:190; CHECK-NEXT: and %s0, %s0, (32)0191; CHECK-NEXT: ldz %s0, %s0192; CHECK-NEXT: lea %s0, -32(, %s0)193; CHECK-NEXT: b.l.t (, %s10)194 %r = tail call i32 @llvm.ctlz.i32(i32 %p, i1 false)195 ret i32 %r196}197 198define zeroext i32 @func32zx(i32 zeroext %p) {199; CHECK-LABEL: func32zx:200; CHECK: # %bb.0:201; CHECK-NEXT: ldz %s0, %s0202; CHECK-NEXT: lea %s0, -32(, %s0)203; CHECK-NEXT: b.l.t (, %s10)204 %r = tail call i32 @llvm.ctlz.i32(i32 %p, i1 false)205 ret i32 %r206}207 208define signext i16 @func16sx(i16 signext %p) {209; CHECK-LABEL: func16sx:210; CHECK: # %bb.0:211; CHECK-NEXT: and %s0, %s0, (48)0212; CHECK-NEXT: ldz %s0, %s0213; CHECK-NEXT: lea %s0, -32(, %s0)214; CHECK-NEXT: adds.w.sx %s0, -16, %s0215; CHECK-NEXT: and %s0, %s0, (48)0216; CHECK-NEXT: b.l.t (, %s10)217 %r = tail call i16 @llvm.ctlz.i16(i16 %p, i1 false)218 ret i16 %r219}220 221define zeroext i16 @func16zx(i16 zeroext %p) {222; CHECK-LABEL: func16zx:223; CHECK: # %bb.0:224; CHECK-NEXT: ldz %s0, %s0225; CHECK-NEXT: lea %s0, -32(, %s0)226; CHECK-NEXT: adds.w.sx %s0, -16, %s0227; CHECK-NEXT: and %s0, %s0, (48)0228; CHECK-NEXT: b.l.t (, %s10)229 %r = tail call i16 @llvm.ctlz.i16(i16 %p, i1 false)230 ret i16 %r231}232 233define signext i8 @func8sx(i8 signext %p) {234; CHECK-LABEL: func8sx:235; CHECK: # %bb.0:236; CHECK-NEXT: and %s0, %s0, (56)0237; CHECK-NEXT: ldz %s0, %s0238; CHECK-NEXT: lea %s0, -32(, %s0)239; CHECK-NEXT: adds.w.sx %s0, -24, %s0240; CHECK-NEXT: and %s0, %s0, (56)0241; CHECK-NEXT: b.l.t (, %s10)242 %r = tail call i8 @llvm.ctlz.i8(i8 %p, i1 false)243 ret i8 %r244}245 246define zeroext i8 @func8zx(i8 zeroext %p) {247; CHECK-LABEL: func8zx:248; CHECK: # %bb.0:249; CHECK-NEXT: ldz %s0, %s0250; CHECK-NEXT: lea %s0, -32(, %s0)251; CHECK-NEXT: adds.w.sx %s0, -24, %s0252; CHECK-NEXT: and %s0, %s0, (56)0253; CHECK-NEXT: b.l.t (, %s10)254 %r = tail call i8 @llvm.ctlz.i8(i8 %p, i1 false)255 ret i8 %r256}257