brintos

brintos / llvm-project-archived public Read only

0
0
Text · 13.8 KiB · d95c5a1 Raw
402 lines · plain
1; RUN: opt -S -passes=verify < %s | FileCheck %s2target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"3target triple = "aarch64--linux-gnu"4 5;; Check supported instructions are accepted without dropping 'vscale'.6;; Same order as the LangRef7 8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;9;; Unary Operations10;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;11 12 13define <vscale x 2 x double> @fneg(<vscale x 2 x double> %val) {14; CHECK-LABEL: @fneg15; CHECK: %r = fneg <vscale x 2 x double> %val16; CHECK-NEXT: ret <vscale x 2 x double> %r17  %r = fneg <vscale x 2 x double> %val18  ret <vscale x 2 x double> %r19}20 21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;22;; Binary Operations23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;24 25define <vscale x 8 x i16> @add(<vscale x 8 x i16> %a, <vscale x 8 x i16> %b) {26; CHECK-LABEL: @add27; CHECK: %r = add <vscale x 8 x i16> %a, %b28; CHECK-NEXT: ret <vscale x 8 x i16> %r29  %r = add <vscale x 8 x i16> %a, %b30  ret <vscale x 8 x i16> %r31}32 33define <vscale x 4 x float> @fadd(<vscale x 4 x float> %a, <vscale x 4 x float> %b) {34; CHECK-LABEL: @fadd35; CHECK: %r = fadd <vscale x 4 x float> %a, %b36; CHECK-NEXT: ret <vscale x 4 x float> %r37  %r = fadd <vscale x 4 x float> %a, %b38  ret <vscale x 4 x float> %r39}40 41define <vscale x 4 x i32> @sub(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {42; CHECK-LABEL: @sub43; CHECK: %r = sub <vscale x 4 x i32> %a, %b44; CHECK-NEXT: ret <vscale x 4 x i32> %r45  %r = sub <vscale x 4 x i32> %a, %b46  ret <vscale x 4 x i32> %r47}48 49define <vscale x 4 x float> @fsub(<vscale x 4 x float> %a, <vscale x 4 x float> %b) {50; CHECK-LABEL: @fsub51; CHECK: %r = fsub <vscale x 4 x float> %a, %b52; CHECK-NEXT: ret <vscale x 4 x float> %r53  %r = fsub <vscale x 4 x float> %a, %b54  ret <vscale x 4 x float> %r55}56 57define <vscale x 4 x i32> @mul(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {58; CHECK-LABEL: @mul59; CHECK: %r = mul <vscale x 4 x i32> %a, %b60; CHECK-NEXT: ret <vscale x 4 x i32> %r61  %r = mul <vscale x 4 x i32> %a, %b62  ret <vscale x 4 x i32> %r63}64 65define <vscale x 4 x float> @fmul(<vscale x 4 x float> %a, <vscale x 4 x float> %b) {66; CHECK-LABEL: @fmul67; CHECK: %r = fmul <vscale x 4 x float> %a, %b68; CHECK-NEXT: ret <vscale x 4 x float> %r69  %r = fmul <vscale x 4 x float> %a, %b70  ret <vscale x 4 x float> %r71}72 73define <vscale x 4 x i32> @udiv(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {74; CHECK-LABEL: @udiv75; CHECK: %r = udiv <vscale x 4 x i32> %a, %b76; CHECK-NEXT: ret <vscale x 4 x i32> %r77  %r = udiv <vscale x 4 x i32> %a, %b78  ret <vscale x 4 x i32> %r79}80 81define <vscale x 4 x i32> @sdiv(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {82; CHECK-LABEL: @sdiv83; CHECK: %r = sdiv <vscale x 4 x i32> %a, %b84; CHECK-NEXT: ret <vscale x 4 x i32> %r85  %r = sdiv <vscale x 4 x i32> %a, %b86  ret <vscale x 4 x i32> %r87}88 89define <vscale x 4 x float> @fdiv(<vscale x 4 x float> %a, <vscale x 4 x float> %b) {90; CHECK-LABEL: @fdiv91; CHECK: %r = fdiv <vscale x 4 x float> %a, %b92; CHECK-NEXT: ret <vscale x 4 x float> %r93  %r = fdiv <vscale x 4 x float> %a, %b94  ret <vscale x 4 x float> %r95}96 97define <vscale x 4 x i32> @urem(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {98; CHECK-LABEL: @urem99; CHECK: %r = urem <vscale x 4 x i32> %a, %b100; CHECK-NEXT: ret <vscale x 4 x i32> %r101  %r = urem <vscale x 4 x i32> %a, %b102  ret <vscale x 4 x i32> %r103}104 105define <vscale x 4 x i32> @srem(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {106; CHECK-LABEL: @srem107; CHECK: %r = srem <vscale x 4 x i32> %a, %b108; CHECK-NEXT: ret <vscale x 4 x i32> %r109  %r = srem <vscale x 4 x i32> %a, %b110  ret <vscale x 4 x i32> %r111}112 113define <vscale x 4 x float> @frem(<vscale x 4 x float> %a, <vscale x 4 x float> %b) {114; CHECK-LABEL: @frem115; CHECK: %r = frem <vscale x 4 x float> %a, %b116; CHECK-NEXT: ret <vscale x 4 x float> %r117  %r = frem <vscale x 4 x float> %a, %b118  ret <vscale x 4 x float> %r119}120 121;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;122;; Bitwise Binary Operations123;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;124 125define <vscale x 4 x i32> @shl(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {126; CHECK-LABEL: @shl127; CHECK: %r = shl <vscale x 4 x i32> %a, %b128; CHECK-NEXT: ret <vscale x 4 x i32> %r129  %r = shl <vscale x 4 x i32> %a, %b130  ret <vscale x 4 x i32> %r131}132 133define <vscale x 4 x i32> @lshr(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {134; CHECK-LABEL: @lshr135; CHECK: %r = lshr <vscale x 4 x i32> %a, %b136; CHECK-NEXT: ret <vscale x 4 x i32> %r137  %r = lshr <vscale x 4 x i32> %a, %b138  ret <vscale x 4 x i32> %r139}140 141define <vscale x 4 x i32> @ashr(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {142; CHECK-LABEL: @ashr143; CHECK: %r = ashr <vscale x 4 x i32> %a, %b144; CHECK-NEXT: ret <vscale x 4 x i32> %r145  %r = ashr <vscale x 4 x i32> %a, %b146  ret <vscale x 4 x i32> %r147}148 149define <vscale x 4 x i32> @and(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {150; CHECK-LABEL: @and151; CHECK: %r = and <vscale x 4 x i32> %a, %b152; CHECK-NEXT: ret <vscale x 4 x i32> %r153  %r = and <vscale x 4 x i32> %a, %b154  ret <vscale x 4 x i32> %r155}156 157define <vscale x 4 x i32> @or(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {158; CHECK-LABEL: @or159; CHECK: %r = or <vscale x 4 x i32> %a, %b160; CHECK-NEXT: ret <vscale x 4 x i32> %r161  %r = or <vscale x 4 x i32> %a, %b162  ret <vscale x 4 x i32> %r163}164 165define <vscale x 4 x i32> @xor(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {166; CHECK-LABEL: @xor167; CHECK: %r = xor <vscale x 4 x i32> %a, %b168; CHECK-NEXT: ret <vscale x 4 x i32> %r169  %r = xor <vscale x 4 x i32> %a, %b170  ret <vscale x 4 x i32> %r171}172 173;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;174;; Vector Operations175;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;176 177define i64 @extractelement(<vscale x 2 x i64> %val) {178; CHECK-LABEL: @extractelement179; CHECK: %r = extractelement <vscale x 2 x i64> %val, i32 0180; CHECK-NEXT: ret i64 %r181  %r = extractelement <vscale x 2 x i64> %val, i32 0182  ret i64 %r183}184 185define <vscale x 16 x i8> @insertelement(<vscale x 16 x i8> %vec, i8 %ins) {186; CHECK-LABEL: @insertelement187; CHECK: %r = insertelement <vscale x 16 x i8> %vec, i8 %ins, i32 0188; CHECK-NEXT: ret <vscale x 16 x i8> %r189  %r = insertelement <vscale x 16 x i8> %vec, i8 %ins, i32 0190  ret <vscale x 16 x i8> %r191}192 193define <vscale x 8 x half> @shufflevector(half %val) {194; CHECK-LABEL: @shufflevector195; CHECK: %insvec = insertelement <vscale x 8 x half> undef, half %val, i32 0196; CHECK-NEXT: %r = shufflevector <vscale x 8 x half> %insvec, <vscale x 8 x half> undef, <vscale x 8 x i32> zeroinitializer197; CHECK-NEXT: ret <vscale x 8 x half> %r198  %insvec = insertelement <vscale x 8 x half> undef, half %val, i32 0199  %r = shufflevector <vscale x 8 x half> %insvec, <vscale x 8 x half> undef, <vscale x 8 x i32> zeroinitializer200  ret <vscale x 8 x half> %r201}202 203define <vscale x 8 x half> @shufflevector2(half %val) {204; CHECK-LABEL: @shufflevector205; CHECK: %insvec = insertelement <vscale x 8 x half> poison, half %val, i32 0206; CHECK-NEXT: %r = shufflevector <vscale x 8 x half> %insvec, <vscale x 8 x half> undef, <vscale x 8 x i32> zeroinitializer207; CHECK-NEXT: ret <vscale x 8 x half> %r208  %insvec = insertelement <vscale x 8 x half> poison, half %val, i32 0209  %r = shufflevector <vscale x 8 x half> %insvec, <vscale x 8 x half> undef, <vscale x 8 x i32> zeroinitializer210  ret <vscale x 8 x half> %r211}212 213;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;214;; Memory Access and Addressing Operations215;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;216 217define void @alloca() {218; CHECK-LABEL: @alloca219; CHECK: %vec = alloca <vscale x 4 x i32>220; CHECK-NEXT: ret void221  %vec = alloca <vscale x 4 x i32>222  ret void223}224 225define <vscale x 2 x double> @load(ptr %ptr) {226; CHECK-LABEL: @load227; CHECK: %r = load <vscale x 2 x double>, ptr %ptr228; CHECK-NEXT: ret <vscale x 2 x double> %r229  %r = load <vscale x 2 x double>, ptr %ptr230  ret <vscale x 2 x double> %r231}232 233define void @store(<vscale x 4 x i32> %data, ptr %ptr) {234; CHECK-LABEL: @store235; CHECK: store <vscale x 4 x i32> %data, ptr %ptr236; CHECK-NEXT: ret void237  store <vscale x 4 x i32> %data, ptr %ptr238  ret void239}240 241define ptr @getelementptr(ptr %base) {242; CHECK-LABEL: @getelementptr243; CHECK-NEXT: ret ptr %base244  ret ptr %base245}246 247;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;248;; Conversion Operations249;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;250 251define <vscale x 4 x i32> @truncto(<vscale x 4 x i64> %val) {252; CHECK-LABEL: @truncto253; CHECK: %r = trunc <vscale x 4 x i64> %val to <vscale x 4 x i32>254; CHECK-NEXT: ret <vscale x 4 x i32> %r255  %r = trunc <vscale x 4 x i64> %val to <vscale x 4 x i32>256  ret <vscale x 4 x i32> %r257}258 259define <vscale x 2 x i64> @zextto(<vscale x 2 x i16> %val) {260; CHECK-LABEL: @zextto261; CHECK: %r = zext <vscale x 2 x i16> %val to <vscale x 2 x i64>262; CHECK-NEXT: ret <vscale x 2 x i64> %r263  %r = zext <vscale x 2 x i16> %val to <vscale x 2 x i64>264  ret <vscale x 2 x i64> %r265}266 267define <vscale x 4 x i32> @sextto(<vscale x 4 x i8> %val) {268; CHECK-LABEL: @sextto269; CHECK: %r = sext <vscale x 4 x i8> %val to <vscale x 4 x i32>270; CHECK-NEXT: ret <vscale x 4 x i32> %r271  %r = sext <vscale x 4 x i8> %val to <vscale x 4 x i32>272  ret <vscale x 4 x i32> %r273}274 275define <vscale x 4 x half> @fptruncto(<vscale x 4 x float> %val) {276; CHECK-LABEL: @fptruncto277; CHECK: %r = fptrunc <vscale x 4 x float> %val to <vscale x 4 x half>278; CHECK-NEXT: ret <vscale x 4 x half> %r279  %r = fptrunc <vscale x 4 x float> %val to <vscale x 4 x half>280  ret <vscale x 4 x half> %r281}282 283define <vscale x 2 x double> @fpextto(<vscale x 2 x half> %val) {284; CHECK-LABEL: @fpextto285; CHECK: %r = fpext <vscale x 2 x half> %val to <vscale x 2 x double>286; CHECK-NEXT: ret <vscale x 2 x double> %r287  %r = fpext <vscale x 2 x half> %val to <vscale x 2 x double>288  ret <vscale x 2 x double> %r289}290 291define <vscale x 4 x i32> @fptouito(<vscale x 4 x float> %val) {292; CHECK-LABEL: @fptoui293; CHECK: %r = fptoui <vscale x 4 x float> %val to <vscale x 4 x i32>294; CHECK-NEXT: ret <vscale x 4 x i32> %r295  %r = fptoui <vscale x 4 x float> %val to <vscale x 4 x i32>296  ret <vscale x 4 x i32> %r297}298 299define <vscale x 4 x i32> @fptosito(<vscale x 4 x float> %val) {300; CHECK-LABEL: @fptosi301; CHECK: %r = fptosi <vscale x 4 x float> %val to <vscale x 4 x i32>302; CHECK-NEXT: ret <vscale x 4 x i32> %r303  %r = fptosi <vscale x 4 x float> %val to <vscale x 4 x i32>304  ret <vscale x 4 x i32> %r305}306 307define <vscale x 4 x float> @uitofpto(<vscale x 4 x i32> %val) {308; CHECK-LABEL: @uitofp309; CHECK: %r = uitofp <vscale x 4 x i32> %val to <vscale x 4 x float>310; CHECK-NEXT: ret <vscale x 4 x float> %r311  %r = uitofp <vscale x 4 x i32> %val to <vscale x 4 x float>312  ret <vscale x 4 x float> %r313}314 315define <vscale x 4 x float> @sitofpto(<vscale x 4 x i32> %val) {316; CHECK-LABEL: @sitofp317; CHECK: %r = sitofp <vscale x 4 x i32> %val to <vscale x 4 x float>318; CHECK-NEXT: ret <vscale x 4 x float> %r319  %r = sitofp <vscale x 4 x i32> %val to <vscale x 4 x float>320  ret <vscale x 4 x float> %r321}322 323define <vscale x 2 x i64> @ptrtointto(<vscale x 2 x ptr> %val) {324; CHECK-LABEL: @ptrtointto325; CHECK: %r = ptrtoint <vscale x 2 x ptr> %val to <vscale x 2 x i64>326; CHECK-NEXT: ret <vscale x 2 x i64> %r327  %r = ptrtoint <vscale x 2 x ptr> %val to <vscale x 2 x i64>328  ret <vscale x 2 x i64> %r329}330 331define <vscale x 2 x ptr> @inttoptrto(<vscale x 2 x i64> %val) {332; CHECK-LABEL: @inttoptrto333; CHECK: %r = inttoptr <vscale x 2 x i64> %val to <vscale x 2 x ptr>334; CHECK-NEXT: ret <vscale x 2 x ptr> %r335  %r = inttoptr <vscale x 2 x i64> %val to <vscale x 2 x ptr>336  ret <vscale x 2 x ptr> %r337}338 339define <vscale x 2 x i64> @bitcastto(<vscale x 2 x double> %a) {340; CHECK-LABEL: @bitcast341; CHECK: %r = bitcast <vscale x 2 x double> %a to <vscale x 2 x i64>342; CHECK-NEXT: ret <vscale x 2 x i64> %r343  %r = bitcast <vscale x 2 x double> %a to <vscale x 2 x i64>344  ret <vscale x 2 x i64> %r345}346 347;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;348;; Other Operations349;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;350 351define <vscale x 4 x i1> @icmp(<vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {352; CHECK-LABEL: @icmp353; CHECK: %r = icmp eq <vscale x 4 x i32> %a, %b354; CHECK-NEXT: ret <vscale x 4 x i1> %r355  %r = icmp eq <vscale x 4 x i32> %a, %b356  ret <vscale x 4 x i1> %r357}358 359define <vscale x 4 x i1> @fcmp(<vscale x 4 x float> %a, <vscale x 4 x float> %b) {360; CHECK-LABEL: @fcmp361; CHECK: %r = fcmp une <vscale x 4 x float> %a, %b362; CHECK-NEXT: ret <vscale x 4 x i1> %r363  %r = fcmp une <vscale x 4 x float> %a, %b364  ret <vscale x 4 x i1> %r365}366 367define <vscale x 16 x i8> @phi(<vscale x 16 x i8> %a, i32 %val) {368; CHECK-LABEL: @phi369; CHECK: %r = phi <vscale x 16 x i8> [ %a, %entry ], [ %added, %iszero ]370; CHECK-NEXT: ret <vscale x 16 x i8> %r371entry:372  %cmp = icmp eq i32 %val, 0373  br i1 %cmp, label %iszero, label %end374 375iszero:376  %ins = insertelement <vscale x 16 x i8> undef, i8 1, i32 0377  %splatone = shufflevector <vscale x 16 x i8> %ins, <vscale x 16 x i8> undef, <vscale x 16 x i32> zeroinitializer378  %added = add <vscale x 16 x i8> %a, %splatone379  br label %end380 381end:382  %r = phi <vscale x 16 x i8> [ %a, %entry ], [ %added, %iszero ]383  ret <vscale x 16 x i8> %r384}385 386define <vscale x 8 x half> @select(<vscale x 8 x half> %a, <vscale x 8 x half> %b, <vscale x 8 x i1> %sval) {387; CHECK-LABEL: @select388; CHECK: %r = select <vscale x 8 x i1> %sval, <vscale x 8 x half> %a, <vscale x 8 x half> %b389; CHECK-NEXT: ret <vscale x 8 x half> %r390  %r = select <vscale x 8 x i1> %sval, <vscale x 8 x half> %a, <vscale x 8 x half> %b391  ret <vscale x 8 x half> %r392}393 394declare <vscale x 4 x i32> @callee(<vscale x 4 x i32>)395define <vscale x 4 x i32> @call(<vscale x 4 x i32> %val) {396; CHECK-LABEL: @call397; CHECK: %r = call <vscale x 4 x i32> @callee(<vscale x 4 x i32> %val)398; CHECK-NEXT: ret <vscale x 4 x i32> %r399  %r = call <vscale x 4 x i32> @callee(<vscale x 4 x i32> %val)400  ret <vscale x 4 x i32> %r401}402