182 lines · plain
1; RUN: llc < %s -mtriple=ve-unknown-unknown | FileCheck %s2 3declare i128 @llvm.cttz.i128(i128, i1)4declare i64 @llvm.cttz.i64(i64, i1)5declare i32 @llvm.cttz.i32(i32, i1)6declare i16 @llvm.cttz.i16(i16, i1)7declare i8 @llvm.cttz.i8(i8, i1)8 9define i128 @func128(i128 %p) {10; CHECK-LABEL: func128:11; CHECK: # %bb.0:12; CHECK-NEXT: lea %s2, -1(, %s0)13; CHECK-NEXT: nnd %s2, %s0, %s214; CHECK-NEXT: pcnt %s3, %s215; CHECK-NEXT: lea %s2, -1(, %s1)16; CHECK-NEXT: nnd %s1, %s1, %s217; CHECK-NEXT: pcnt %s1, %s118; CHECK-NEXT: lea %s2, 64(, %s1)19; CHECK-NEXT: cmov.l.ne %s2, %s3, %s020; CHECK-NEXT: or %s1, 0, (0)121; CHECK-NEXT: or %s0, 0, %s222; CHECK-NEXT: b.l.t (, %s10)23 %r = tail call i128 @llvm.cttz.i128(i128 %p, i1 true)24 ret i128 %r25}26 27define i64 @func64(i64 %p) {28; CHECK-LABEL: func64:29; CHECK: # %bb.0:30; CHECK-NEXT: lea %s1, -1(, %s0)31; CHECK-NEXT: nnd %s0, %s0, %s132; CHECK-NEXT: pcnt %s0, %s033; CHECK-NEXT: b.l.t (, %s10)34 %r = tail call i64 @llvm.cttz.i64(i64 %p, i1 true)35 ret i64 %r36}37 38define signext i32 @func32s(i32 signext %p) {39; CHECK-LABEL: func32s:40; CHECK: # %bb.0:41; CHECK-NEXT: adds.w.sx %s1, -1, %s042; CHECK-NEXT: nnd %s0, %s0, %s143; CHECK-NEXT: and %s0, %s0, (32)044; CHECK-NEXT: pcnt %s0, %s045; CHECK-NEXT: b.l.t (, %s10)46 %r = tail call i32 @llvm.cttz.i32(i32 %p, i1 true)47 ret i32 %r48}49 50define zeroext i32 @func32z(i32 zeroext %p) {51; CHECK-LABEL: func32z:52; CHECK: # %bb.0:53; CHECK-NEXT: adds.w.sx %s1, -1, %s054; CHECK-NEXT: nnd %s0, %s0, %s155; CHECK-NEXT: and %s0, %s0, (32)056; CHECK-NEXT: pcnt %s0, %s057; CHECK-NEXT: b.l.t (, %s10)58 %r = tail call i32 @llvm.cttz.i32(i32 %p, i1 true)59 ret i32 %r60}61 62define signext i16 @func16s(i16 signext %p) {63; CHECK-LABEL: func16s:64; CHECK: # %bb.0:65; CHECK-NEXT: adds.w.sx %s1, -1, %s066; CHECK-NEXT: nnd %s0, %s0, %s167; CHECK-NEXT: and %s0, %s0, (48)068; CHECK-NEXT: pcnt %s0, %s069; CHECK-NEXT: b.l.t (, %s10)70 %r = tail call i16 @llvm.cttz.i16(i16 %p, i1 true)71 ret i16 %r72}73 74define zeroext i16 @func16z(i16 zeroext %p) {75; CHECK-LABEL: func16z:76; CHECK: # %bb.0:77; CHECK-NEXT: adds.w.sx %s1, -1, %s078; CHECK-NEXT: nnd %s0, %s0, %s179; CHECK-NEXT: and %s0, %s0, (48)080; CHECK-NEXT: pcnt %s0, %s081; CHECK-NEXT: b.l.t (, %s10)82 %r = tail call i16 @llvm.cttz.i16(i16 %p, i1 true)83 ret i16 %r84}85 86define signext i8 @func8s(i8 signext %p) {87; CHECK-LABEL: func8s:88; CHECK: # %bb.0:89; CHECK-NEXT: adds.w.sx %s1, -1, %s090; CHECK-NEXT: nnd %s0, %s0, %s191; CHECK-NEXT: and %s0, %s0, (56)092; CHECK-NEXT: pcnt %s0, %s093; CHECK-NEXT: b.l.t (, %s10)94 %r = tail call i8 @llvm.cttz.i8(i8 %p, i1 true)95 ret i8 %r96}97 98define zeroext i8 @func8z(i8 zeroext %p) {99; CHECK-LABEL: func8z:100; CHECK: # %bb.0:101; CHECK-NEXT: adds.w.sx %s1, -1, %s0102; CHECK-NEXT: nnd %s0, %s0, %s1103; CHECK-NEXT: and %s0, %s0, (56)0104; CHECK-NEXT: pcnt %s0, %s0105; CHECK-NEXT: b.l.t (, %s10)106 %r = tail call i8 @llvm.cttz.i8(i8 %p, i1 true)107 ret i8 %r108}109 110define i128 @func128i() {111; CHECK-LABEL: func128i:112; CHECK: # %bb.0:113; CHECK-NEXT: or %s0, 8, (0)1114; CHECK-NEXT: or %s1, 0, (0)1115; CHECK-NEXT: b.l.t (, %s10)116 %r = tail call i128 @llvm.cttz.i128(i128 65280, i1 true)117 ret i128 %r118}119 120define i64 @func64i() {121; CHECK-LABEL: func64i:122; CHECK: # %bb.0:123; CHECK-NEXT: or %s0, 8, (0)1124; CHECK-NEXT: b.l.t (, %s10)125 %r = tail call i64 @llvm.cttz.i64(i64 65280, i1 true)126 ret i64 %r127}128 129define signext i32 @func32is() {130; CHECK-LABEL: func32is:131; CHECK: # %bb.0:132; CHECK-NEXT: or %s0, 8, (0)1133; CHECK-NEXT: b.l.t (, %s10)134 %r = tail call i32 @llvm.cttz.i32(i32 65280, i1 true)135 ret i32 %r136}137 138define zeroext i32 @func32iz() {139; CHECK-LABEL: func32iz:140; CHECK: # %bb.0:141; CHECK-NEXT: or %s0, 8, (0)1142; CHECK-NEXT: b.l.t (, %s10)143 %r = tail call i32 @llvm.cttz.i32(i32 65280, i1 true)144 ret i32 %r145}146 147define signext i16 @func16is() {148; CHECK-LABEL: func16is:149; CHECK: # %bb.0:150; CHECK-NEXT: or %s0, 8, (0)1151; CHECK-NEXT: b.l.t (, %s10)152 %r = tail call i16 @llvm.cttz.i16(i16 65280, i1 true)153 ret i16 %r154}155 156define zeroext i16 @func16iz() {157; CHECK-LABEL: func16iz:158; CHECK: # %bb.0:159; CHECK-NEXT: or %s0, 8, (0)1160; CHECK-NEXT: b.l.t (, %s10)161 %r = tail call i16 @llvm.cttz.i16(i16 65280, i1 true)162 ret i16 %r163}164 165define signext i8 @func8is() {166; CHECK-LABEL: func8is:167; CHECK: # %bb.0:168; CHECK-NEXT: or %s0, 4, (0)1169; CHECK-NEXT: b.l.t (, %s10)170 %r = tail call i8 @llvm.cttz.i8(i8 240, i1 true)171 ret i8 %r172}173 174define zeroext i8 @func8iz() {175; CHECK-LABEL: func8iz:176; CHECK: # %bb.0:177; CHECK-NEXT: or %s0, 4, (0)1178; CHECK-NEXT: b.l.t (, %s10)179 %r = tail call i8 @llvm.cttz.i8(i8 240, i1 true)180 ret i8 %r181}182