87 lines · plain
1; RUN: llc -mtriple=bpfel -mcpu=v4 -verify-machineinstrs -show-mc-encoding < %s | FileCheck %s2; Source:3; short f1(int a) {4; return (char)a;5; }6; int f2(int a) {7; return (short)a;8; }9; long f3(int a) {10; return (char)a;11; }12; long f4(int a) {13; return (short)a;14; }15; long f5(int a) {16; return a;17; }18; long f6(long a) {19; return (int)a;20; }21; Compilation flags:22; clang -target bpf -O2 -mcpu=v4 -S -emit-llvm t.c23 24; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)25define dso_local i16 @f1(i32 noundef %a) local_unnamed_addr #0 {26entry:27 %conv = trunc i32 %a to i828 %conv1 = sext i8 %conv to i1629 ret i16 %conv130}31; CHECK: w0 = (s8)w1 # encoding: [0xbc,0x10,0x08,0x00,0x00,0x00,0x00,0x00]32 33; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)34define dso_local i32 @f2(i32 noundef %a) local_unnamed_addr #0 {35entry:36 %sext = shl i32 %a, 1637 %conv1 = ashr exact i32 %sext, 1638 ret i32 %conv139}40; CHECK: w0 = (s16)w1 # encoding: [0xbc,0x10,0x10,0x00,0x00,0x00,0x00,0x00]41 42; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)43define dso_local i64 @f3(i32 noundef %a) local_unnamed_addr #0 {44entry:45 %conv = zext i32 %a to i6446 %sext = shl i64 %conv, 5647 %conv1 = ashr exact i64 %sext, 5648 ret i64 %conv149}50; CHECK: r0 = (s8)r1 # encoding: [0xbf,0x10,0x08,0x00,0x00,0x00,0x00,0x00]51 52; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)53define dso_local i64 @f4(i32 noundef %a) local_unnamed_addr #0 {54entry:55 %conv = zext i32 %a to i6456 %sext = shl i64 %conv, 4857 %conv1 = ashr exact i64 %sext, 4858 ret i64 %conv159}60; CHECK: r0 = (s16)r1 # encoding: [0xbf,0x10,0x10,0x00,0x00,0x00,0x00,0x00]61 62; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)63define dso_local i64 @f5(i32 noundef %a) local_unnamed_addr #0 {64entry:65 %conv = sext i32 %a to i6466 ret i64 %conv67}68; CHECK: r0 = (s32)r1 # encoding: [0xbf,0x10,0x20,0x00,0x00,0x00,0x00,0x00]69 70; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)71define dso_local i64 @f6(i64 noundef %a) local_unnamed_addr #0 {72entry:73 %sext = shl i64 %a, 3274 %conv1 = ashr exact i64 %sext, 3275 ret i64 %conv176}77; CHECK: r0 = (s32)r1 # encoding: [0xbf,0x10,0x20,0x00,0x00,0x00,0x00,0x00]78 79attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="v4" }80 81!llvm.module.flags = !{!0, !1}82!llvm.ident = !{!2}83 84!0 = !{i32 1, !"wchar_size", i32 4}85!1 = !{i32 7, !"frame-pointer", i32 2}86!2 = !{!"clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4e1ca21db4162f0c3cde98f730b08ed538fff2a4)"}87