57 lines · plain
1; RUN: not llc -mtriple=bpfel -mcpu=v1 < %s 2>&1 | FileCheck %s2; RUN: not llc -mtriple=bpfeb -mcpu=v1 < %s 2>&1 | FileCheck %s3 4; This file is generated with the source command and source5; $ clang -target bpf -O2 -g -S -emit-llvm t.c6; $ cat t.c7; int test(int *ptr) {8; int r;9; __sync_fetch_and_add(ptr, 4);10; r = __sync_fetch_and_add(ptr, 6);11; return r;12; }13 14; ModuleID = 't.c'15source_filename = "t.c"16target datalayout = "e-m:e-p:64:64-i64:64-n32:64-S128"17target triple = "bpf"18 19; Function Attrs: nounwind20define dso_local i32 @test(ptr nocapture %ptr) local_unnamed_addr !dbg !7 {21entry:22 call void @llvm.dbg.value(metadata ptr %ptr, metadata !13, metadata !DIExpression()), !dbg !1523 %0 = atomicrmw add ptr %ptr, i32 4 seq_cst, !dbg !1624 %1 = atomicrmw add ptr %ptr, i32 6 seq_cst, !dbg !1725; CHECK: in function test i32 (ptr): Invalid usage of the XADD return value26 call void @llvm.dbg.value(metadata i32 %1, metadata !14, metadata !DIExpression()), !dbg !1827 ret i32 %1, !dbg !1928}29 30; Function Attrs: nounwind readnone speculatable31declare void @llvm.dbg.value(metadata, metadata, metadata)32 33!llvm.dbg.cu = !{!0}34!llvm.module.flags = !{!3, !4, !5}35!llvm.ident = !{!6}36 37!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 8.0.0 (trunk 342605) (llvm/trunk 342612)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)38!1 = !DIFile(filename: "t.c", directory: "/home/yhs/work/tests/llvm/sync/test1")39!2 = !{}40!3 = !{i32 2, !"Dwarf Version", i32 4}41!4 = !{i32 2, !"Debug Info Version", i32 3}42!5 = !{i32 1, !"wchar_size", i32 4}43!6 = !{!"clang version 8.0.0 (trunk 342605) (llvm/trunk 342612)"}44!7 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12)45!8 = !DISubroutineType(types: !9)46!9 = !{!10, !11}47!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)48!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64)49!12 = !{!13, !14}50!13 = !DILocalVariable(name: "ptr", arg: 1, scope: !7, file: !1, line: 1, type: !11)51!14 = !DILocalVariable(name: "r", scope: !7, file: !1, line: 2, type: !10)52!15 = !DILocation(line: 1, column: 15, scope: !7)53!16 = !DILocation(line: 3, column: 4, scope: !7)54!17 = !DILocation(line: 4, column: 8, scope: !7)55!18 = !DILocation(line: 2, column: 8, scope: !7)56!19 = !DILocation(line: 5, column: 4, scope: !7)57