Index: llvm/test/CodeGen/M680x0/ASM/Alloc/dyn_alloca_aligned.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/Alloc/dyn_alloca_aligned.ll @@ -0,0 +1,9 @@ +; RUN: llc < %s -mtriple=m680x0-linux-gnu -verify-machineinstrs | FileCheck %s -check-prefix=x00 +define i32 @A(i32 %Size) { +; x00: sub.l %d1, %d0 +; x00-NEXT: and.l #-128 +; x00-NEXT: move.l %d0, %sp + %A = alloca i8, i32 %Size, align 128 + %A_addr = ptrtoint i8* %A to i32 + ret i32 %A_addr +} Index: llvm/test/CodeGen/M680x0/ASM/Arith/add-with-overflow.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/Arith/add-with-overflow.ll @@ -0,0 +1,62 @@ +; RUN: llc < %s -mtriple=m680x0-linux -verify-machineinstrs | FileCheck %s -check-prefix=x00 + +declare {i32, i1} @llvm.sadd.with.overflow.i32(i32, i32) +declare {i32, i1} @llvm.uadd.with.overflow.i32(i32, i32) + + +; x00-LABEL: test5: +; x00: add.l +; x00-NEXT: bvs +define fastcc i32 @test5(i32 %v1, i32 %v2, i32* %X) nounwind { +entry: + %t = call {i32, i1} @llvm.sadd.with.overflow.i32(i32 %v1, i32 %v2) + %sum = extractvalue {i32, i1} %t, 0 + %obit = extractvalue {i32, i1} %t, 1 + br i1 %obit, label %overflow, label %normal + +normal: + store i32 0, i32* %X + br label %overflow + +overflow: + ret i32 %sum +} + +; x00-LABEL: test6: +; x00: add.l +; x00-NEXT: bcs +define fastcc i1 @test6(i32 %v1, i32 %v2, i32* %X) nounwind { +entry: + %t = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %v1, i32 %v2) + %sum = extractvalue {i32, i1} %t, 0 + %obit = extractvalue {i32, i1} %t, 1 + br i1 %obit, label %carry, label %normal + +normal: + store i32 0, i32* %X + br label %carry + +carry: + ret i1 false +} + +; x00-LABEL: test7: +; x00: move.l (4,%sp), %d0 +; x00-NEXT: add.l (8,%sp), %d0 +; x00-NEXT: scs %d1 +; x00-NEXT: rts +define {i32, i1} @test7(i32 %v1, i32 %v2) nounwind { + %t = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %v1, i32 %v2) + ret {i32, i1} %t +} + +; x00-LABEL: test10: +; x00: add.l #1 +; x00-NEXT: svs +; x00-NEXT: rts +define fastcc i1 @test10(i32 %x) nounwind { +entry: + %t = call {i32, i1} @llvm.sadd.with.overflow.i32(i32 %x, i32 1) + %obit = extractvalue {i32, i1} %t, 1 + ret i1 %obit +} Index: llvm/test/CodeGen/M680x0/ASM/Arith/add.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/Arith/add.ll @@ -0,0 +1,84 @@ +; RUN: llc < %s -mtriple=m680x0-linux -verify-machineinstrs | FileCheck %s -check-prefix=x00 + +; x00-LABEL: test1: +; x00: move.l (12,%sp), %d0 +; x00-NEXT: add.l (4,%sp), %d0 +; x00-NEXT: move.l (8,%sp), %d1 +; x00-NEXT: rts + +define i64 @test1(i64 %A, i32 %B) nounwind { + %tmp12 = zext i32 %B to i64 + %tmp3 = shl i64 %tmp12, 32 + %tmp5 = add i64 %tmp3, %A + ret i64 %tmp5 +} + + +; x00-LABEL: test2: +; x00: move.l %d0, [[Addr:%a[0-7]]] +; x00-NEXT: add.l #128, ([[Addr]]) + +define void @test2(i32* inreg %a) nounwind { + %aa = load i32, i32* %a + %b = add i32 %aa, 128 + store i32 %b, i32* %a + ret void +} + + +; x00-LABEL: test2_fast: +; x00: add.l #128, (%a0) + +define fastcc void @test2_fast(i32* inreg %a) nounwind { + %aa = load i32, i32* %a + %b = add i32 %aa, 128 + store i32 %b, i32* %a + ret void +} + + +; x00-LABEL: test3: +; x00 move.l (%a0), %d0 +; x00-NEXT move.l #-2147483648, %d1 +; x00-NEXT add.l (4,%a0), %d1 +; x00-NEXT addx.l #0, %d0 +; x00-NEXT move.l %d1, (4,%a0) +; x00-NEXT move.l %d0, (%a0) +; x00-NEXT rts +define fastcc void @test3(i64* inreg %a) nounwind { + %aa = load i64, i64* %a + %b = add i64 %aa, 2147483648 + store i64 %b, i64* %a + ret void +} + + +; x00-LABEL: test4: +; x00 move.l #128, %d0 +; x00-NEXT add.l (4,%a0), %d0 +; x00-NEXT move.l (%a0), %d1 +; x00-NEXT move.l %d0, (4,%a0) +; x00-NEXT addx.l #0, %d1 +; x00-NEXT move.l %d1, (%a0) +; x00-NEXT rts +define fastcc void @test4(i64* inreg %a) nounwind { + %aa = load i64, i64* %a + %b = add i64 %aa, 128 + store i64 %b, i64* %a + ret void +} + +; x00-LABEL: test9: +; x00: sub.l #10 +; x00-NEXT: seq +; x00-NEXT: and.l +; x00-NEXT: sub.l +; x00-NEXT: move.l +; x00-NEXT: rts + +define fastcc i32 @test9(i32 %x, i32 %y) nounwind readnone { + %cmp = icmp eq i32 %x, 10 + %sub = sext i1 %cmp to i32 + %cond = add i32 %sub, %y + ret i32 %cond +} Index: llvm/test/CodeGen/M680x0/ASM/Arith/divide-by-constant.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/Arith/divide-by-constant.ll @@ -0,0 +1,127 @@ +; RUN: llc < %s -mtriple=m680x0-linux -verify-machineinstrs | FileCheck %s -check-prefix=x00 + +; TODO fold the shifts +; x00-LABEL: test1: +; x00: mulu #-1985 +; x00-NEXT: lsr.l #8 +; x00-NEXT: lsr.l #8 +; x00-NEXT: lsr.w #5 +define zeroext i16 @test1(i16 zeroext %x) nounwind { +entry: + %div = udiv i16 %x, 33 + ret i16 %div +} + +; x00-LABEL: test2: +; x00: mulu #-21845 +; x00-NEXT: lsr.l #8 +; x00-NEXT: lsr.l #8 +; x00-NEXT: lsr.w #1 +define zeroext i16 @test2(i8 signext %x, i16 zeroext %c) { +entry: + %div = udiv i16 %c, 3 + ret i16 %div +} + + +; x00-LABEL: test3: +; x00: move.b (11 +; x00-NEXT: and.l #255 +; x00-NEXT: muls #171 +; x00-NEXT: move.w #9 +; x00-NEXT: lsr.w +define zeroext i8 @test3(i8 zeroext %x, i8 zeroext %c) { +entry: + %div = udiv i8 %c, 3 + ret i8 %div +} + +; x00-LABEL: test4: +; x00: muls #1986 +define signext i16 @test4(i16 signext %x) nounwind { +entry: + %div = sdiv i16 %x, 33 ; [#uses=1] + ret i16 %div +} + +; x00-LABEL: test5: +; x00: jsr __udivsi3 +define i32 @test5(i32 %A) nounwind { + %tmp1 = udiv i32 %A, 1577682821 ; [#uses=1] + ret i32 %tmp1 +} + +; TODO fold shift +; x00-LABEL: test6: +; x00: muls #26215 +; x00: move.w #15 +; x00: lsr.w +; x00: asr.w #2 +define signext i16 @test6(i16 signext %x) nounwind { +entry: + %div = sdiv i16 %x, 10 + ret i16 %div +} + +; x00-LABEL: test7: +; x00: jsr __udivsi3 +define i32 @test7(i32 %x) nounwind { + %div = udiv i32 %x, 28 + ret i32 %div +} + +; x00-LABEL: test8: +; x00: lsr.b #1 +; x00: and.l #255 +; x00: muls #211 +; x00: move.w #13 +; x00: lsr.w +define i8 @test8(i8 %x) nounwind { + %div = udiv i8 %x, 78 + ret i8 %div +} + +; x00-LABEL: test9: +; x00: lsr.b #2 +; x00: and.l #255 +; x00: muls #71 +; x00: move.w #11 +; x00: lsr.w +define i8 @test9(i8 %x) nounwind { + %div = udiv i8 %x, 116 + ret i8 %div +} + +; x00-LABEL: testsize1: +; x00: asr.l +; x00: lsr.l +; x00: asr.l +define i32 @testsize1(i32 %x) minsize nounwind { +entry: + %div = sdiv i32 %x, 32 + ret i32 %div +} + +; x00-LABEL: testsize2: +; x00: jsr __divsi3 +define i32 @testsize2(i32 %x) minsize nounwind { +entry: + %div = sdiv i32 %x, 33 + ret i32 %div +} + +; x00-LABEL: testsize3: +; x00: lsr.l #5 +define i32 @testsize3(i32 %x) minsize nounwind { +entry: + %div = udiv i32 %x, 32 + ret i32 %div +} + +; x00-LABEL: testsize4: +; x00: jsr __udivsi3 +define i32 @testsize4(i32 %x) minsize nounwind { +entry: + %div = udiv i32 %x, 33 + ret i32 %div +} Index: llvm/test/CodeGen/M680x0/ASM/Arith/imul.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/Arith/imul.ll @@ -0,0 +1,135 @@ +; RUN: llc < %s -O0 -mtriple=m680x0-linux | FileCheck %s --check-prefix=x00 + +; x00-LABEL: mul4_32: +; x00: lsl.l +define i32 @mul4_32(i32 %A) { + %mul = mul i32 %A, 4 + ret i32 %mul +} + +; x00-LABEL: mul4_64: +; x00: lsr.l +; x00: lsl.l +; x00: or.l +; x00: lsl.l +define i64 @mul4_64(i64 %A) { + %mul = mul i64 %A, 4 + ret i64 %mul +} + +; x00-LABEL: mul4096_32: +; x00: lsl.l +define i32 @mul4096_32(i32 %A) { + %mul = mul i32 %A, 4096 + ret i32 %mul +} + +; x00-LABEL: mul4096_64: +; x00: lsr.l +; x00: lsl.l +; x00: or.l +; x00: lsl.l +define i64 @mul4096_64(i64 %A) { + %mul = mul i64 %A, 4096 + ret i64 %mul +} + +; x00-LABEL: mulmin4096_32: +; x00: lsl.l +; x00-NEXT: neg.l +define i32 @mulmin4096_32(i32 %A) { + %mul = mul i32 %A, -4096 + ret i32 %mul +} + +; x00-LABEL: mulmin4096_64: +; x00: lsr.l +; x00: lsl.l +; x00: or.l +; x00: lsl.l +; x00: neg.l +; x00: negx.l +define i64 @mulmin4096_64(i64 %A) { + %mul = mul i64 %A, -4096 + ret i64 %mul +} + +; No i32 multiply for M68000 +; x00-LABEL: mul3_32: +; x00: jsr __mulsi3 +define i32 @mul3_32(i32 %A) { + %mul = mul i32 %A, 3 + ret i32 %mul +} + +; x00-LABEL: mul3_64: +; x00: jsr __muldi3 +define i64 @mul3_64(i64 %A) { + %mul = mul i64 %A, 3 + ret i64 %mul +} + +; x00-LABEL: mul40_32: +; x00: jsr __mulsi3 +define i32 @mul40_32(i32 %A) { + %mul = mul i32 %A, 40 + ret i32 %mul +} + +; x00-LABEL: mul40_64: +; x00: jsr __muldi3 +define i64 @mul40_64(i64 %A) { + %mul = mul i64 %A, 40 + ret i64 %mul +} + +; x00-LABEL: mul4_32_minsize: +; x00: lsl.l +define i32 @mul4_32_minsize(i32 %A) minsize { + %mul = mul i32 %A, 4 + ret i32 %mul +} + +; X64-LABEL: mul40_32_minsize: +; X64: jsr __mulsi3 +define i32 @mul40_32_minsize(i32 %A) minsize { + %mul = mul i32 %A, 40 + ret i32 %mul +} + +; x00-LABEL: mul33_32: +; x00: __mulsi3 +define i32 @mul33_32(i32 %A) { + %mul = mul i32 %A, 33 + ret i32 %mul +} + +; x00-LABEL: mul31_32: +; x00: __mulsi3 +define i32 @mul31_32(i32 %A) { + %mul = mul i32 %A, 31 + ret i32 %mul +} + +; x00-LABEL: mul0_32: +; x00: move.l #0 +define i32 @mul0_32(i32 %A) { + %mul = mul i32 %A, 0 + ret i32 %mul +} + +; x00-LABEL: mul4294967295_32: +; x00: neg.l %d0 +define i32 @mul4294967295_32(i32 %A) { + %mul = mul i32 %A, 4294967295 + ret i32 %mul +} + +; x00-LABEL: mul18446744073709551615_64: +; x00: neg.l %d0 +; x00: negx.l %d1 +; x00: rts +define i64 @mul18446744073709551615_64(i64 %A) { + %mul = mul i64 %A, 18446744073709551615 + ret i64 %mul +} Index: llvm/test/CodeGen/M680x0/ASM/Arith/lshr.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/Arith/lshr.ll @@ -0,0 +1,16 @@ +; RUN: llc < %s -mtriple=m680x0-linux | FileCheck %s --check-prefix=x00 + +; Function Attrs: norecurse nounwind readnone +; x00-LABEL c_isspace: +; x00: move.l #8388639, %d0 +; x00: lsr.l %d1, %d0 +; x00: and.l #1, %d0 +define zeroext i1 @c_isspace(i32 %c) local_unnamed_addr #0 { +entry: + %switch.tableidx = add i32 %c, -9 + %switch.cast = trunc i32 %switch.tableidx to i24 + %switch.downshift = lshr i24 -8388577, %switch.cast + %0 = and i24 %switch.downshift, 1 + %switch.masked = icmp ne i24 %0, 0 + ret i1 %switch.masked +} Index: llvm/test/CodeGen/M680x0/ASM/Arith/mul64.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/Arith/mul64.ll @@ -0,0 +1,10 @@ +; RUN: llc < %s -mtriple=m680x0-linux -verify-machineinstrs | FileCheck %s --check-prefix=x00 + +; Currenlty making the libcall is ok, x20 supports i32 mul/div which +; yields saner expansion for i64 mul +; x00-LABEL: foo: +; x00: jsr __muldi3 +define i64 @foo(i64 %t, i64 %u) nounwind { + %k = mul i64 %t, %u + ret i64 %k +} Index: llvm/test/CodeGen/M680x0/ASM/Arith/sdiv-exact.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/Arith/sdiv-exact.ll @@ -0,0 +1,18 @@ +; RUN: llc -mtriple=m680x0-linux -verify-machineinstrs < %s | FileCheck %s -check-prefix=x00 + +; x00-LABEL: test1: +; x00: move.l #-1030792151 +; x00: jsr __mulsi3 +define i32 @test1(i32 %x) { + %div = sdiv exact i32 %x, 25 + ret i32 %div +} + +; x00-LABEL: test2: +; x00: asr.l #3 +; x00: move.l #-1431655765 +; x00: jsr __mulsi3 +define i32 @test2(i32 %x) { + %div = sdiv exact i32 %x, 24 + ret i32 %div +} Index: llvm/test/CodeGen/M680x0/ASM/Arith/smul-with-overflow.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/Arith/smul-with-overflow.ll @@ -0,0 +1,68 @@ +; RUN: llc < %s -mtriple=m680x0-linux -verify-machineinstrs | FileCheck %s -check-prefix=x00 + +declare i32 @printf(i8*, ...) nounwind +declare {i32, i1} @llvm.smul.with.overflow.i32(i32, i32) +declare { i63, i1 } @llvm.smul.with.overflow.i63(i63, i63) + +@ok = internal constant [4 x i8] c"%d\0A\00" +@no = internal constant [4 x i8] c"no\0A\00" + +; x00-LABEL: test1: +; x00: jsr __muldi3 +; x00: sne +define fastcc i1 @test1(i32 %v1, i32 %v2) nounwind { +entry: + %t = call {i32, i1} @llvm.smul.with.overflow.i32(i32 %v1, i32 %v2) + %sum = extractvalue {i32, i1} %t, 0 + %obit = extractvalue {i32, i1} %t, 1 + br i1 %obit, label %overflow, label %normal + +normal: + %t1 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind + ret i1 true + +overflow: + %t2 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @no, i32 0, i32 0) ) nounwind + ret i1 false +} + +; x00-LABEL: test2: +; x00: jsr __muldi3 +; x00: sne +define fastcc i1 @test2(i32 %v1, i32 %v2) nounwind { +entry: + %t = call {i32, i1} @llvm.smul.with.overflow.i32(i32 %v1, i32 %v2) + %sum = extractvalue {i32, i1} %t, 0 + %obit = extractvalue {i32, i1} %t, 1 + br i1 %obit, label %overflow, label %normal + +overflow: + %t2 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @no, i32 0, i32 0) ) nounwind + ret i1 false + +normal: + %t1 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind + ret i1 true +} + +; x00-LABEL: test3: +; x00: add.l +; x00-NEXT: add.l +define i32 @test3(i32 %a, i32 %b) nounwind readnone { +entry: + %tmp0 = add i32 %b, %a + %tmp1 = call { i32, i1 } @llvm.smul.with.overflow.i32(i32 %tmp0, i32 2) + %tmp2 = extractvalue { i32, i1 } %tmp1, 0 + ret i32 %tmp2 +} + +; x00-LABEL: test4: +; x00: add.l +; x00: jsr __muldi3 +define i32 @test4(i32 %a, i32 %b) nounwind readnone { +entry: + %tmp0 = add i32 %b, %a + %tmp1 = call { i32, i1 } @llvm.smul.with.overflow.i32(i32 %tmp0, i32 4) + %tmp2 = extractvalue { i32, i1 } %tmp1, 0 + ret i32 %tmp2 +} Index: llvm/test/CodeGen/M680x0/ASM/Arith/sub-with-overflow.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/Arith/sub-with-overflow.ll @@ -0,0 +1,56 @@ +; RUN: llc < %s -mtriple=m680x0-linux -verify-machineinstrs | FileCheck %s -check-prefix=x00 + +declare i32 @printf(i8*, ...) nounwind +declare {i32, i1} @llvm.ssub.with.overflow.i32(i32, i32) +declare {i32, i1} @llvm.usub.with.overflow.i32(i32, i32) + +@ok = internal constant [4 x i8] c"%d\0A\00" +@no = internal constant [4 x i8] c"no\0A\00" + +; x00-LABEL: func1: +; x00: sub.l (20,%sp) +; x00-NEXT: bvc +define i1 @func1(i32 %v1, i32 %v2) nounwind { +entry: + %t = call {i32, i1} @llvm.ssub.with.overflow.i32(i32 %v1, i32 %v2) + %sum = extractvalue {i32, i1} %t, 0 + %obit = extractvalue {i32, i1} %t, 1 + br i1 %obit, label %overflow, label %normal + +normal: + %t1 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind + ret i1 true + +overflow: + %t2 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @no, i32 0, i32 0) ) nounwind + ret i1 false +} + +; x00-LABEL: func2: +; x00: sub.l (20,%sp) +; x00-NEXT: bcc +define i1 @func2(i32 %v1, i32 %v2) nounwind { +entry: + %t = call {i32, i1} @llvm.usub.with.overflow.i32(i32 %v1, i32 %v2) + %sum = extractvalue {i32, i1} %t, 0 + %obit = extractvalue {i32, i1} %t, 1 + br i1 %obit, label %carry, label %normal + +normal: + %t1 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind + ret i1 true + +carry: + %t2 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @no, i32 0, i32 0) ) nounwind + ret i1 false +} + +; x00-LABEL: func3: +; x00: sub.l #1 +; x00-NEXT: svs +define i1 @func3(i32 %x) nounwind { +entry: + %t = call {i32, i1} @llvm.ssub.with.overflow.i32(i32 %x, i32 1) + %obit = extractvalue {i32, i1} %t, 1 + ret i1 %obit +} Index: llvm/test/CodeGen/M680x0/ASM/Arith/sub.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/Arith/sub.ll @@ -0,0 +1,12 @@ +; RUN: llc -mtriple=m680x0-linux < %s -verify-machineinstrs | FileCheck %s -check-prefix=x00 + +; x00-LABEL: test1: +; x00: eori.l #31 +; x00-NEXT: move.l #32 +; x00-NEXT: sub.l +; x00-NEXT: rts +define i32 @test1(i32 %x) { + %xor = xor i32 %x, 31 + %sub = sub i32 32, %xor + ret i32 %sub +} Index: llvm/test/CodeGen/M680x0/ASM/Arith/umul-with-overflow.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/Arith/umul-with-overflow.ll @@ -0,0 +1,38 @@ +; RUN: llc < %s -mtriple=m680x0-linux-gnu -verify-machineinstrs| FileCheck %s -check-prefix=x00 + +declare {i32, i1} @llvm.umul.with.overflow.i32(i32 %a, i32 %b) + +; x00-LABEL: a: +; x00-NOT: asr +; x00: jsr __muldi3 +; x00-NEXT cmpi.l #0, %d1 +; x00-NEXT sne +define i1 @a(i32 %x) nounwind { + %res = call {i32, i1} @llvm.umul.with.overflow.i32(i32 %x, i32 3) + %obil = extractvalue {i32, i1} %res, 1 + ret i1 %obil +} + +; x00-LABEL: test2: +; x00: add.l +; x00-NEXT: add.l +; x00-NEXT: rts +define i32 @test2(i32 %a, i32 %b) nounwind readnone { +entry: + %tmp0 = add i32 %b, %a + %tmp1 = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %tmp0, i32 2) + %tmp2 = extractvalue { i32, i1 } %tmp1, 0 + ret i32 %tmp2 +} + +; x00-LABEL: test3: +; x00: add.l +; x00-NOT: asr +; x00: jsr __muldi3 +define i32 @test3(i32 %a, i32 %b) nounwind readnone { +entry: + %tmp0 = add i32 %b, %a + %tmp1 = call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %tmp0, i32 4) + %tmp2 = extractvalue { i32, i1 } %tmp1, 0 + ret i32 %tmp2 +} Index: llvm/test/CodeGen/M680x0/ASM/CConv/c-args-inreg.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/CConv/c-args-inreg.ll @@ -0,0 +1,28 @@ +; RUN: llc < %s -mtriple=m680x0-pc-linux -relocation-model=pic -verify-machineinstrs | FileCheck -check-prefix=x00 %s + +; +; Pass first two arguments in registers %d0 and %d1 + +; x00-LABEL: foo_inreg: +; x00: move.l %d0, [[Reg:%a[0-7]]] +; x00: move.l %d1, ([[Reg]]) +; x00: rts + +define void @foo_inreg(i32* nocapture inreg %out, i32 inreg %in) nounwind { +entry: + store i32 %in, i32* %out, align 4 + ret void +} + +; x00-LABEL: bar_inreg: +; x00-DAG: move.l %d0, [[Out:%a[0-7]]] +; x00-DAG: move.l %d1, [[In:%a[0-7]]] +; x00: move.l ([[In]]), ([[Out]]) +; x00: rts + +define void @bar_inreg(i32* nocapture inreg %pOut, i32* nocapture inreg %pIn) nounwind { +entry: + %0 = load i32, i32* %pIn, align 4 + store i32 %0, i32* %pOut, align 4 + ret void +} Index: llvm/test/CodeGen/M680x0/ASM/CConv/c-args.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/CConv/c-args.ll @@ -0,0 +1,66 @@ +; RUN: llc < %s -mtriple=m680x0-pc-linux -relocation-model=pic -verify-machineinstrs | FileCheck -check-prefix=x00 %s + +; +; C Call passes all arguments on stack ... + +; x00-LABEL: test1: +; x00: move.l (4,%sp), [[Reg:%a[0-7]]] +; x00: move.l (8,%sp), ([[Reg]]) +; x00: rts +define void @test1(i32* nocapture %out, i32 %in) nounwind { +entry: + store i32 %in, i32* %out, align 4 + ret void +} + +; x00-LABEL: test2: +; x00-DAG: move.l (4,%sp), [[Out:%a[0-7]]] +; x00-DAG: move.l (8,%sp), [[In:%a[0-7]]] +; x00: move.l ([[In]]), ([[Out]]) +; x00: rts +define void @test2(i32* nocapture %pOut, i32* nocapture %pIn) nounwind { +entry: + %0 = load i32, i32* %pIn, align 4 + store i32 %0, i32* %pOut, align 4 + ret void +} + +; x00-LABEL: test3: +; x00: move.l (4,%sp), [[Reg:%a[0-7]]] +; x00: move.b (11,%sp), ([[Reg]]) +; x00: rts +define void @test3(i8* nocapture %out, i8 %in) nounwind { +entry: + store i8 %in, i8* %out, align 1 + ret void +} + +; x00-LABEL: test4: +; x00: move.l (4,%sp), [[Reg:%a[0-7]]] +; x00: move.w (10,%sp), ([[Reg]]) +; x00: rts +define void @test4(i16* nocapture %out, i16 %in) nounwind { +entry: + store i16 %in, i16* %out, align 2 + ret void +} + +; x00-LABEL: test5: +; x00: move.b (7,%sp), [[Reg:%d[0-7]]] +; x00: add.b (11,%sp), [[Reg]] +; x00: rts +define i8 @test5(i8 %a, i8 %b) nounwind { +entry: + %add = add i8 %a, %b + ret i8 %add +} + +; x00-LABEL: test6: +; x00: move.w (6,%sp), [[Reg:%d[0-7]]] +; x00: add.w (10,%sp), [[Reg]] +; x00: rts +define i16 @test6(i16 %a, i16 %b) nounwind { +entry: + %add = add i16 %a, %b + ret i16 %add +} Index: llvm/test/CodeGen/M680x0/ASM/CConv/c-call.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/CConv/c-call.ll @@ -0,0 +1,55 @@ +; RUN: llc < %s -mtriple=m680x0-pc-linux -relocation-model=pic -verify-machineinstrs | FileCheck -check-prefix=x00 %s + +; +; Pass all arguments on the stack in reverse order + +; x00-LABEL: test1: +; x00-DAG: move.l #5, (16,%sp) +; x00-DAG: move.l #4, (12,%sp) +; x00-DAG: move.l #3, (8,%sp) +; x00-DAG: move.l #2, (4,%sp) +; x00-DAG: move.l #1, (%sp) +; x00-NEXT: jsr (test1_callee@PLT,%pc) +; x00-NEXT: move.l + +define i32 @test1() nounwind uwtable { +entry: + call void @test1_callee(i32 1, i32 2, i32 3, i32 4, i32 5) nounwind + ret i32 0 +} + +declare void @test1_callee(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e); + +; x00-LABEL: test2: +; x00-DAG: move.l #5, (16,%sp) +; x00-DAG: move.l #4, (12,%sp) +; x00-DAG: move.l #3, (8,%sp) +; x00-DAG: move.l #2, (4,%sp) +; x00-DAG: move.l #1, (%sp) +; x00-NEXT: jsr (test2_callee@PLT,%pc) +; x00-NEXT: move.w + +define i16 @test2() nounwind uwtable { +entry: + call void @test2_callee(i16 1, i16 2, i16 3, i16 4, i16 5) nounwind + ret i16 0 +} + +declare void @test2_callee(i16 %a, i16 %b, i16 %c, i16 %d, i16 %e); + +; x00-LABEL: test3: +; x00-DAG: move.l #5, (16,%sp) +; x00-DAG: move.l #4, (12,%sp) +; x00-DAG: move.l #3, (8,%sp) +; x00-DAG: move.l #2, (4,%sp) +; x00-DAG: move.l #1, (%sp) +; x00-NEXT: jsr (test3_callee@PLT,%pc) +; x00-NEXT: move.b + +define i8 @test3() nounwind uwtable { +entry: + call void @test3_callee(i8 1, i8 2, i8 3, i8 4, i8 5) nounwind + ret i8 0 +} + +declare void @test3_callee(i8 %a, i8 %b, i8 %c, i8 %d, i8 %e); Index: llvm/test/CodeGen/M680x0/ASM/CConv/fastcc-args.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/CConv/fastcc-args.ll @@ -0,0 +1,40 @@ +; RUN: llc < %s -mtriple=m680x0-pc-linux -relocation-model=pic -verify-machineinstrs | FileCheck -check-prefix=x00 %s + +; +; C Call passes all arguments on stack ... + +; x00-LABEL: test1: +; x00: move.l %d0, (%a0) +; x00-NEXT: rts + +define fastcc void @test1(i32* nocapture %out, i32 %in) nounwind { +entry: + store i32 %in, i32* %out, align 4 + ret void +} + +; x00-LABEL: test2: +; x00: move.l (%a1), (%a0) +; x00-NEXT: rts + +define fastcc void @test2(i32* nocapture %pOut, i32* nocapture %pIn) nounwind { +entry: + %0 = load i32, i32* %pIn, align 4 + store i32 %0, i32* %pOut, align 4 + ret void +} + + +; x00-LABEL: test3: +; x00: add.l %d1, %d0 +; x00-NEXT: add.l %a0, %d0 +; x00-NEXT: add.l %a1, %d0 +; x00-NEXT: add.l (4,%sp), %d0 + +define fastcc i32 @test3(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) nounwind { + %1 = add i32 %a, %b + %2 = add i32 %1, %c + %3 = add i32 %2, %d + %4 = add i32 %3, %e + ret i32 %4 +} Index: llvm/test/CodeGen/M680x0/ASM/CConv/fastcc-call.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/CConv/fastcc-call.ll @@ -0,0 +1,41 @@ +; RUN: llc < %s -mtriple=m680x0-pc-linux -relocation-model=pic -verify-machineinstrs | FileCheck -check-prefix=x00 %s + +; +; Pass first 4 arguments in registers %d0,%d1,%a0,%a1 the rest goes onto stack + +; x00-LABEL: foo1: +; x00-DAG: move.l #5, (%sp) +; x00-DAG: move.l #4, %a1 +; x00-DAG: move.l #3, %a0 +; x00-DAG: move.l #2, %d1 +; x00-DAG: move.l #1, %d0 +; x00-NEXT: jsr (bar1@PLT,%pc) + +define i32 @foo1() nounwind uwtable { +entry: + call fastcc void @bar1(i32 1, i32 2, i32 3, i32 4, i32 5) nounwind + ret i32 0 +} + +declare fastcc void @bar1(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e); + + +; +; Pass pointers in %a registers if there are any free left + +; x00-LABEL: foo2: +; x00-DAG: lea (8,%sp), %a0 +; x00-DAG: lea (4,%sp), %a1 +; x00-DAG: move.l #2, %d0 +; x00-DAG: move.l #4, %d1 +; x00-DAG: jsr (bar2@PLT,%pc) + +define i32 @foo2() nounwind uwtable { +entry: + %a = alloca i32, align 4 + %b = alloca i32, align 4 + call fastcc void @bar2(i32* %a, i32 2, i32* %b, i32 4) nounwind + ret i32 0 +} + +declare fastcc void @bar2(i32* %a, i32 %b, i32* %c, i32 %d); Index: llvm/test/CodeGen/M680x0/ASM/CodeModel/medium-pic.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/CodeModel/medium-pic.ll @@ -0,0 +1,219 @@ +; RUN: llc < %s -O2 -mtriple=m680x0-linux-gnu -verify-machineinstrs \ +; RUN: -code-model=medium -relocation-model=pic \ +; RUN: | FileCheck %s -check-prefix=x00 + +@ptr = external global i32* +@dst = external global i32 +@src = external global i32 + +; x00-LABEL: test0: +; x00: move.l (dst@GOTPCREL,%pc), %a0 +; x00-NEXT: move.l (ptr@GOTPCREL,%pc), %a1 +; x00-NEXT: %a0, (%a1) +; x00-NEXT: move.l (src@GOTPCREL,%pc), %a1 +; x00-NEXT: (%a1), (%a0) +; x00-NEXT: rts +define void @test0() nounwind { +entry: + store i32* @dst, i32** @ptr + %tmp.s = load i32, i32* @src + store i32 %tmp.s, i32* @dst + ret void +} + +@ptr2 = global i32* null +@dst2 = global i32 0 +@src2 = global i32 0 + +; x00-LABEL: test1: +; x00: move.l (dst2@GOTPCREL,%pc), %a0 +; x00-NEXT: move.l (ptr2@GOTPCREL,%pc), %a1 +; x00-NEXT: %a0, (%a1) +; x00-NEXT: move.l (src2@GOTPCREL,%pc), %a1 +; x00-NEXT: (%a1), (%a0) +; x00-NEXT: rts +define void @test1() nounwind { +entry: + store i32* @dst2, i32** @ptr2 + %tmp.s = load i32, i32* @src2 + store i32 %tmp.s, i32* @dst2 + ret void +} + +declare i8* @malloc(i32) + +; x00-LABEL: test2: +; x00: move.l #40, (%sp) +; x00: jsr (malloc@PLT,%pc) +define void @test2() nounwind { +entry: + %ptr = call i8* @malloc(i32 40) + ret void +} + +@pfoo = external global void(...)* +declare void(...)* @afoo(...) + +; x00-LABEL: test3: +; x00: jsr (afoo@PLT,%pc) +; x00-NEXT: move.l %d0, %a0 +; x00-NEXT: move.l (pfoo@GOTPCREL,%pc), %a1 +; x00-NEXT: move.l %a0, (%a1) +; x00-NEXT: jsr (%a0) +define void @test3() nounwind { +entry: + %tmp = call void(...)*(...) @afoo() + store void(...)* %tmp, void(...)** @pfoo + %tmp1 = load void(...)*, void(...)** @pfoo + call void(...) %tmp1() + ret void +} + +declare void @foo(...) + +; x00-LABEL: test4: +; x00: jsr (foo@PLT,%pc) +define void @test4() nounwind { +entry: + call void(...) @foo() + ret void +} + +@ptr6 = internal global i32* null +@dst6 = internal global i32 0 +@src6 = internal global i32 0 + +; x00-LABEL: test5: +; x00 lea (dst6,%pc), %a0 +; x00 move.l %a0, (ptr6,%pc) +; x00 move.l (src6,%pc), (%a0) +define void @test5() nounwind { +entry: + store i32* @dst6, i32** @ptr6 + %tmp.s = load i32, i32* @src6 + store i32 %tmp.s, i32* @dst6 + ret void +} + + +;;; Test constant pool references. +;; FIXME no constant pool atm +;; 00: .LCPI6_0: +;; 00-LABEL: test6: +;; 00: calll .L6$pb +;; 00: .L6$pb: +;; 00: addl $_GLOBAL_OFFSET_TABLE_+(.L{{.*}}-.L6$pb), +;; 00: fldl .LCPI6_0@GOTOFF( +;define double @test6(i32 %a.u) nounwind { +;entry: +; %tmp = icmp eq i32 %a.u,0 +; %retval = select i1 %tmp, double 4.561230e+02, double 1.234560e+02 +; ret double %retval +;} + + +; Test jump table references. +; +; x00-LABEL: test7: +; x00: move.l (4,%sp), %d0 +; x00-NEXT: add.l #-1, %d0 +; x00-NEXT: move.l %d0, %d1 +; x00-NEXT: sub.l #12, %d1 +; x00-NEXT: bhi .LBB{{.*}}_14 +; x00: lea (_GLOBAL_OFFSET_TABLE_@GOTPCREL,%pc), %a0 +; x00: lsl.l #2, %d0 +; x00: add.l #.LJTI{{.*}}_0@GOTOFF, %a1 +; x00: add.l (0,%a1,%d0), %a0 +; x00-NEXT: jmp (%a0) +; +; x00: .LBB{{.*}}_2: +; x00-NEXT: bra foo1@PLT +; x00: .LBB{{.*}}_8: +; x00-NEXT: bra foo1@PLT +; x00: .LBB{{.*}}_14: +; x00-NEXT: bra foo6@PLT +; x00: .LBB{{.*}}_9: +; x00-NEXT: bra foo2@PLT +; x00: .LBB{{.*}}_10: +; x00-NEXT: bra foo6@PLT +; x00: .LBB{{.*}}_12: +; x00-NEXT: bra foo4@PLT +; x00: .LBB{{.*}}_3: +; x00-NEXT: bra foo2@PLT +; x00: .LBB{{.*}}_5: +; x00-NEXT: bra foo3@PLT +; x00: .LBB{{.*}}_6: +; x00-NEXT: bra foo4@PLT +; x00: .LBB{{.*}}_11: +; x00-NEXT: bra foo3@PLT +; x00: .LBB{{.*}}_4: +; x00-NEXT: bra foo6@PLT +; x00: .LBB{{.*}}_7: +; x00-NEXT: bra foo5@PLT +; x00: .LBB{{.*}}_13: +; x00-NEXT: bra foo5@PLT +; +; x00: .LJTI{{.*}}_0: +; x00: .long .LBB{{.*}}_2@GOTOFF +; x00: .long .LBB{{.*}}_8@GOTOFF +; x00: .long .LBB{{.*}}_14@GOTOFF +; x00: .long .LBB{{.*}}_9@GOTOFF +; x00: .long .LBB{{.*}}_10@GOTOFF +; x00: .long .LBB{{.*}}_12@GOTOFF +; x00: .long .LBB{{.*}}_3@GOTOFF +; x00: .long .LBB{{.*}}_5@GOTOFF +; x00: .long .LBB{{.*}}_6@GOTOFF +; x00: .long .LBB{{.*}}_11@GOTOFF +; x00: .long .LBB{{.*}}_4@GOTOFF +; x00: .long .LBB{{.*}}_7@GOTOFF +; x00: .long .LBB{{.*}}_13@GOTOFF +define void @test7(i32 %n.u) nounwind { +entry: + switch i32 %n.u, label %bb12 [i32 1, label %bb i32 2, label %bb6 i32 4, label %bb7 i32 5, label %bb8 i32 6, label %bb10 i32 7, label %bb1 i32 8, label %bb3 i32 9, label %bb4 i32 10, label %bb9 i32 11, label %bb2 i32 12, label %bb5 i32 13, label %bb11 ] +bb: + tail call void(...) @foo1() + ret void +bb1: + tail call void(...) @foo2() + ret void +bb2: + tail call void(...) @foo6() + ret void +bb3: + tail call void(...) @foo3() + ret void +bb4: + tail call void(...) @foo4() + ret void +bb5: + tail call void(...) @foo5() + ret void +bb6: + tail call void(...) @foo1() + ret void +bb7: + tail call void(...) @foo2() + ret void +bb8: + tail call void(...) @foo6() + ret void +bb9: + tail call void(...) @foo3() + ret void +bb10: + tail call void(...) @foo4() + ret void +bb11: + tail call void(...) @foo5() + ret void +bb12: + tail call void(...) @foo6() + ret void +} + +declare void @foo1(...) +declare void @foo2(...) +declare void @foo6(...) +declare void @foo3(...) +declare void @foo4(...) +declare void @foo5(...) Index: llvm/test/CodeGen/M680x0/ASM/CodeModel/medium-pie-global-access.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/CodeModel/medium-pie-global-access.ll @@ -0,0 +1,102 @@ +; RUN: llc < %s -O2 -mtriple=m680x0-linux-gnu -verify-machineinstrs \ +; RUN: -code-model=medium -relocation-model=pic \ +; RUN: | FileCheck %s -check-prefix=x00 + +; External Linkage +@a = global i32 0, align 4 + +; x00-LABEL: my_access_global_a: +; x00: lea (_GLOBAL_OFFSET_TABLE_@GOTPCREL,%pc), %a0 +; x00: move.l #a@GOTOFF, %d0 +; x00: move.l (0,%a0,%d0), %d0 +; x00-NEXT: rts +define i32 @my_access_global_a() #0 { +entry: + %0 = load i32, i32* @a, align 4 + ret i32 %0 +} + +; WeakAny Linkage +@b = weak global i32 0, align 4 + +; x00-LABEL: my_access_global_b: +; x00: lea (_GLOBAL_OFFSET_TABLE_@GOTPCREL,%pc), %a0 +; x00-NEXT: move.l #b@GOTOFF, %d0 +; x00-NEXT: move.l (0,%a0,%d0), %d0 +define i32 @my_access_global_b() #0 { +entry: + %0 = load i32, i32* @b, align 4 + ret i32 %0 +} + +; Internal Linkage +@c = internal global i32 0, align 4 + +; x00-LABEL: my_access_global_c: +; x00: lea (_GLOBAL_OFFSET_TABLE_@GOTPCREL,%pc), %a0 +; x00-NEXT: move.l #c@GOTOFF, %d0 +; x00-NEXT: move.l (0,%a0,%d0), %d0 +define i32 @my_access_global_c() #0 { +entry: + %0 = load i32, i32* @c, align 4 + ret i32 %0 +} + +; External Linkage, only declaration. +@d = external global i32, align 4 + +; x00-LABEL: my_access_global_load_d: +; x00: move.l (d@GOTPCREL,%pc), %a0 +; x00-NEXT: move.l (%a0), %d0 +define i32 @my_access_global_load_d() #0 { +entry: + %0 = load i32, i32* @d, align 4 + ret i32 %0 +} + +; External Linkage, only declaration, store a value. +; x00-LABEL: my_access_global_store_d: +; x00: move.l (d@GOTPCREL,%pc), %a0 +; x00-NEXT: move.l #2, (%a0) +define i32 @my_access_global_store_d() #0 { +entry: + store i32 2, i32* @d, align 4 + ret i32 0 +} + +; External Linkage, function pointer access. +declare i32 @access_fp(i32 ()*) +declare i32 @foo() + +; x00-LABEL: my_access_fp_foo: +; x00: move.l (foo@GOTPCREL,%pc), (%sp) +; x00-NEXT: jsr (access_fp@PLT,%pc) +define i32 @my_access_fp_foo() #0 { +entry: + %call = call i32 @access_fp(i32 ()* @foo) + ret i32 %call +} + +; LinkOnceODR Linkage, function pointer access. + +$bar = comdat any + +define linkonce_odr i32 @bar() comdat { +entry: + ret i32 0 +} + +; x00-LABEL: my_access_fp_bar: +; x00: lea (_GLOBAL_OFFSET_TABLE_@GOTPCREL,%pc), %a0 +; x00-NEXT: add.l #bar@GOTOFF, %a0 +; x00-NEXT: move.l %a0, (%sp) +; x00-NEXT: jsr (access_fp@PLT,%pc) +define i32 @my_access_fp_bar() #0 { +entry: + %call = call i32 @access_fp(i32 ()* @bar) + ret i32 %call +} + +!llvm.module.flags = !{!0, !1} +!0 = !{i32 1, !"PIC Level", i32 1} +!1 = !{i32 1, !"PIE Level", i32 1} Index: llvm/test/CodeGen/M680x0/ASM/CodeModel/medium-pie.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/CodeModel/medium-pie.ll @@ -0,0 +1,44 @@ +; RUN: llc < %s -O0 -mtriple=m680x0-linux-gnu -verify-machineinstrs \ +; RUN: -code-model=medium -relocation-model=pic \ +; RUN:| FileCheck %s -check-prefix=x00 + +define weak void @weak_foo() { + ret void +} + +define weak_odr void @weak_odr_foo() { + ret void +} + +define internal void @internal_foo() { + ret void +} + +declare i32 @ext_baz() + +define void @foo() { + ret void +} + + +; x00-LABEL: bar: +; x00: jsr (foo,%pc) +; x00: jsr (weak_odr_foo,%pc) +; x00: jsr (weak_foo,%pc) +; x00: jsr (internal_foo,%pc) +; x00: jsr (ext_baz@PLT,%pc) +define void @bar() { +entry: + call void @foo() + call void @weak_odr_foo() + call void @weak_foo() + call void @internal_foo() + call i32 @ext_baz() + ret void +} + +; -fpie for local global data tests should be added here + +!llvm.module.flags = !{!0, !1} +!0 = !{i32 1, !"PIC Level", i32 1} +!1 = !{i32 1, !"PIE Level", i32 1} Index: llvm/test/CodeGen/M680x0/ASM/CodeModel/medium-static.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/CodeModel/medium-static.ll @@ -0,0 +1,212 @@ +; RUN: llc < %s -O2 -mtriple=m680x0-linux-gnu -verify-machineinstrs \ +; RUN: -code-model=medium -relocation-model=static \ +; RUN: | FileCheck %s -check-prefix=x00 + +@ptr = external global i32* +@dst = external global i32 +@src = external global i32 + +; x00-LABEL: test0: +; x00: move.l #dst, ptr +; x00-NEXT: move.l src, dst +; x00-NEXT: rts +define void @test0() nounwind { +entry: + store i32* @dst, i32** @ptr + %tmp.s = load i32, i32* @src + store i32 %tmp.s, i32* @dst + ret void +} + +@ptr2 = global i32* null +@dst2 = global i32 0 +@src2 = global i32 0 + +; x00-LABEL: test1: +; x00: move.l #dst2, ptr2 +; x00-NEXT: move.l src2, dst2 +; x00-NEXT: rts +define void @test1() nounwind { +entry: + store i32* @dst2, i32** @ptr2 + %tmp.s = load i32, i32* @src2 + store i32 %tmp.s, i32* @dst2 + ret void +} + +declare i8* @malloc(i32) + +; x00-LABEL: test2: +; x00: move.l #40, (%sp) +; x00: jsr malloc +define void @test2() nounwind { +entry: + %ptr = call i8* @malloc(i32 40) + ret void +} + +@pfoo = external global void(...)* +declare void(...)* @afoo(...) + +; x00-LABEL: test3: +; x00: jsr afoo +; x00-NEXT: move.l %d0, %a0 +; x00-NEXT: move.l %a0, pfoo +; x00-NEXT: jsr (%a0) +define void @test3() nounwind { +entry: + %tmp = call void(...)*(...) @afoo() + store void(...)* %tmp, void(...)** @pfoo + %tmp1 = load void(...)*, void(...)** @pfoo + call void(...) %tmp1() + ret void +} + +declare void @foo(...) + +; x00-LABEL: test4: +; x00: jsr foo +define void @test4() nounwind { +entry: + call void(...) @foo() + ret void +} + +@ptr6 = internal global i32* null +@dst6 = internal global i32 0 +@src6 = internal global i32 0 + +; x00-LABEL: test5: +; x00 lea (dst6,%pc), %a0 +; x00 move.l %a0, (ptr6,%pc) +; x00 move.l (src6,%pc), (%a0) +define void @test5() nounwind { +entry: + store i32* @dst6, i32** @ptr6 + %tmp.s = load i32, i32* @src6 + store i32 %tmp.s, i32* @dst6 + ret void +} + + +;;; Test constant pool references. +;; FIXME no constant pool atm +;; 00: .LCPI6_0: +;; 00-LABEL: test6: +;; 00: calll .L6$pb +;; 00: .L6$pb: +;; 00: addl $_GLOBAL_OFFSET_TABLE_+(.L{{.*}}-.L6$pb), +;; 00: fldl .LCPI6_0@GOTOFF( +;define double @test6(i32 %a.u) nounwind { +;entry: +; %tmp = icmp eq i32 %a.u,0 +; %retval = select i1 %tmp, double 4.561230e+02, double 1.234560e+02 +; ret double %retval +;} + + +; Test jump table references. +; +; x00-LABEL: test7: +; +; x00: move.l (4,%sp), %d0 +; x00-NEXT: add.l #-1, %d0 +; x00-NEXT: move.l %d0, %d1 +; x00-NEXT: sub.l #12, %d1 +; x00-NEXT: bhi .LBB{{.*}}_14 +; x00: lsl.l #2, %d0 +; x00-NEXT: move.l #.LJTI{{.*}}_0, %a0 +; x00-NEXT: move.l (0,%a0,%d0), %a0 +; x00-NEXT: jmp (%a0) +; +; x00: .LBB{{.*}}_2: +; x00-NEXT: bra foo1 +; x00: .LBB{{.*}}_8: +; x00-NEXT: bra foo1 +; x00: .LBB{{.*}}_14: +; x00-NEXT: bra foo6 +; x00: .LBB{{.*}}_9: +; x00-NEXT: bra foo2 +; x00: .LBB{{.*}}_10: +; x00-NEXT: bra foo6 +; x00: .LBB{{.*}}_12: +; x00-NEXT: bra foo4 +; x00: .LBB{{.*}}_3: +; x00-NEXT: bra foo2 +; x00: .LBB{{.*}}_5: +; x00-NEXT: bra foo3 +; x00: .LBB{{.*}}_6: +; x00-NEXT: bra foo4 +; x00: .LBB{{.*}}_11: +; x00-NEXT: bra foo3 +; x00: .LBB{{.*}}_4: +; x00-NEXT: bra foo6 +; x00: .LBB{{.*}}_7: +; x00-NEXT: bra foo5 +; x00: .LBB{{.*}}_13: +; x00-NEXT: bra foo5 +; +; x00: .p2align 2 +; x00: .long .LBB{{.*}}_2 +; x00: .long .LBB{{.*}}_8 +; x00: .long .LBB{{.*}}_14 +; x00: .long .LBB{{.*}}_9 +; x00: .long .LBB{{.*}}_10 +; x00: .long .LBB{{.*}}_12 +; x00: .long .LBB{{.*}}_3 +; x00: .long .LBB{{.*}}_5 +; x00: .long .LBB{{.*}}_6 +; x00: .long .LBB{{.*}}_11 +; x00: .long .LBB{{.*}}_4 +; x00: .long .LBB{{.*}}_7 +; x00: .long .LBB{{.*}}_13 +define void @test7(i32 %n.u) nounwind { +entry: + switch i32 %n.u, label %bb12 [i32 1, label %bb i32 2, label %bb6 i32 4, label %bb7 i32 5, label %bb8 i32 6, label %bb10 i32 7, label %bb1 i32 8, label %bb3 i32 9, label %bb4 i32 10, label %bb9 i32 11, label %bb2 i32 12, label %bb5 i32 13, label %bb11 ] +bb: + tail call void(...) @foo1() + ret void +bb1: + tail call void(...) @foo2() + ret void +bb2: + tail call void(...) @foo6() + ret void +bb3: + tail call void(...) @foo3() + ret void +bb4: + tail call void(...) @foo4() + ret void +bb5: + tail call void(...) @foo5() + ret void +bb6: + tail call void(...) @foo1() + ret void +bb7: + tail call void(...) @foo2() + ret void +bb8: + tail call void(...) @foo6() + ret void +bb9: + tail call void(...) @foo3() + ret void +bb10: + tail call void(...) @foo4() + ret void +bb11: + tail call void(...) @foo5() + ret void +bb12: + tail call void(...) @foo6() + ret void +} + +declare void @foo1(...) +declare void @foo2(...) +declare void @foo6(...) +declare void @foo3(...) +declare void @foo4(...) +declare void @foo5(...) Index: llvm/test/CodeGen/M680x0/ASM/CodeModel/small-pic.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/CodeModel/small-pic.ll @@ -0,0 +1,219 @@ +; RUN: llc < %s -O2 -mtriple=m680x0-linux-gnu -verify-machineinstrs \ +; RUN: -code-model=small -relocation-model=pic \ +; RUN: | FileCheck %s -check-prefix=x00 + +@ptr = external global i32* +@dst = external global i32 +@src = external global i32 + +; x00-LABEL: test0: +; x00: move.l (dst@GOTPCREL,%pc), %a0 +; x00-NEXT: move.l (ptr@GOTPCREL,%pc), %a1 +; x00-NEXT: %a0, (%a1) +; x00-NEXT: move.l (src@GOTPCREL,%pc), %a1 +; x00-NEXT: (%a1), (%a0) +; x00-NEXT: rts +define void @test0() nounwind { +entry: + store i32* @dst, i32** @ptr + %tmp.s = load i32, i32* @src + store i32 %tmp.s, i32* @dst + ret void +} + +@ptr2 = global i32* null +@dst2 = global i32 0 +@src2 = global i32 0 + +; x00-LABEL: test1: +; x00: move.l (dst2@GOTPCREL,%pc), %a0 +; x00-NEXT: move.l (ptr2@GOTPCREL,%pc), %a1 +; x00-NEXT: %a0, (%a1) +; x00-NEXT: move.l (src2@GOTPCREL,%pc), %a1 +; x00-NEXT: (%a1), (%a0) +; x00-NEXT: rts +define void @test1() nounwind { +entry: + store i32* @dst2, i32** @ptr2 + %tmp.s = load i32, i32* @src2 + store i32 %tmp.s, i32* @dst2 + ret void +} + +declare i8* @malloc(i32) + +; x00-LABEL: test2: +; x00: move.l #40, (%sp) +; x00: jsr (malloc@PLT,%pc) +define void @test2() nounwind { +entry: + %ptr = call i8* @malloc(i32 40) + ret void +} + +@pfoo = external global void(...)* +declare void(...)* @afoo(...) + +; x00-LABEL: test3: +; x00: jsr (afoo@PLT,%pc) +; x00-NEXT: move.l %d0, %a0 +; x00-NEXT: move.l (pfoo@GOTPCREL,%pc), %a1 +; x00-NEXT: move.l %a0, (%a1) +; x00-NEXT: jsr (%a0) +define void @test3() nounwind { +entry: + %tmp = call void(...)*(...) @afoo() + store void(...)* %tmp, void(...)** @pfoo + %tmp1 = load void(...)*, void(...)** @pfoo + call void(...) %tmp1() + ret void +} + +declare void @foo(...) + +; x00-LABEL: test4: +; x00: jsr (foo@PLT,%pc) +define void @test4() nounwind { +entry: + call void(...) @foo() + ret void +} + +@ptr6 = internal global i32* null +@dst6 = internal global i32 0 +@src6 = internal global i32 0 + +; x00-LABEL: test5: +; x00 lea (dst6,%pc), %a0 +; x00 move.l %a0, (ptr6,%pc) +; x00 move.l (src6,%pc), (%a0) +define void @test5() nounwind { +entry: + store i32* @dst6, i32** @ptr6 + %tmp.s = load i32, i32* @src6 + store i32 %tmp.s, i32* @dst6 + ret void +} + + +;;; Test constant pool references. +;; FIXME no constant pool atm +;; 00: .LCPI6_0: +;; 00-LABEL: test6: +;; 00: calll .L6$pb +;; 00: .L6$pb: +;; 00: addl $_GLOBAL_OFFSET_TABLE_+(.L{{.*}}-.L6$pb), +;; 00: fldl .LCPI6_0@GOTOFF( +;define double @test6(i32 %a.u) nounwind { +;entry: +; %tmp = icmp eq i32 %a.u,0 +; %retval = select i1 %tmp, double 4.561230e+02, double 1.234560e+02 +; ret double %retval +;} + + +; Test jump table references. +; +; x00-LABEL: test7: +; +; x00: move.l (4,%sp), %d0 +; x00-NEXT: add.l #-1, %d0 +; x00-NEXT: move.l %d0, %d1 +; x00-NEXT: sub.l #12, %d1 +; x00-NEXT: bhi .LBB{{.*}}_14 +; x00: lsl.l #2, %d0 +; x00-NEXT: lea (.LJTI{{.*}}_0,%pc), %a0 +; x00-NEXT: add.l (0,%a0,%d0), %a0 +; x00-NEXT: jmp (%a0) +; +; x00: .LBB{{.*}}_2: +; x00-NEXT: bra foo1@PLT +; x00: .LBB{{.*}}_8: +; x00-NEXT: bra foo1@PLT +; x00: .LBB{{.*}}_14: +; x00-NEXT: bra foo6@PLT +; x00: .LBB{{.*}}_9: +; x00-NEXT: bra foo2@PLT +; x00: .LBB{{.*}}_10: +; x00-NEXT: bra foo6@PLT +; x00: .LBB{{.*}}_12: +; x00-NEXT: bra foo4@PLT +; x00: .LBB{{.*}}_3: +; x00-NEXT: bra foo2@PLT +; x00: .LBB{{.*}}_5: +; x00-NEXT: bra foo3@PLT +; x00: .LBB{{.*}}_6: +; x00-NEXT: bra foo4@PLT +; x00: .LBB{{.*}}_11: +; x00-NEXT: bra foo3@PLT +; x00: .LBB{{.*}}_4: +; x00-NEXT: bra foo6@PLT +; x00: .LBB{{.*}}_7: +; x00-NEXT: bra foo5@PLT +; x00: .LBB{{.*}}_13: +; x00-NEXT: bra foo5@PLT +; +; x00: .p2align 2 +; x00: .long .LBB{{.*}}_2-.LJTI{{.*}}_0 +; x00: .long .LBB{{.*}}_8-.LJTI{{.*}}_0 +; x00: .long .LBB{{.*}}_14-.LJTI{{.*}}_0 +; x00: .long .LBB{{.*}}_9-.LJTI{{.*}}_0 +; x00: .long .LBB{{.*}}_10-.LJTI{{.*}}_0 +; x00: .long .LBB{{.*}}_12-.LJTI{{.*}}_0 +; x00: .long .LBB{{.*}}_3-.LJTI{{.*}}_0 +; x00: .long .LBB{{.*}}_5-.LJTI{{.*}}_0 +; x00: .long .LBB{{.*}}_6-.LJTI{{.*}}_0 +; x00: .long .LBB{{.*}}_11-.LJTI{{.*}}_0 +; x00: .long .LBB{{.*}}_4-.LJTI{{.*}}_0 +; x00: .long .LBB{{.*}}_7-.LJTI{{.*}}_0 +; x00: .long .LBB{{.*}}_13-.LJTI{{.*}}_0 +define void @test7(i32 %n.u) nounwind { +entry: + switch i32 %n.u, label %bb12 [i32 1, label %bb i32 2, label %bb6 i32 4, label %bb7 i32 5, label %bb8 i32 6, label %bb10 i32 7, label %bb1 i32 8, label %bb3 i32 9, label %bb4 i32 10, label %bb9 i32 11, label %bb2 i32 12, label %bb5 i32 13, label %bb11 ] +bb: + tail call void(...) @foo1() + ret void +bb1: + tail call void(...) @foo2() + ret void +bb2: + tail call void(...) @foo6() + ret void +bb3: + tail call void(...) @foo3() + ret void +bb4: + tail call void(...) @foo4() + ret void +bb5: + tail call void(...) @foo5() + ret void +bb6: + tail call void(...) @foo1() + ret void +bb7: + tail call void(...) @foo2() + ret void +bb8: + tail call void(...) @foo6() + ret void +bb9: + tail call void(...) @foo3() + ret void +bb10: + tail call void(...) @foo4() + ret void +bb11: + tail call void(...) @foo5() + ret void +bb12: + tail call void(...) @foo6() + ret void +} + +declare void @foo1(...) +declare void @foo2(...) +declare void @foo6(...) +declare void @foo3(...) +declare void @foo4(...) +declare void @foo5(...) Index: llvm/test/CodeGen/M680x0/ASM/CodeModel/small-pie-global-access.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/CodeModel/small-pie-global-access.ll @@ -0,0 +1,95 @@ +; RUN: llc < %s -O2 -mtriple=m680x0-linux-gnu -verify-machineinstrs \ +; RUN: -code-model=small -relocation-model=pic \ +; RUN: | FileCheck %s -check-prefix=x00 + +; External Linkage +@a = global i32 0, align 4 + +; x00-LABEL: my_access_global_a: +; x00: move.l (a,%pc), %d0 +; x00-NEXT: rts +define i32 @my_access_global_a() #0 { +entry: + %0 = load i32, i32* @a, align 4 + ret i32 %0 +} + +; WeakAny Linkage +@b = weak global i32 0, align 4 + +; x00-LABEL: my_access_global_b: +; x00: move.l (b,%pc), %d0 +define i32 @my_access_global_b() #0 { +entry: + %0 = load i32, i32* @b, align 4 + ret i32 %0 +} + +; Internal Linkage +@c = internal global i32 0, align 4 + +; x00-LABEL: my_access_global_c: +; x00: move.l (c,%pc), %d0 +define i32 @my_access_global_c() #0 { +entry: + %0 = load i32, i32* @c, align 4 + ret i32 %0 +} + +; External Linkage, only declaration. +@d = external global i32, align 4 + +; x00-LABEL: my_access_global_load_d: +; x00: move.l (d@GOTPCREL,%pc), %a0 +; x00-NEXT: move.l (%a0), %d0 +define i32 @my_access_global_load_d() #0 { +entry: + %0 = load i32, i32* @d, align 4 + ret i32 %0 +} + +; External Linkage, only declaration, store a value. +; x00-LABEL: my_access_global_store_d: +; x00: move.l (d@GOTPCREL,%pc), %a0 +; x00-NEXT: move.l #2, (%a0) +define i32 @my_access_global_store_d() #0 { +entry: + store i32 2, i32* @d, align 4 + ret i32 0 +} + +; External Linkage, function pointer access. +declare i32 @access_fp(i32 ()*) +declare i32 @foo() + +; x00-LABEL: my_access_fp_foo: +; x00: move.l (foo@GOTPCREL,%pc), (%sp) +; x00-NEXT: jsr (access_fp@PLT,%pc) +define i32 @my_access_fp_foo() #0 { +entry: + %call = call i32 @access_fp(i32 ()* @foo) + ret i32 %call +} + +; LinkOnceODR Linkage, function pointer access. + +$bar = comdat any + +define linkonce_odr i32 @bar() comdat { +entry: + ret i32 0 +} + +; x00-LABEL: my_access_fp_bar: +; x00: lea (bar,%pc), %a0 +; x00-NEXT: move.l %a0, (%sp) +; x00-NEXT: jsr (access_fp@PLT,%pc) +define i32 @my_access_fp_bar() #0 { +entry: + %call = call i32 @access_fp(i32 ()* @bar) + ret i32 %call +} + +!llvm.module.flags = !{!0, !1} +!0 = !{i32 1, !"PIC Level", i32 1} +!1 = !{i32 1, !"PIE Level", i32 1} Index: llvm/test/CodeGen/M680x0/ASM/CodeModel/small-pie.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/CodeModel/small-pie.ll @@ -0,0 +1,44 @@ +; RUN: llc < %s -O0 -mtriple=m680x0-linux-gnu -verify-machineinstrs \ +; RUN: -code-model=small -relocation-model=pic \ +; RUN: | FileCheck %s -check-prefix=x00 + +define weak void @weak_foo() { + ret void +} + +define weak_odr void @weak_odr_foo() { + ret void +} + +define internal void @internal_foo() { + ret void +} + +declare i32 @ext_baz() + +define void @foo() { + ret void +} + + +; x00-LABEL: bar: +; x00: jsr (foo,%pc) +; x00: jsr (weak_odr_foo,%pc) +; x00: jsr (weak_foo,%pc) +; x00: jsr (internal_foo,%pc) +; x00: jsr (ext_baz@PLT,%pc) +define void @bar() { +entry: + call void @foo() + call void @weak_odr_foo() + call void @weak_foo() + call void @internal_foo() + call i32 @ext_baz() + ret void +} + +; -fpie for local global data tests should be added here + +!llvm.module.flags = !{!0, !1} +!0 = !{i32 1, !"PIC Level", i32 1} +!1 = !{i32 1, !"PIE Level", i32 1} Index: llvm/test/CodeGen/M680x0/ASM/CodeModel/small-static.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/CodeModel/small-static.ll @@ -0,0 +1,216 @@ +; RUN: llc < %s -O2 -mtriple=m680x0-linux-gnu -verify-machineinstrs \ +; RUN: -code-model=small -relocation-model=static \ +; RUN: | FileCheck %s -check-prefix=x00 + +@ptr = external global i32* +@dst = external global i32 +@src = external global i32 + +; x00-LABEL: test0: +; x00: lea (dst,%pc), %a0 +; x00: lea (ptr,%pc), %a1 +; x00-NEXT: move.l %a0, (%a1) +; x00-NEXT: move.l (src,%pc), (%a0) +; x00-NEXT: rts +define void @test0() nounwind { +entry: + store i32* @dst, i32** @ptr + %tmp.s = load i32, i32* @src + store i32 %tmp.s, i32* @dst + ret void +} + +@ptr2 = global i32* null +@dst2 = global i32 0 +@src2 = global i32 0 + +; x00-LABEL: test1: +; x00: lea (dst2,%pc), %a0 +; x00-NEXT move.l %a0, (ptr2,%pc) +; x00-NEXT move.l (src2,%pc), (dst2,%pc) +; x00-NEXT rts +define void @test1() nounwind { +entry: + store i32* @dst2, i32** @ptr2 + %tmp.s = load i32, i32* @src2 + store i32 %tmp.s, i32* @dst2 + ret void +} + +declare i8* @malloc(i32) + +; x00-LABEL: test2: +; x00: move.l #40, (%sp) +; x00: jsr malloc +define void @test2() nounwind { +entry: + %ptr = call i8* @malloc(i32 40) + ret void +} + +@pfoo = external global void(...)* +declare void(...)* @afoo(...) + +; x00-LABEL: test3: +; x00: jsr afoo +; x00-NEXT: move.l %d0, %a0 +; x00-NEXT: lea (pfoo,%pc), %a1 +; x00-NEXT: move.l %a0, (%a1) +; x00-NEXT: jsr (%a0) +define void @test3() nounwind { +entry: + %tmp = call void(...)*(...) @afoo() + store void(...)* %tmp, void(...)** @pfoo + %tmp1 = load void(...)*, void(...)** @pfoo + call void(...) %tmp1() + ret void +} + +declare void @foo(...) + +; x00-LABEL: test4: +; x00: jsr foo +define void @test4() nounwind { +entry: + call void(...) @foo() + ret void +} + +@ptr6 = internal global i32* null +@dst6 = internal global i32 0 +@src6 = internal global i32 0 + +; x00-LABEL: test5: +; x00 lea (dst6,%pc), %a0 +; x00 move.l %a0, (ptr6,%pc) +; x00 move.l (src6,%pc), (%a0) +define void @test5() nounwind { +entry: + store i32* @dst6, i32** @ptr6 + %tmp.s = load i32, i32* @src6 + store i32 %tmp.s, i32* @dst6 + ret void +} + + +;;; Test constant pool references. +;; FIXME no constant pool atm +;; 00: .LCPI6_0: +;; 00-LABEL: test6: +;; 00: calll .L6$pb +;; 00: .L6$pb: +;; 00: addl $_GLOBAL_OFFSET_TABLE_+(.L{{.*}}-.L6$pb), +;; 00: fldl .LCPI6_0@GOTOFF( +;define double @test6(i32 %a.u) nounwind { +;entry: +; %tmp = icmp eq i32 %a.u,0 +; %retval = select i1 %tmp, double 4.561230e+02, double 1.234560e+02 +; ret double %retval +;} + + +; Test jump table references. +; +; x00-LABEL: test7: +; +; x00: move.l (4,%sp), %d0 +; x00-NEXT: add.l #-1, %d0 +; x00-NEXT: move.l %d0, %d1 +; x00-NEXT: sub.l #12, %d1 +; x00-NEXT: bhi .LBB{{.*}}_14 +; x00: lsl.l #2, %d0 +; x00-NEXT: lea (.LJTI{{.*}}_0,%pc), %a0 +; x00-NEXT: move.l (0,%a0,%d0), %a0 +; x00-NEXT: jmp (%a0) +; +; x00: .LBB{{.*}}_2: +; x00-NEXT: bra foo1 +; x00: .LBB{{.*}}_8: +; x00-NEXT: bra foo1 +; x00: .LBB{{.*}}_14: +; x00-NEXT: bra foo6 +; x00: .LBB{{.*}}_9: +; x00-NEXT: bra foo2 +; x00: .LBB{{.*}}_10: +; x00-NEXT: bra foo6 +; x00: .LBB{{.*}}_12: +; x00-NEXT: bra foo4 +; x00: .LBB{{.*}}_3: +; x00-NEXT: bra foo2 +; x00: .LBB{{.*}}_5: +; x00-NEXT: bra foo3 +; x00: .LBB{{.*}}_6: +; x00-NEXT: bra foo4 +; x00: .LBB{{.*}}_11: +; x00-NEXT: bra foo3 +; x00: .LBB{{.*}}_4: +; x00-NEXT: bra foo6 +; x00: .LBB{{.*}}_7: +; x00-NEXT: bra foo5 +; x00: .LBB{{.*}}_13: +; x00-NEXT: bra foo5 +; +; x00: .p2align 2 +; x00: .long .LBB{{.*}}_2 +; x00: .long .LBB{{.*}}_8 +; x00: .long .LBB{{.*}}_14 +; x00: .long .LBB{{.*}}_9 +; x00: .long .LBB{{.*}}_10 +; x00: .long .LBB{{.*}}_12 +; x00: .long .LBB{{.*}}_3 +; x00: .long .LBB{{.*}}_5 +; x00: .long .LBB{{.*}}_6 +; x00: .long .LBB{{.*}}_11 +; x00: .long .LBB{{.*}}_4 +; x00: .long .LBB{{.*}}_7 +; x00: .long .LBB{{.*}}_13 +define void @test7(i32 %n.u) nounwind { +entry: + switch i32 %n.u, label %bb12 [i32 1, label %bb i32 2, label %bb6 i32 4, label %bb7 i32 5, label %bb8 i32 6, label %bb10 i32 7, label %bb1 i32 8, label %bb3 i32 9, label %bb4 i32 10, label %bb9 i32 11, label %bb2 i32 12, label %bb5 i32 13, label %bb11 ] +bb: + tail call void(...) @foo1() + ret void +bb1: + tail call void(...) @foo2() + ret void +bb2: + tail call void(...) @foo6() + ret void +bb3: + tail call void(...) @foo3() + ret void +bb4: + tail call void(...) @foo4() + ret void +bb5: + tail call void(...) @foo5() + ret void +bb6: + tail call void(...) @foo1() + ret void +bb7: + tail call void(...) @foo2() + ret void +bb8: + tail call void(...) @foo6() + ret void +bb9: + tail call void(...) @foo3() + ret void +bb10: + tail call void(...) @foo4() + ret void +bb11: + tail call void(...) @foo5() + ret void +bb12: + tail call void(...) @foo6() + ret void +} + +declare void @foo1(...) +declare void @foo2(...) +declare void @foo6(...) +declare void @foo3(...) +declare void @foo4(...) +declare void @foo5(...) Index: llvm/test/CodeGen/M680x0/ASM/Control/cmp.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/Control/cmp.ll @@ -0,0 +1,209 @@ +; RUN: llc < %s -mtriple=m680x0-linux-gnu -verify-machineinstrs | FileCheck %s --check-prefix=x00 + +; x00-LABEL: test1: +; x00: cmpi.l #0, (%a0) +; x00: beq +define i32 @test1(i32* %y) nounwind { + %tmp = load i32, i32* %y ; [#uses=1] + %tmp.upgrd.1 = icmp eq i32 %tmp, 0 ; [#uses=1] + br i1 %tmp.upgrd.1, label %cond_true, label %cond_false + +cond_false: ; preds = %0 + ret i32 0 + +cond_true: ; preds = %0 + ret i32 1 +} + +; x00-LABEL: test2: +; x00: and.l #536870911 +; TODO There is no need for cmpi.l, and.l sets Z as well +; x00: cmpi.l #0 +; x00: beq +define i32 @test2(i32* %y) nounwind { + %tmp = load i32, i32* %y ; [#uses=1] + %tmp1 = shl i32 %tmp, 3 ; [#uses=1] + %tmp1.upgrd.2 = icmp eq i32 %tmp1, 0 ; [#uses=1] + br i1 %tmp1.upgrd.2, label %cond_true, label %cond_false + +cond_false: ; preds = %0 + ret i32 0 + +cond_true: ; preds = %0 + ret i32 1 +} + +; x00-LABEL: test2b: +; x00: and.b #31 +; x00: cmpi.b #0 +; x00: beq +define i8 @test2b(i8* %y) nounwind { + %tmp = load i8, i8* %y ; [#uses=1] + %tmp1 = shl i8 %tmp, 3 ; [#uses=1] + %tmp1.upgrd.2 = icmp eq i8 %tmp1, 0 ; [#uses=1] + br i1 %tmp1.upgrd.2, label %cond_true, label %cond_false + +cond_false: ; preds = %0 + ret i8 0 + +cond_true: ; preds = %0 + ret i8 1 +} + +; x00-LABEL: test3: +; x00: or.l +; x00-NEXT: seq %d0 +; x00-NEXT: move.l %d0, %d1 +; x00-NEXT: and.l #255, %d1 +; x00-NEXT: move.l #0, %d0 +define i64 @test3(i64 %x) nounwind { + %t = icmp eq i64 %x, 0 + %r = zext i1 %t to i64 + ret i64 %r +} + +; x00-LABEL: test4: +; x00: sub.l #1 +; x00: subx.l +; x00: slt +define i64 @test4(i64 %x) nounwind { + %t = icmp slt i64 %x, 1 + %r = zext i1 %t to i64 + ret i64 %r +} + +; x00-LABEL: test6: +; x00: move.l (12,%sp), %d0 +; x00: or.l (8,%sp), %d0 +; x00: beq +define i32 @test6() nounwind align 2 { + %A = alloca {i64, i64}, align 8 + %B = getelementptr inbounds {i64, i64}, {i64, i64}* %A, i64 0, i32 1 + %C = load i64, i64* %B + %D = icmp eq i64 %C, 0 + br i1 %D, label %T, label %F +T: + ret i32 1 + +F: + ret i32 0 +} + +; x00-LABEL: test7: +; x00: cmpi.l #0, (4,%sp) +; x00: seq +define i32 @test7(i64 %res) nounwind { +entry: + %lnot = icmp ult i64 %res, 4294967296 + %lnot.ext = zext i1 %lnot to i32 + ret i32 %lnot.ext +} + +; x00-LABEL: test8: +; x00: move.l (4,%sp), %d0 +; x00: sub.l #3, %d0 +; x00: scs %d0 +define i32 @test8(i64 %res) nounwind { +entry: + %lnot = icmp ult i64 %res, 12884901888 + %lnot.ext = zext i1 %lnot to i32 + ret i32 %lnot.ext +} + +; x00-LABEL: test11: +; x00: move.l (4,%sp), %d0 +; x00: and.l #-32768, %d0 +; x00: eori.l #32768, %d0 +; x00: seq +define i32 @test11(i64 %l) nounwind { +entry: + %shr.mask = and i64 %l, -140737488355328 + %cmp = icmp eq i64 %shr.mask, 140737488355328 + %conv = zext i1 %cmp to i32 + ret i32 %conv +} + +; x00-LABEL: test13: +; x00: move.b (7,%sp) +; x00: and.b #8 +; x00: cmpi.b #0 +define i32 @test13(i32 %mask, i32 %base, i32 %intra) { + %and = and i32 %mask, 8 + %tobool = icmp ne i32 %and, 0 + %cond = select i1 %tobool, i32 %intra, i32 %base + ret i32 %cond +} + +; x00-LABEL: test14: +; x00: move.l +; x00: lsr.l #7 +; x00: cmpi.l #0 +; x00: bpl +define i32 @test14(i32 %mask, i32 %base, i32 %intra) #0 { + %s = lshr i32 %mask, 7 + %tobool = icmp sgt i32 %s, -1 + %cond = select i1 %tobool, i32 %intra, i32 %base + ret i32 %cond +} + +; x00-LABEL: test15: +; x00: scc +; x00: seq +; x00: or.b +define zeroext i1 @test15(i32 %bf.load, i32 %n) { + %bf.lshr = lshr i32 %bf.load, 16 + %cmp2 = icmp eq i32 %bf.lshr, 0 + %cmp5 = icmp uge i32 %bf.lshr, %n + %.cmp5 = or i1 %cmp2, %cmp5 + ret i1 %.cmp5 +} + +; x00-LABEL: test16: +; x00: move.w #15 +; x00: move.w (6,%sp), %d0 +; x00: lsr.w +; x00: eori.b #1 +define i8 @test16(i16 signext %L) { + %lshr = lshr i16 %L, 15 + %trunc = trunc i16 %lshr to i8 + %not = xor i8 %trunc, 1 + ret i8 %not +} + +; x00-LABEL: test18: +; x00: move.l #31 +; x00: move.l +; x00: lsr.l +; x00: eori.b #1 +define i8 @test18(i64 %L) { + %lshr = lshr i64 %L, 63 + %trunc = trunc i64 %lshr to i8 + %not = xor i8 %trunc, 1 + ret i8 %not +} + +@d = global i8 0, align 1 + + +; x00-LABEL: test20 +; x00: and.l +; x00: sne +; x00: add.l +; x00: sne +; x00: cmpi.l +; x00: sne +define void @test20(i32 %bf.load, i8 %x1, i8* %b_addr) { + %bf.shl = shl i32 %bf.load, 8 + %bf.ashr = ashr exact i32 %bf.shl, 8 + %tobool4 = icmp ne i32 %bf.ashr, 0 + %conv = zext i1 %tobool4 to i32 + %conv6 = zext i8 %x1 to i32 + %add = add nuw nsw i32 %conv, %conv6 + %tobool7 = icmp ne i32 %add, 0 + %frombool = zext i1 %tobool7 to i8 + store i8 %frombool, i8* %b_addr, align 1 + %tobool14 = icmp ne i32 %bf.shl, 0 + %frombool15 = zext i1 %tobool14 to i8 + store i8 %frombool15, i8* @d, align 1 + ret void +} Index: llvm/test/CodeGen/M680x0/ASM/Control/long-setcc.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/Control/long-setcc.ll @@ -0,0 +1,32 @@ +; RUN: llc < %s -mtriple=m680x0-linux -verify-machineinstrs | FileCheck %s -check-prefix=x00 + +; x00: t1 +; x00: lsr.l +; x00-NOT: lsr.l +; x00: rts + +define i1 @t1(i64 %x) nounwind { + %B = icmp slt i64 %x, 0 + ret i1 %B +} + + +; x00: t2 +; x00: cmpi.l +; x00-NEXT: seq +; x00-NEXT: rts + +define i1 @t2(i64 %x) nounwind { + %tmp = icmp ult i64 %x, 4294967296 + ret i1 %tmp +} + + +; x00: t3 +; x00: move.b #0, %d0 +; x00: rts + +define i1 @t3(i32 %x) nounwind { + %tmp = icmp ugt i32 %x, -1 + ret i1 %tmp +} Index: llvm/test/CodeGen/M680x0/ASM/Control/setcc.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/Control/setcc.ll @@ -0,0 +1,91 @@ +; RUN: llc < %s -mtriple=m680x0-linux -verify-machineinstrs | FileCheck %s -check-prefix=x00 + +;; TODO All these can be improved + +; x00-LABEL: t1: +; x00: move.w +; x00: and.l #65535, %d0 +; x00: sub.l #26, %d0 +; x00: shi %d0 +; x00: and.l #255, %d0 +; x00: lsl.l #5, %d0 + +define zeroext i16 @t1(i16 zeroext %x) nounwind readnone ssp { +entry: + %0 = icmp ugt i16 %x, 26 ; [#uses=1] + %iftmp.1.0 = select i1 %0, i16 32, i16 0 ; [#uses=1] + ret i16 %iftmp.1.0 +} + + +; x00-LABEL: t2: +; x00: move.w +; x00: and.l #65535, %d0 +; x00: sub.l #26, %d0 +; x00: scs %d0 +; x00: and.l #255, %d0 +; x00: lsl.l #5, %d0 + +define zeroext i16 @t2(i16 zeroext %x) nounwind readnone ssp { +entry: + %0 = icmp ult i16 %x, 26 ; [#uses=1] + %iftmp.0.0 = select i1 %0, i16 32, i16 0 ; [#uses=1] + ret i16 %iftmp.0.0 +} + +; x00-LABEL: t3: +; x00: move.l #0, %d2 +; x00: sub.l #18, %d1 +; x00: subx.l %d2, %d0 +; x00: scs +; x00: and.l +; x00: lsl.l + +define fastcc i64 @t3(i64 %x) nounwind readnone ssp { +entry: + %0 = icmp ult i64 %x, 18 ; [#uses=1] + %iftmp.2.0 = select i1 %0, i64 64, i64 0 ; [#uses=1] + ret i64 %iftmp.2.0 +} + + +; x00-LABEL: t5: +; x00: move.l #31 +; x00: move.l (4 +; x00: lsr.l +; x00: eori.b +; +; Should be: +; cmp.l +; smi +; since we are intereseted in sign bit only + +define i8 @t5(i32 %a) { +entry: + %.lobit = lshr i32 %a, 31 + %trunc = trunc i32 %.lobit to i8 + %.not = xor i8 %trunc, 1 + ret i8 %.not +} + + +; x00-LABEL: t6: +; x00: move.l #31 +; x00: move.l (4 +; x00: lsr.l +; x00: eori.b +; x00: and.l +; +; Should be: +; cmp.l +; smi +; since we are intereseted in sign bit only +; and.l in the end is superfluous + +define zeroext i1 @t6(i32 %a) { +entry: + %.lobit = lshr i32 %a, 31 + %trunc = trunc i32 %.lobit to i1 + %.not = xor i1 %trunc, 1 + ret i1 %.not +} Index: llvm/test/CodeGen/M680x0/ASM/Std/varargs.ll =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/ASM/Std/varargs.ll @@ -0,0 +1,31 @@ +; RUN: llc < %s -mtriple=m680x0-linux -verify-machineinstrs | FileCheck %s -check-prefix=x00 + +%struct.va_list = type { i8* } + +; x00-LABEL test: +; x00: lea (16,%sp), %a +; x00: add.l #4, %a0 +; x00: move.l %a0, (4,%sp) +define i32 @test(i32 %X, ...) { + ; Initialize variable argument processing + %ap = alloca %struct.va_list + %ap2 = bitcast %struct.va_list* %ap to i8* + call void @llvm.va_start(i8* %ap2) + + ; Read a single integer argument + %tmp = va_arg i8* %ap2, i32 + + ; Demonstrate usage of llvm.va_copy and llvm.va_end + %aq = alloca i8* + %aq2 = bitcast i8** %aq to i8* + call void @llvm.va_copy(i8* %aq2, i8* %ap2) + call void @llvm.va_end(i8* %aq2) + + ; Stop processing of arguments. + call void @llvm.va_end(i8* %ap2) + ret i32 %tmp +} + +declare void @llvm.va_start(i8*) +declare void @llvm.va_copy(i8*, i8*) +declare void @llvm.va_end(i8*) Index: llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxBiArOp_FMI.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxBiArOp_FMI.mir @@ -0,0 +1,88 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=ADD8fi,ADD32fi,ADD8pi,ADD32pi,ADD8ji,ADD32ji + +#------------------------------------------------------------------------------ +# MxBiArOp_FMI class used for binary arithmetic operations and operates on +# memory and immediate data. It uses MxArithImmEncoding class. +#------------------------------------------------------------------------------ + + +--- # ARII +# -------------------------------+-------+-----------+----------- +# F E D C B A 9 8 | 7 6 | 5 4 3 | 2 1 0 +# -------------------------------+-------+-----------+----------- +# OPWORD x x x x x x x x | SIZE | MODE | REG +# -------------------------------+-------+-----------+----------- +# ADD8fi: 0 0 0 0 0 1 1 0 . 0 0 1 1 0 0 0 0 +# ADD8fi-SAME: 0 0 0 0 0 0 0 0 . 1 1 1 1 1 1 1 1 +# ADD8fi-SAME: 0 0 0 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+------------------------------- +# ADD8fi-SAME: 0 0 0 0 0 1 1 0 . 0 0 1 1 0 0 1 1 +# ADD8fi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# ADD8fi-SAME: 1 0 0 1 1 0 0 0 . 1 1 1 1 1 1 1 1 +# -------------------------------+------------------------------- +# ADD32fi-SAME: 0 0 0 0 0 1 1 0 . 1 0 1 1 0 0 1 0 +# ADD32fi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# ADD32fi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# ADD32fi-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 1 1 0 1 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxBiArOp_FMI_ARII +body: | + bb.0: + ADD8fi 0, $a0, $d0, -1, implicit-def $ccr + ADD8fi -1, $a3, $a1, 0, implicit-def $ccr + ADD32fi 13, $a2, $d1, -1, implicit-def $ccr + +... +--- # ARID +# -------------------------------+-------+-----------+----------- +# F E D C B A 9 8 | 7 6 | 5 4 3 | 2 1 0 +# -------------------------------+-------+-----------+----------- +# OPWORD x x x x x x x x | SIZE | MODE | REG +# -------------------------------+-------+-----------+----------- +# ADD8pi-SAME: 0 0 0 0 0 1 1 0 . 0 0 1 0 1 0 0 0 +# ADD8pi-SAME: 0 0 0 0 0 0 0 0 . 1 1 1 1 1 1 1 1 +# ADD8pi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+------------------------------- +# ADD8pi-SAME: 0 0 0 0 0 1 1 0 . 0 0 1 0 1 0 1 1 +# ADD8pi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# ADD8pi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# -------------------------------+------------------------------- +# ADD32pi-SAME: 0 0 0 0 0 1 1 0 . 1 0 1 0 1 0 1 0 +# ADD32pi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# ADD32pi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# ADD32pi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 1 1 0 1 +name: MxBiArOp_FMI_ARID +body: | + bb.0: + ADD8pi 0, $a0, -1, implicit-def $ccr + ADD8pi -1, $a3, 0, implicit-def $ccr + ADD32pi 13, $a2, -1, implicit-def $ccr + +... +--- # ARI +# -------------------------------+-------+-----------+----------- +# F E D C B A 9 8 | 7 6 | 5 4 3 | 2 1 0 +# -------------------------------+-------+-----------+----------- +# OPWORD x x x x x x x x | SIZE | MODE | REG +# -------------------------------+-------+-----------+----------- +# ADD8ji-SAME: 0 0 0 0 0 1 1 0 . 0 0 0 1 0 0 0 0 +# ADD8ji-SAME: 0 0 0 0 0 0 0 0 . 1 1 1 1 1 1 1 1 +# -------------------------------+------------------------------- +# ADD8ji-SAME: 0 0 0 0 0 1 1 0 . 0 0 0 1 0 0 1 1 +# ADD8ji-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+------------------------------- +# ADD32ji-SAME: 0 0 0 0 0 1 1 0 . 1 0 0 1 0 0 1 0 +# ADD32ji-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# ADD32ji-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxBiArOp_FMI_ARI +body: | + bb.0: + ADD8ji $a0, -1, implicit-def $ccr + ADD8ji $a3, 0, implicit-def $ccr + ADD32ji $a2, -1, implicit-def $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxBiArOp_FMR.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxBiArOp_FMR.mir @@ -0,0 +1,73 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=ADD8fd,ADD32fd,ADD8pd,ADD32pd,ADD8jd,ADD32jd + +#------------------------------------------------------------------------------ +# MxBiArOp_FMR class used for binary arithmetic operations and operates on +# register and memory; the result is store to memory. It uses MxArithEncoding +# encoding class and MxOpModeEAd opmode class. +#------------------------------------------------------------------------------ + +--- # ARII +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# OPWORD x x x x | REG | OPMODE | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# ADD8fd: 1 1 0 1 0 0 0 1 . 0 0 1 1 0 0 0 0 +# ADD8fd-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# ADD8fd-SAME: 1 1 0 1 0 0 0 1 . 0 0 1 1 0 0 0 0 +# ADD8fd-SAME: 0 0 0 1 1 0 0 0 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# ADD32fd-SAME: 1 1 0 1 0 0 0 1 . 1 0 1 1 0 0 0 1 +# ADD32fd-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# ADD32fd-SAME: 1 1 0 1 0 0 1 1 . 1 0 1 1 0 0 1 0 +# ADD32fd-SAME: 1 0 1 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxBiArOp_FMR_ARII +body: | + bb.0: + ADD8fd 0, $a0, $d1, $bd0, implicit-def $ccr + ADD8fd -1, $a0, $d1, $bd0, implicit-def $ccr + ADD32fd 0, $a1, $d1, $d0, implicit-def $ccr + ADD32fd 0, $a2, $a2, $d1, implicit-def $ccr + +... +--- # ARID +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# OPWORD x x x x | REG | OPMODE | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# ADD8pd-SAME: 1 1 0 1 0 0 0 1 . 0 0 1 0 1 0 0 0 +# ADD8pd-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# ADD32pd-SAME: 1 1 0 1 0 0 0 1 . 1 0 1 0 1 0 0 1 +# ADD32pd-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxBiArOp_FMR_ARID +body: | + bb.0: + ADD8pd 0, $a0, $bd0, implicit-def $ccr + ADD32pd -1, $a1, $d0, implicit-def $ccr + +... +--- # ARI +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# OPWORD x x x x | REG | OPMODE | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# ADD8jd-SAME: 1 1 0 1 0 0 0 1 . 0 0 0 1 0 0 0 0 +# --------------------------------------------------------------- +# ADD32jd-SAME: 1 1 0 1 0 1 1 1 . 1 0 0 1 0 0 0 1 +name: MxBiArOp_FMR_ARI +body: | + bb.0: + ADD8jd $a0, $bd0, implicit-def $ccr + ADD32jd $a1, $d3, implicit-def $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxBiArOp_RFRI.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxBiArOp_RFRI.mir @@ -0,0 +1,41 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=XOR16di,XOR32di + +#------------------------------------------------------------------------------ +# MxBiArOp_RFRI class used for binary arithmetic operations and operates on +# register and immediate data. It uses MxArithImmEncoding class. This is special +# case for XOR. +#------------------------------------------------------------------------------ + + +# -------------------------------+-------+-----------+----------- +# F E D C B A 9 8 | 7 6 | 5 4 3 | 2 1 0 +# -------------------------------+-------+-----------+----------- +# x x x x x x x x | SIZE | MODE | REG +# -------------------------------+-------+-----------+----------- +# XOR16di: 0 0 0 0 1 0 1 0 . 0 1 0 0 0 0 0 0 +# XOR16di-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+------------------------------- +# XOR16di-SAME: 0 0 0 0 1 0 1 0 . 0 1 0 0 0 0 1 1 +# XOR16di-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# -------------------------------+------------------------------- +# XOR32di-SAME: 0 0 0 0 1 0 1 0 . 1 0 0 0 0 0 0 0 +# XOR32di-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# XOR32di-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# -------------------------------+------------------------------- +# XOR32di-SAME: 0 0 0 0 1 0 1 0 . 1 0 0 0 0 0 0 0 +# XOR32di-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 1 +# XOR32di-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# -------------------------------+------------------------------- +# XOR32di-SAME: 0 0 0 0 1 0 1 0 . 1 0 0 0 0 1 1 1 +# XOR32di-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 1 1 1 +# XOR32di-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +name: MxBiArOp_RFRI +body: | + bb.0: + $wd0 = XOR16di $wd0, 0, implicit-def $ccr + $wd3 = XOR16di $wd3, -1, implicit-def $ccr + $d0 = XOR32di $d0, -1, implicit-def $ccr + $d0 = XOR32di $d0, 131071, implicit-def $ccr + $d7 = XOR32di $d7, 458752, implicit-def $ccr Index: llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxBiArOp_RFRI_xEA.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxBiArOp_RFRI_xEA.mir @@ -0,0 +1,45 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=ADD16di,ADD32ri + +#------------------------------------------------------------------------------ +# MxBiArOp_RFRI_xEA class used for binary arithmetic operations and operates on +# register and immediate data. It uses MxArithEncoding(yes for immediates) class +# and either MxOpModeNdEA or MxOpmodeNrEA opmode classes. +#------------------------------------------------------------------------------ + + +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# x x x x | REG | OPMODE | MODE | REG +# ADD16di: 1 1 0 1 0 0 0 0 . 0 1 1 1 1 1 0 0 +# ADD16di: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# ---------------+-----------+-----------+-----------+----------- +# ADD16di-SAME: 1 1 0 1 0 1 1 0 . 0 1 1 1 1 1 0 0 +# ADD16di-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# ---------------+-----------+-----------+-----------+----------- +# ADD32ri-SAME: 1 1 0 1 0 0 0 0 . 1 0 1 1 1 1 0 0 +# ADD32ri-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# ADD32ri-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# ---------------+-----------+-----------+-----------+----------- +# ADD32ri-SAME: 1 1 0 1 0 0 0 0 . 1 0 1 1 1 1 0 0 +# ADD32ri-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 1 +# ADD32ri-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# ---------------+-----------+-----------+-----------+----------- +# ADD32ri-SAME: 1 1 0 1 1 1 1 0 . 1 0 1 1 1 1 0 0 +# ADD32ri-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 1 1 1 +# ADD32ri-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# ---------------+-----------+-----------+-----------+----------- +# ADD32ri-SAME: 1 1 0 1 0 0 0 1 . 1 1 1 1 1 1 0 0 +# ADD32ri-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# ADD32ri-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +name: MxBiArOp_RFRI_xEA +body: | + bb.0: + $wd0 = ADD16di $wd0, 0, implicit-def $ccr + $wd3 = ADD16di $wd3, -1, implicit-def $ccr + $d0 = ADD32ri $d0, -1, implicit-def $ccr + $d0 = ADD32ri $d0, 131071, implicit-def $ccr + $d7 = ADD32ri $d7, 458752, implicit-def $ccr + $a0 = ADD32ri $a0, 0, implicit-def $ccr Index: llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxBiArOp_RFRM.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxBiArOp_RFRM.mir @@ -0,0 +1,121 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=ADD8dk,ADD32rk,ADD8dq,ADD32rq,\ +# RUN:ADD8df,ADD32rf,ADD8dp,ADD32rp,ADD8dj,ADD32rj + +#------------------------------------------------------------------------------ +# MxBiArOp_RFRM class used for binary arithmetic operations and operates on +# register and memory. It uses MxArithEncoding encoding class and either +# MxOpModeNdEA or MxOpModeNrEA opmode classes. +#------------------------------------------------------------------------------ + +--- # PCI +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# OPWORD x x x x | REG | OPMODE | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# ADD8dk: 1 1 0 1 0 0 0 0 . 0 0 1 1 1 0 1 1 +# ADD8dk-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# ADD8dk-SAME: 1 1 0 1 0 0 0 0 . 0 0 1 1 1 0 1 1 +# ADD8dk-SAME: 0 0 0 1 1 0 0 0 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# ADD32rk-SAME: 1 1 0 1 0 0 0 0 . 1 0 1 1 1 0 1 1 +# ADD32rk-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# ADD32rk-SAME: 1 1 0 1 0 0 1 1 . 1 1 1 1 1 0 1 1 +# ADD32rk-SAME: 1 0 1 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxBiArOp_RFRM_PCI +body: | + bb.0: + $bd0 = ADD8dk $bd0, 0, $d1, implicit-def $ccr + $bd0 = ADD8dk $bd0, -1, $d1, implicit-def $ccr + $d0 = ADD32rk $d0, 0, $d1, implicit-def $ccr + $a1 = ADD32rk $a1, 0, $a2, implicit-def $ccr + +... +--- # PCD +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# OPWORD x x x x | REG | OPMODE | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# ADD8dq-SAME: 1 1 0 1 0 0 0 0 . 0 0 1 1 1 0 1 0 +# ADD8dq-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# ADD32rq-SAME: 1 1 0 1 0 0 0 0 . 1 0 1 1 1 0 1 0 +# ADD32rq-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxBiArOp_RFRM_PCD +body: | + bb.0: + $bd0 = ADD8dq $bd0, 0, implicit-def $ccr + $d0 = ADD32rq $d0, -1, implicit-def $ccr + +... +--- # ARII +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# OPWORD x x x x | REG | OPMODE | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# ADD8df-SAME: 1 1 0 1 0 0 0 0 . 0 0 1 1 0 0 0 0 +# ADD8df-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# ADD8df-SAME: 1 1 0 1 0 0 0 0 . 0 0 1 1 0 0 0 0 +# ADD8df-SAME: 0 0 0 1 1 0 0 0 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# ADD32rf-SAME: 1 1 0 1 0 0 0 0 . 1 0 1 1 0 0 0 1 +# ADD32rf-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# ADD32rf-SAME: 1 1 0 1 0 0 1 1 . 1 1 1 1 0 0 1 0 +# ADD32rf-SAME: 1 0 1 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxBiArOp_RFRM_ARII +body: | + bb.0: + $bd0 = ADD8df $bd0, 0, $a0, $d1, implicit-def $ccr + $bd0 = ADD8df $bd0, -1, $a0, $d1, implicit-def $ccr + $d0 = ADD32rf $d0, 0, $a1, $d1, implicit-def $ccr + $a1 = ADD32rf $a1, 0, $a2, $a2, implicit-def $ccr + +... +--- # ARID +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# OPWORD x x x x | REG | OPMODE | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# ADD8dp-SAME: 1 1 0 1 0 0 0 0 . 0 0 1 0 1 0 0 0 +# ADD8dp-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# ADD32rp-SAME: 1 1 0 1 0 0 0 0 . 1 0 1 0 1 0 0 1 +# ADD32rp-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxBiArOp_RFRM_ARID +body: | + bb.0: + $bd0 = ADD8dp $bd0, 0, $a0, implicit-def $ccr + $d0 = ADD32rp $d0, -1, $a1, implicit-def $ccr + +... +--- # ARI +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# OPWORD x x x x | REG | OPMODE | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# ADD8dj-SAME: 1 1 0 1 0 0 0 0 . 0 0 0 1 0 0 0 0 +# --------------------------------------------------------------- +# ADD32rj-SAME: 1 1 0 1 0 1 1 1 . 1 1 0 1 0 0 0 1 +name: MxBiArOp_RFRM_ARI +body: | + bb.0: + $bd0 = ADD8dj $bd0, $a0, implicit-def $ccr + $a3 = ADD32rj $a3, $a1, implicit-def $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxBiArOp_RFRRF.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxBiArOp_RFRRF.mir @@ -0,0 +1,27 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=ADDX16dd,ADDX32dd + +#------------------------------------------------------------------------------ +# MxBiArOp_RFRRF class used for carry-aware binary arithmetic operations and +# operates on both data and address registers only. It uses MxArithXEncoding +# encoding class and either MxOpModeNdEA or MxOpModeNrEA opmode classes. +#------------------------------------------------------------------------------ + + +# --------------------------------------------------------------- +# F E D C | B A 9 | 8 | 7 6 | 5 4 | 3 | 2 1 0 +# ---------------+-----------+---+-------+-------+---+----------- +# x x x x | REG Rx | 1 | SIZE | 0 0 | M | REG Ry +# ---------------+-----------+---+-------+-------+---+----------- +# ADDX16dd: 1 1 0 1 0 0 0 1 . 0 1 0 0 0 0 0 1 +# ADDX16dd-SAME: 1 1 0 1 0 1 1 1 . 0 1 0 0 0 0 1 0 +# ADDX32dd-SAME: 1 1 0 1 0 0 0 1 . 1 0 0 0 0 0 0 1 +# ADDX32dd-SAME: 1 1 0 1 1 1 1 1 . 1 0 0 0 0 0 0 1 +name: MxBiArOp_RFRRF +body: | + bb.0: + $wd0 = ADDX16dd $wd0, $wd1, implicit $ccr, implicit-def $ccr + $wd3 = ADDX16dd $wd3, $wd2, implicit $ccr, implicit-def $ccr + $d0 = ADDX32dd $d0, $d1, implicit $ccr, implicit-def $ccr + $d7 = ADDX32dd $d7, $d1, implicit $ccr, implicit-def $ccr Index: llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxBiArOp_RFRR_EAd.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxBiArOp_RFRR_EAd.mir @@ -0,0 +1,26 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=XOR16dd,XOR32dd + +#------------------------------------------------------------------------------ +# MxBiArOp_RFRR_EAd class used for binary arithmetic operations and operates on +# both data and address registers only. It uses MxArithEncoding encoding class +# and MxOpModeEAd opmode class. This is a special case for XOR(EOR). +#------------------------------------------------------------------------------ + + +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# x x x x | REG | OPMODE | MODE | REG +# XOR16dd: 1 0 1 1 0 0 1 1 . 0 1 0 0 0 0 0 0 +# XOR16dd-SAME: 1 0 1 1 0 1 0 1 . 0 1 0 0 0 0 1 1 +# XOR32dd-SAME: 1 0 1 1 0 0 1 1 . 1 0 0 0 0 0 0 0 +# XOR32dd-SAME: 1 0 1 1 0 0 1 1 . 1 0 0 0 0 1 1 1 +name: MxBiArOp_RFRR_EAd +body: | + bb.0: + $wd0 = XOR16dd $wd0, $wd1, implicit-def $ccr + $wd3 = XOR16dd $wd3, $wd2, implicit-def $ccr + $d0 = XOR32dd $d0, $d1, implicit-def $ccr + $d7 = XOR32dd $d7, $d1, implicit-def $ccr Index: llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxBiArOp_RFRR_xEA.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxBiArOp_RFRR_xEA.mir @@ -0,0 +1,30 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=ADD16dd,ADD32rr + +#------------------------------------------------------------------------------ +# MxBiArOp_RFRR_xEA class used for binary arithmetic operations and operates on +# both data and address registers only. It uses MxArithEncoding encoding class +# and either MxOpModeNdEA or MxOpmodeNrEA opmode classes. +#------------------------------------------------------------------------------ + + +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# x x x x | REG | OPMODE | MODE | REG +# ADD16dd: 1 1 0 1 0 0 0 0 . 0 1 0 0 0 0 0 1 +# ADD16dd-SAME: 1 1 0 1 0 1 1 0 . 0 1 0 0 0 0 1 0 +# ADD32rr-SAME: 1 1 0 1 0 0 0 0 . 1 0 0 0 0 0 0 1 +# ADD32rr-SAME: 1 1 0 1 0 0 0 0 . 1 0 0 0 1 0 0 1 +# ADD32rr-SAME: 1 1 0 1 1 1 1 0 . 1 0 0 0 1 0 0 1 +# ADD32rr-SAME: 1 1 0 1 0 0 0 1 . 1 1 0 0 0 0 0 1 +name: MxBiArOp_RFRR_xEA +body: | + bb.0: + $wd0 = ADD16dd $wd0, $wd1, implicit-def $ccr + $wd3 = ADD16dd $wd3, $wd2, implicit-def $ccr + $d0 = ADD32rr $d0, $d1, implicit-def $ccr + $d0 = ADD32rr $d0, $a1, implicit-def $ccr + $d7 = ADD32rr $d7, $a1, implicit-def $ccr + $a0 = ADD32rr $a0, $d1, implicit-def $ccr Index: llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxCMP_BI.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxCMP_BI.mir @@ -0,0 +1,44 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=CMP8bi,CMP32bi + +#------------------------------------------------------------------------------ +# MxCMP_BI class used for compare operations and operates on absolute memory +# locations and immediate data. It uses MxArithImmEncoding encoding class. +# NOTE: CMP is calculated by subtracting LHS(Imm) from RHS(ABS) +#------------------------------------------------------------------------------ + + +# -------------------------------+-------+-----------+----------- +# F E D C B A 9 8 | 7 6 | 5 4 3 | 2 1 0 +# -------------------------------+-------+-----------+----------- +# OPWORD 0 0 0 0 1 1 0 0 | SIZE | MODE | REG +# -------------------------------+-------+-----------+----------- +# CMP8bi: 0 0 0 0 1 1 0 0 . 0 0 1 1 1 0 0 1 +# CMP8bi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# CMP8bi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# CMP8bi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# -------------------------------+-------+-----------+----------- +# CMP8bi-SAME: 0 0 0 0 1 1 0 0 . 0 0 1 1 1 0 0 1 +# CMP8bi-SAME: 0 0 0 0 0 0 0 0 . 1 1 1 1 1 1 1 1 +# CMP8bi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# CMP8bi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+-------+-----------+----------- +# CMP32bi-SAME: 0 0 0 0 1 1 0 0 . 1 0 1 1 1 0 0 1 +# CMP32bi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# CMP32bi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# CMP32bi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# CMP32bi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+-------+-----------+----------- +# CMP32bi-SAME: 0 0 0 0 1 1 0 0 . 1 0 1 1 1 0 0 1 +# CMP32bi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# CMP32bi-SAME: 0 0 0 0 0 0 0 0 . 0 0 1 0 1 0 1 0 +# CMP32bi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# CMP32bi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxCMP_BI +body: | + bb.0: + CMP8bi 0, -1, implicit-def $ccr + CMP8bi -1, 0, implicit-def $ccr + CMP32bi -1, 0, implicit-def $ccr + CMP32bi 42, -1, implicit-def $ccr Index: llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxCMP_MI.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxCMP_MI.mir @@ -0,0 +1,172 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=CMP8ki,CMP32ki,CMP8qi,CMP32qi,CMP8fi,\ +# RUN:CMP32fi,CMP8pi,CMP32pi,CMP8ji,CMP32ji + +#------------------------------------------------------------------------------ +# MxCMP_MI class used for compare operations and operates on memory data and +# immediate data. It uses MxArithImmEncoding encoding class. +# NOTE: CMP is calculated by subtracting LHS(Imm) from RHS(Mem) +#------------------------------------------------------------------------------ + + +--- # PCI +# -------------------------------+-------+-----------+----------- +# F E D C B A 9 8 | 7 6 | 5 4 3 | 2 1 0 +# -------------------------------+-------+-----------+----------- +# OPWORD 0 0 0 0 1 1 0 0 | SIZE | MODE | REG +# -------------------------------+-------+-----------+----------- +# CMP8ki: 0 0 0 0 1 1 0 0 . 0 0 1 1 1 0 1 1 +# CMP8ki-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# CMP8ki-SAME: 0 0 0 1 1 0 0 0 . 1 1 1 1 1 1 1 1 +# -------------------------------+-------+-----------+----------- +# CMP8ki-SAME: 0 0 0 0 1 1 0 0 . 0 0 1 1 1 0 1 1 +# CMP8ki-SAME: 0 0 0 0 0 0 0 0 . 1 1 1 1 1 1 1 1 +# CMP8ki-SAME: 0 0 0 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+-------+-----------+----------- +# CMP32ki-SAME: 0 0 0 0 1 1 0 0 . 1 0 1 1 1 0 1 1 +# CMP32ki-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# CMP32ki-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# CMP32ki-SAME: 0 1 1 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+-------+-----------+----------- +# CMP32ki-SAME: 0 0 0 0 1 1 0 0 . 1 0 1 1 1 0 1 1 +# CMP32ki-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# CMP32ki-SAME: 0 0 0 0 0 0 0 0 . 0 0 1 0 1 0 1 0 +# CMP32ki-SAME: 0 0 0 1 1 0 0 0 . 1 1 1 1 1 1 1 1 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxCMP_MI_PCI +body: | + bb.0: + CMP8ki 0, -1, $d1, implicit-def $ccr + CMP8ki -1, 0, $d0, implicit-def $ccr + CMP32ki -1, 0, $d7, implicit-def $ccr + CMP32ki 42, -1, $d1, implicit-def $ccr + +... +--- # PCD +# -------------------------------+-------+-----------+----------- +# F E D C B A 9 8 | 7 6 | 5 4 3 | 2 1 0 +# -------------------------------+-------+-----------+----------- +# OPWORD 0 0 0 0 1 1 0 0 | SIZE | MODE | REG +# -------------------------------+-------+-----------+----------- +# CMP8qi-SAME: 0 0 0 0 1 1 0 0 . 0 0 1 1 1 0 1 0 +# CMP8qi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# CMP8qi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+-------+-----------+----------- +# CMP8qi-SAME: 0 0 0 0 1 1 0 0 . 0 0 1 1 1 0 1 0 +# CMP8qi-SAME: 0 0 0 0 0 0 0 0 . 1 1 1 1 1 1 1 1 +# CMP8qi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# -------------------------------+-------+-----------+----------- +# CMP32qi-SAME: 0 0 0 0 1 1 0 0 . 1 0 1 1 1 0 1 0 +# CMP32qi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# CMP32qi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# CMP32qi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+-------+-----------+----------- +# CMP32qi-SAME: 0 0 0 0 1 1 0 0 . 1 0 1 1 1 0 1 0 +# CMP32qi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# CMP32qi-SAME: 0 0 0 0 0 0 0 0 . 0 0 1 0 1 0 1 0 +# CMP32qi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +name: MxCMP_MI_PCD +body: | + bb.0: + CMP8qi 0, 0, implicit-def $ccr + CMP8qi -1, -1, implicit-def $ccr + CMP32qi -1, 0, implicit-def $ccr + CMP32qi 42, 0, implicit-def $ccr + +... +--- # ARII +# -------------------------------+-------+-----------+----------- +# F E D C B A 9 8 | 7 6 | 5 4 3 | 2 1 0 +# -------------------------------+-------+-----------+----------- +# OPWORD 0 0 0 0 1 1 0 0 | SIZE | MODE | REG +# -------------------------------+-------+-----------+----------- +# CMP8fi-SAME: 0 0 0 0 1 1 0 0 . 0 0 1 1 0 0 0 1 +# CMP8fi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# CMP8fi-SAME: 1 0 0 0 1 0 0 0 . 1 1 1 1 1 1 1 1 +# -------------------------------+-------+-----------+----------- +# CMP8fi-SAME: 0 0 0 0 1 1 0 0 . 0 0 1 1 0 0 0 0 +# CMP8fi-SAME: 0 0 0 0 0 0 0 0 . 1 1 1 1 1 1 1 1 +# CMP8fi-SAME: 1 0 0 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+-------+-----------+----------- +# CMP32fi-SAME: 0 0 0 0 1 1 0 0 . 1 0 1 1 0 1 1 0 +# CMP32fi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# CMP32fi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# CMP32fi-SAME: 1 0 0 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+-------+-----------+----------- +# CMP32fi-SAME: 0 0 0 0 1 1 0 0 . 1 0 1 1 0 0 0 1 +# CMP32fi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# CMP32fi-SAME: 0 0 0 0 0 0 0 0 . 0 0 1 0 1 0 1 0 +# CMP32fi-SAME: 1 0 0 0 1 0 0 0 . 1 1 1 1 1 1 1 1 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxCMP_MI_ARII +body: | + bb.0: + CMP8fi 0, -1, $a1, $a0, implicit-def $ccr + CMP8fi -1, 0, $a0, $a0, implicit-def $ccr + CMP32fi -1, 0, $a6, $a0, implicit-def $ccr + CMP32fi 42, -1, $a1, $a0, implicit-def $ccr + +... +--- # ARID +# -------------------------------+-------+-----------+----------- +# F E D C B A 9 8 | 7 6 | 5 4 3 | 2 1 0 +# -------------------------------+-------+-----------+----------- +# OPWORD 0 0 0 0 1 1 0 0 | SIZE | MODE | REG +# -------------------------------+-------+-----------+----------- +# CMP8pi-SAME: 0 0 0 0 1 1 0 0 . 0 0 1 0 1 0 0 1 +# CMP8pi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# CMP8pi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# -------------------------------+-------+-----------+----------- +# CMP8pi-SAME: 0 0 0 0 1 1 0 0 . 0 0 1 0 1 0 0 0 +# CMP8pi-SAME: 0 0 0 0 0 0 0 0 . 1 1 1 1 1 1 1 1 +# CMP8pi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+-------+-----------+----------- +# CMP32pi-SAME: 0 0 0 0 1 1 0 0 . 1 0 1 0 1 1 1 0 +# CMP32pi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# CMP32pi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# CMP32pi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+-------+-----------+----------- +# CMP32pi-SAME: 0 0 0 0 1 1 0 0 . 1 0 1 0 1 0 0 1 +# CMP32pi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# CMP32pi-SAME: 0 0 0 0 0 0 0 0 . 0 0 1 0 1 0 1 0 +# CMP32pi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxCMP_MI_ARID +body: | + bb.0: + CMP8pi 0, -1, $a1, implicit-def $ccr + CMP8pi -1, 0, $a0, implicit-def $ccr + CMP32pi -1, 0, $a6, implicit-def $ccr + CMP32pi 42, -1, $a1, implicit-def $ccr + +... +--- # ARI +# -------------------------------+-------+-----------+----------- +# F E D C B A 9 8 | 7 6 | 5 4 3 | 2 1 0 +# -------------------------------+-------+-----------+----------- +# OPWORD 0 0 0 0 1 1 0 0 | SIZE | MODE | REG +# -------------------------------+-------+-----------+----------- +# CMP8ji-SAME: 0 0 0 0 1 1 0 0 . 0 0 0 1 0 0 0 1 +# CMP8ji-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+-------+-----------+----------- +# CMP8ji-SAME: 0 0 0 0 1 1 0 0 . 0 0 0 1 0 0 0 0 +# CMP8ji-SAME: 0 0 0 0 0 0 0 0 . 1 1 1 1 1 1 1 1 +# -------------------------------+-------+-----------+----------- +# CMP32ji-SAME: 0 0 0 0 1 1 0 0 . 1 0 0 1 0 1 1 0 +# CMP32ji-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# -------------------------------+-------+-----------+----------- +# CMP32ji-SAME: 0 0 0 0 1 1 0 0 . 1 0 0 1 0 0 0 1 +# CMP32ji-SAME: 0 0 0 0 0 0 0 0 . 0 0 1 0 1 0 1 0 +name: MxCMP_MI_ARI +body: | + bb.0: + CMP8ji 0, $a1, implicit-def $ccr + CMP8ji -1, $a0, implicit-def $ccr + CMP32ji -1, $a6, implicit-def $ccr + CMP32ji 42, $a1, implicit-def $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxCMP_RI.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxCMP_RI.mir @@ -0,0 +1,36 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=CMP8di,CMP32di + +#------------------------------------------------------------------------------ +# MxCMP_RI class used for compare operations and operates on data registers and +# immediate data. It uses MxArithImmEncoding encoding class. +# NOTE: CMP is calculated by subtracting LHS(Imm) from RHS(Dn) +#------------------------------------------------------------------------------ + + +# -------------------------------+-------+-----------+----------- +# F E D C B A 9 8 | 7 6 | 5 4 3 | 2 1 0 +# -------------------------------+-------+-----------+----------- +# 0 0 0 0 1 1 0 0 | SIZE | MODE | REG +# -------------------------------+-------+-----------+----------- +# CMP8di: 0 0 0 0 1 1 0 0 . 0 0 0 0 0 0 0 1 +# CMP8di-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+-------+-----------+----------- +# CMP8di-SAME: 0 0 0 0 1 1 0 0 . 0 0 0 0 0 0 0 0 +# CMP8di-SAME: 0 0 0 0 0 0 0 0 . 1 1 1 1 1 1 1 1 +# -------------------------------+-------+-----------+----------- +# CMP32di-SAME: 0 0 0 0 1 1 0 0 . 1 0 0 0 0 1 1 1 +# CMP32di-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# CMP32di-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 1 1 0 1 +# -------------------------------+-------+-----------+----------- +# CMP32di-SAME: 0 0 0 0 1 1 0 0 . 1 0 0 0 0 0 0 1 +# CMP32di-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# CMP32di-SAME: 0 0 0 0 0 0 0 0 . 0 0 1 0 1 0 1 0 +name: MxCMP_RI +body: | + bb.0: + CMP8di 0, $bd1, implicit-def $ccr + CMP8di -1, $bd0, implicit-def $ccr + CMP32di 13, $d7, implicit-def $ccr + CMP32di 42, $d1, implicit-def $ccr Index: llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxCMP_RM.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxCMP_RM.mir @@ -0,0 +1,123 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=CMP8kf,CMP32kf,CMP8qp,CMP32qp,CMP8df,CMP32df,\ +# RUN:CMP8dp,CMP32dp,CMP8dj,CMP32dj + +#------------------------------------------------------------------------------ +# MxCMP_RM class used for compare operations and operates on memory data and +# register. It uses MxArithEncoding encoding class. +# NOTE: CMP is calculated by subtracting LHS(Mem) from RHS(Reg) +#------------------------------------------------------------------------------ + +--- # PCI +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# OPWORD x x x x | REG | OPMODE | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# CMP8dk: 1 0 1 1 0 0 0 0 . 0 0 1 1 1 0 1 1 +# CMP8dk-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# CMP8dk-SAME: 1 0 1 1 0 0 0 0 . 0 0 1 1 1 0 1 1 +# CMP8dk-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# CMP32dk-SAME: 1 0 1 1 0 0 0 0 . 1 0 1 1 1 0 1 1 +# CMP32dk-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +# +# NOTE Immediates for pc-rel instructions use relocations and addendum is encoded +# inside the relocation record thus there are 0s instead of the value. +name: MxBiArOp_RFRM_PCI +body: | + bb.0: + CMP8dk $bd0, 0, $d1, implicit-def $ccr + CMP8dk $bd0, -1, $d1, implicit-def $ccr + CMP32dk $d0, 0, $d1, implicit-def $ccr + +... +--- # PCD +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# OPWORD x x x x | REG | OPMODE | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# CMP8dq-SAME: 1 0 1 1 0 0 0 0 . 0 0 1 1 1 0 1 0 +# CMP8dq-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# CMP32dq-SAME: 1 0 1 1 0 0 0 0 . 1 0 1 1 1 0 1 0 +# CMP32dq-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# +# NOTE Immediates for pc-rel instructions use relocations and addendum is encoded +# inside the relocation record thus there are 0s instead of the value. +name: MxBiArOp_RFRM_PCD +body: | + bb.0: + CMP8dq $bd0, 0, implicit-def $ccr + CMP32dq $d0, -1, implicit-def $ccr + +... +--- # ARII +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# OPWORD x x x x | REG | OPMODE | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# CMP8df: 1 0 1 1 0 0 0 0 . 0 0 1 1 0 0 0 0 +# CMP8df-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# CMP8df-SAME: 1 0 1 1 0 0 0 0 . 0 0 1 1 0 0 0 0 +# CMP8df-SAME: 0 0 0 1 1 0 0 0 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# CMP32df-SAME: 1 0 1 1 0 0 0 0 . 1 0 1 1 0 0 0 1 +# CMP32df-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# CMP32df-SAME: 1 0 1 1 0 0 1 0 . 1 0 1 1 0 0 1 0 +# CMP32df-SAME: 1 0 1 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxCMP_RM_ARII +body: | + bb.0: + CMP8df $bd0, 0, $a0, $d1, implicit-def $ccr + CMP8df $bd0, -1, $a0, $d1, implicit-def $ccr + CMP32df $d0, 0, $a1, $d1, implicit-def $ccr + CMP32df $d1, 0, $a2, $a2, implicit-def $ccr + +... +--- # ARID +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# OPWORD x x x x | REG | OPMODE | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# CMP8dp-SAME: 1 0 1 1 0 0 0 0 . 0 0 1 0 1 0 0 0 +# CMP8dp-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# CMP32dp-SAME: 1 0 1 1 0 0 0 0 . 1 0 1 0 1 0 0 1 +# CMP32dp-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxCMP_RM_ARID +body: | + bb.0: + CMP8dp $bd0, 0, $a0, implicit-def $ccr + CMP32dp $d0, -1, $a1, implicit-def $ccr + +... +--- # ARI +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# OPWORD x x x x | REG | OPMODE | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# CMP8dj-SAME: 1 0 1 1 0 0 0 0 . 0 0 0 1 0 0 0 0 +# --------------------------------------------------------------- +# CMP32dj-SAME: 1 0 1 1 0 1 1 0 . 1 0 0 1 0 0 0 1 +name: MxCMP_RM_ARI +body: | + bb.0: + CMP8dj $bd0, $a0, implicit-def $ccr + CMP32dj $d3, $a1, implicit-def $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxCMP_RR.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxCMP_RR.mir @@ -0,0 +1,27 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=CMP8dd,CMP32dd + +#------------------------------------------------------------------------------ +# MxCMP_RR class used for compare operations and operates on data registers only. +# It uses MxArithEncoding encoding class and MxOpModeNdEA opmode class. +# NOTE: CMP is calculated by subtracting LHS(EA) from RHS(Dn) +#------------------------------------------------------------------------------ + + +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# x x x x | REG | OPMODE | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# CMP8dd: 1 0 1 1 0 0 1 0 . 0 0 0 0 0 0 0 0 +# CMP8dd-SAME: 1 0 1 1 0 1 0 0 . 0 0 0 0 0 0 1 1 +# CMP32dd-SAME: 1 0 1 1 0 0 1 0 . 1 0 0 0 0 0 0 0 +# CMP32dd-SAME: 1 0 1 1 0 0 1 0 . 1 0 0 0 0 1 1 1 +name: MxCMP_RR +body: | + bb.0: + CMP8dd $bd0, $bd1, implicit-def $ccr + CMP8dd $bd3, $bd2, implicit-def $ccr + CMP32dd $d0, $d1, implicit-def $ccr + CMP32dd $d7, $d1, implicit-def $ccr Index: llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxDiMu.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxDiMu.mir @@ -0,0 +1,46 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=SDIVd32d16,UDIVd32d16,SMULd32d16,UMULd32d16,\ +# RUN:SDIVd32i16,UDIVd32i16,SMULd32i16,UMULd32i16 + +#------------------------------------------------------------------------------ +# MxDiMu is used for sign/unsigned division/multiply of word size data +#------------------------------------------------------------------------------ + + +# --------------------------------------------------------------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# --------------------------------------------------------------- +# x x x x | REG | OPMODE | MODE | REG +# --------------------------------------------------------------- +# SDIVd32d16: 1 0 0 0 0 0 0 1 . 1 1 0 0 0 0 0 1 +# --------------------------------------------------------------- +# UDIVd32d16-SAME: 1 0 0 0 0 0 0 0 . 1 1 0 0 0 0 0 1 +# --------------------------------------------------------------- +# SDIVd32i16-SAME: 1 0 0 0 0 0 0 1 . 1 1 1 1 1 1 0 0 +# SDIVd32i16-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# UDIVd32i16-SAME: 1 0 0 0 0 0 0 0 . 1 1 1 1 1 1 0 0 +# UDIVd32i16-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# SMULd32d16-SAME: 1 1 0 0 0 0 0 1 . 1 1 0 0 0 0 0 1 +# --------------------------------------------------------------- +# UMULd32d16-SAME: 1 1 0 0 0 0 0 0 . 1 1 0 0 0 0 0 1 +# --------------------------------------------------------------- +# SMULd32i16-SAME: 1 1 0 0 0 0 0 1 . 1 1 1 1 1 1 0 0 +# SMULd32i16-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# UMULd32i16-SAME: 1 1 0 0 0 0 0 0 . 1 1 1 1 1 1 0 0 +# UMULd32i16-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +name: MxDiMu +body: | + bb.0: + $d0 = SDIVd32d16 $d0, $wd1, implicit-def $ccr + $d0 = UDIVd32d16 $d0, $wd1, implicit-def $ccr + $d0 = SDIVd32i16 $d0, 0, implicit-def $ccr + $d0 = UDIVd32i16 $d0, -1, implicit-def $ccr + $d0 = SMULd32d16 $d0, $wd1, implicit-def $ccr + $d0 = UMULd32d16 $d0, $wd1, implicit-def $ccr + $d0 = SMULd32i16 $d0, 0, implicit-def $ccr + $d0 = UMULd32i16 $d0, -1, implicit-def $ccr Index: llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxExt.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxExt.mir @@ -0,0 +1,25 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=EXT16,EXT32 + +#------------------------------------------------------------------------------ +# MxExt sign extends data inside a register +#------------------------------------------------------------------------------ + + +# --------------------------------------------------------------- +# F E D C B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# --------------------------------------------------------------- +# 0 1 0 0 1 0 0 | OPMODE | 0 0 0 | REG +# --------------------------------------------------------------- +# EXT16: 0 1 0 0 1 0 0 0 . 1 0 0 0 0 0 0 0 +# EXT16-SAME: 0 1 0 0 1 0 0 0 . 1 0 0 0 0 0 1 1 +# EXT32-SAME: 0 1 0 0 1 0 0 0 . 1 1 0 0 0 0 0 0 +# EXT32-SAME: 0 1 0 0 1 0 0 0 . 1 1 0 0 0 1 1 1 +name: MxEXT +body: | + bb.0: + $wd0 = EXT16 $wd0, implicit-def $ccr + $wd3 = EXT16 $wd3, implicit-def $ccr + $d0 = EXT32 $d0, implicit-def $ccr + $d7 = EXT32 $d7, implicit-def $ccr Index: llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxNEG.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Arith/Classes/MxNEG.mir @@ -0,0 +1,39 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=NEG8d,NEG32d,NEGX8d,NEGX32d + +#------------------------------------------------------------------------------ +# MxNEG is used to negate a number +#------------------------------------------------------------------------------ + + +--- # NEG +# ---------------+---------------+-------+-----------+----------- +# F E D C | B A 9 8 | 7 6 | 5 4 3 | 2 1 0 +# ---------------+---------------+-------+----------------------- +# 0 1 0 0 | x x x x | SIZE | MODE | REG +# ---------------+---------------+-------+-----------+----------- +# NEG8d: 0 1 0 0 0 1 0 0 . 0 0 0 0 0 0 0 0 +# NEG32d-SAME: 0 1 0 0 0 1 0 0 . 1 0 0 0 0 0 0 0 +name: MxNEG +body: | + bb.0: + $bd0 = NEG8d $bd0, implicit-def $ccr + $d0 = NEG32d $d0, implicit-def $ccr + +... +--- # NEGX +# ---------------+---------------+-------+-----------+----------- +# F E D C | B A 9 8 | 7 6 | 5 4 3 | 2 1 0 +# ---------------+---------------+-------+----------------------- +# 0 1 0 0 | x x x x | SIZE | MODE | REG +# ---------------+---------------+-------+-----------+----------- +# NEGX8d-SAME: 0 1 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# NEGX32d-SAME: 0 1 0 0 0 0 0 0 . 1 0 0 0 0 0 0 0 +name: MxNEGX +body: | + bb.0: + $bd0 = NEGX8d $bd0, implicit $ccr, implicit-def $ccr + $d0 = NEGX32d $d0, implicit $ccr, implicit-def $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Bits/Classes/MxBTST_MI.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Bits/Classes/MxBTST_MI.mir @@ -0,0 +1,115 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=BTST8ki,BTST8qi,BTST8fi,BTST8pi,BTST8ji + +#------------------------------------------------------------------------------ +# MxBTST_MI class used for BTST operations, the source is locate in memory and +# the bit number is immediate value. This instruciton can only operate on 8 bits. +#------------------------------------------------------------------------------ + + +--- # PCI +# ---------------------------------------+-----------+----------- +# F E D C B A 9 8 7 6 | 5 4 3 | 2 1 0 +# ---------------------------------------+-----------+----------- +# 0 0 0 0 1 0 0 0 0 0 | MODE | REG +# ---------------------------------------+-----------+----------- +# BTST8ki: 0 0 0 0 1 0 0 0 . 0 0 1 1 1 0 1 1 +# BTST8ki-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# BTST8ki-SAME: 0 0 0 1 1 0 0 0 . 1 1 1 1 1 1 1 1 +# -------------------------------+-------+-----------+----------- +# BTST8ki-SAME: 0 0 0 0 1 0 0 0 . 0 0 1 1 1 0 1 1 +# BTST8ki-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 1 +# BTST8ki-SAME: 0 0 0 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxBTST_MI_PCI +body: | + bb.0: + BTST8ki -1, $d1, 0, implicit-def $ccr + BTST8ki 0, $d0, 1, implicit-def $ccr + +... +--- # PCD +# ---------------------------------------+-----------+----------- +# F E D C B A 9 8 7 6 | 5 4 3 | 2 1 0 +# ---------------------------------------+-----------+----------- +# 0 0 0 0 1 0 0 0 0 0 | MODE | REG +# ---------------------------------------+-----------+----------- +# BTST8qi-SAME: 0 0 0 0 1 0 0 0 . 0 0 1 1 1 0 1 0 +# BTST8qi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# BTST8qi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+-------+-----------+----------- +# BTST8qi-SAME: 0 0 0 0 1 0 0 0 . 0 0 1 1 1 0 1 0 +# BTST8qi-SAME: 0 0 0 0 0 0 0 0 . 1 1 1 1 1 1 1 1 +# BTST8qi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# -------------------------------+-------+-----------+----------- +name: MxBTST_MI_PCD +body: | + bb.0: + BTST8qi 0, 0, implicit-def $ccr + BTST8qi -1, -1, implicit-def $ccr + +... +--- # ARII +# ---------------------------------------+-----------+----------- +# F E D C B A 9 8 7 6 | 5 4 3 | 2 1 0 +# ---------------------------------------+-----------+----------- +# 0 0 0 0 1 0 0 0 0 0 | MODE | REG +# ---------------------------------------+-----------+----------- +# BTST8fi-SAME: 0 0 0 0 1 0 0 0 . 0 0 1 1 0 0 0 1 +# BTST8fi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# BTST8fi-SAME: 1 0 0 0 1 0 0 0 . 1 1 1 1 1 1 1 1 +# -------------------------------+-------+-----------+----------- +# BTST8fi-SAME: 0 0 0 0 1 0 0 0 . 0 0 1 1 0 0 0 0 +# BTST8fi-SAME: 0 0 0 0 0 0 0 0 . 1 1 1 1 1 1 1 1 +# BTST8fi-SAME: 1 0 0 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxBTST_MI_ARII +body: | + bb.0: + BTST8fi -1, $a1, $a0, 0, implicit-def $ccr + BTST8fi 0, $a0, $a0, -1, implicit-def $ccr + +... +--- # ARID +# ---------------------------------------+-----------+----------- +# F E D C B A 9 8 7 6 | 5 4 3 | 2 1 0 +# ---------------------------------------+-----------+----------- +# 0 0 0 0 1 0 0 0 0 0 | MODE | REG +# ---------------------------------------+-----------+----------- +# BTST8pi-SAME: 0 0 0 0 1 0 0 0 . 0 0 1 0 1 0 0 1 +# BTST8pi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# BTST8pi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# -------------------------------+-------+-----------+----------- +# BTST8pi-SAME: 0 0 0 0 1 0 0 0 . 0 0 1 0 1 0 0 0 +# BTST8pi-SAME: 0 0 0 0 0 0 0 0 . 1 1 1 1 1 1 1 1 +# BTST8pi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +name: MxBTST_MI_ARID +body: | + bb.0: + BTST8pi -1, $a1, 0, implicit-def $ccr + BTST8pi 0, $a0, -1, implicit-def $ccr + +... +--- # ARI +# ---------------------------------------+-----------+----------- +# F E D C B A 9 8 7 6 | 5 4 3 | 2 1 0 +# ---------------------------------------+-----------+----------- +# 0 0 0 0 1 0 0 0 0 0 | MODE | REG +# ---------------------------------------+-----------+----------- +# BTST8ji-SAME: 0 0 0 0 1 0 0 0 . 0 0 0 1 0 0 0 1 +# BTST8ji-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+-------+-----------+----------- +# BTST8ji-SAME: 0 0 0 0 1 0 0 0 . 0 0 0 1 0 0 0 0 +# BTST8ji-SAME: 0 0 0 0 0 0 0 0 . 1 1 1 1 1 1 1 1 +name: MxBTST_MI_ARI +body: | + bb.0: + BTST8ji $a1, 0, implicit-def $ccr + BTST8ji $a0, -1, implicit-def $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Bits/Classes/MxBTST_MR.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Bits/Classes/MxBTST_MR.mir @@ -0,0 +1,104 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=BTST8kd,BTST8qd,BTST8fd,BTST8pd,BTST8jd + +#------------------------------------------------------------------------------ +# MxBTST_MR class used for BTST operations, the source is locate in memory and +# the bit number is in register. This instruciton can only operate on 8 bits. +#------------------------------------------------------------------------------ + + +--- # PCI +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# 0 0 0 0 | REG | 1 0 0 | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# BTST8kd: 0 0 0 0 0 0 0 1 . 0 0 1 1 1 0 1 1 +# BTST8kd-SAME: 0 0 0 1 1 0 0 0 . 1 1 1 1 1 1 1 1 +# -------------------------------+-------+-----------+----------- +# BTST8kd-SAME: 0 0 0 0 0 0 1 1 . 0 0 1 1 1 0 1 1 +# BTST8kd-SAME: 0 0 0 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxBTST_MR_PCI +body: | + bb.0: + BTST8kd -1, $d1, $bd0, implicit-def $ccr + BTST8kd 0, $d0, $bd1, implicit-def $ccr + +... +--- # PCD +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# 0 0 0 0 | REG | 1 0 0 | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# BTST8qd-SAME: 0 0 0 0 0 0 0 1 . 0 0 1 1 1 0 1 0 +# BTST8qd-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+-------+-----------+----------- +# BTST8qd-SAME: 0 0 0 0 0 0 1 1 . 0 0 1 1 1 0 1 0 +# BTST8qd-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# -------------------------------+-------+-----------+----------- +name: MxBTST_MR_PCD +body: | + bb.0: + BTST8qd 0, $bd0, implicit-def $ccr + BTST8qd -1, $bd1, implicit-def $ccr + +... +--- # ARII +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# 0 0 0 0 | REG | 1 0 0 | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# BTST8fd-SAME: 0 0 0 0 0 0 0 1 . 0 0 1 1 0 0 0 1 +# BTST8fd-SAME: 1 0 0 0 1 0 0 0 . 1 1 1 1 1 1 1 1 +# -------------------------------+-------+-----------+----------- +# BTST8fd-SAME: 0 0 0 0 0 0 1 1 . 0 0 1 1 0 0 0 0 +# BTST8fd-SAME: 1 0 0 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxBTST_MR_ARII +body: | + bb.0: + BTST8fd -1, $a1, $a0, $bd0, implicit-def $ccr + BTST8fd 0, $a0, $a0, $bd1, implicit-def $ccr + +... +--- # ARID +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# 0 0 0 0 | REG | 1 0 0 | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# BTST8pd-SAME: 0 0 0 0 0 0 0 1 . 0 0 1 0 1 0 0 1 +# BTST8pd-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# -------------------------------+-------+-----------+----------- +# BTST8pd-SAME: 0 0 0 0 0 0 1 1 . 0 0 1 0 1 0 0 0 +# BTST8pd-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +name: MxBTST_MR_ARID +body: | + bb.0: + BTST8pd -1, $a1, $bd0, implicit-def $ccr + BTST8pd 0, $a0, $bd1, implicit-def $ccr + +... +--- # ARI +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# 0 0 0 0 | REG | 1 0 0 | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# BTST8jd-SAME: 0 0 0 0 0 0 0 1 . 0 0 0 1 0 0 0 1 +# BTST8jd-SAME: 0 0 0 0 0 0 1 1 . 0 0 0 1 0 0 0 0 +name: MxBTST_MR_ARI +body: | + bb.0: + BTST8jd $a1, $bd0, implicit-def $ccr + BTST8jd $a0, $bd1, implicit-def $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Bits/Classes/MxBTST_RI.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Bits/Classes/MxBTST_RI.mir @@ -0,0 +1,25 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=BTST32di + +#------------------------------------------------------------------------------ +# MxBTST_RI class used for BTST operations, the source is in a data register and +# the bit number is a immediate. This instruction can only operate on 32 bits +#------------------------------------------------------------------------------ + + +# ---------------------------------------+-----------+----------- +# F E D C B A 9 8 7 6 | 5 4 3 | 2 1 0 +# ---------------------------------------------------+----------- +# 0 0 0 0 1 0 0 0 0 0 | MODE | REG +# ---------------------------------------+-----------+----------- +# BTST32di: 0 0 0 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# BTST32di: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 1 +# --------------------------------------------------------------- +# BTST32di: 0 0 0 0 1 0 0 0 . 0 0 0 0 0 0 1 1 +# BTST32di: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +name: MxBTST_RI +body: | + bb.0: + BTST32di $d0, 1, implicit-def $ccr + BTST32di $d3, 0, implicit-def $ccr Index: llvm/test/CodeGen/M680x0/OBJ/Bits/Classes/MxBTST_RR.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Bits/Classes/MxBTST_RR.mir @@ -0,0 +1,22 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=BTST32dd + +#------------------------------------------------------------------------------ +# MxBTST_RR class used for BTST operations, where both the source and bit number +# are in registers. This instruction can only operate on 32 bits +#------------------------------------------------------------------------------ + + +# ---------------+-----------+-----------+-----------+----------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# ---------------+-----------+-----------+-----------+----------- +# 0 0 0 0 | REG | 1 0 0 | MODE | REG +# ---------------+-----------+-----------+-----------+----------- +# BTST32dd: 0 0 0 0 0 0 1 1 . 0 0 0 0 0 0 0 0 +# BTST32dd: 0 0 0 0 0 0 0 1 . 0 0 0 0 0 0 1 1 +name: MxBTST_RR +body: | + bb.0: + BTST32dd $d0, $d1, implicit-def $ccr + BTST32dd $d3, $d0, implicit-def $ccr Index: llvm/test/CodeGen/M680x0/OBJ/Control/Classes/MxBRA.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Control/Classes/MxBRA.mir @@ -0,0 +1,49 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=BRA8,BRA16 + +#------------------------------------------------------------------------------ +# MxBRA unconditionally branches somewhere +#------------------------------------------------------------------------------ + +--- # MxBRA8 +# -------------------------------+------------------------------- +# F E D C B A 9 8 | 7 6 5 4 3 2 1 0 +# -------------------------------+------------------------------- +# 0 1 1 0 0 0 0 0 | 8-BIT DISPLACEMENT +# -------------------------------+------------------------------- +# BRA8: 0 1 1 0 0 0 0 0 . 0 0 0 0 0 0 0 1 +# BRA8-SAME: 0 1 1 0 0 0 0 0 . 0 0 1 0 1 0 1 0 +# +# NOTE MxBRA branches cannot encode 0 displacement, 0 in displacement instructs +# to use additional word. Also it cannot encode -1 since all 1s instruct to use +# two additional words to encode 32bit offset(since M68020). +name: MxBRA8 +body: | + bb.0: + BRA8 1, implicit $ccr + BRA8 42, implicit $ccr + +... +--- # MxBRA16 +# -------------------------------+------------------------------- +# F E D C B A 9 8 | 7 6 5 4 3 2 1 0 +# -------------------------------+------------------------------- +# 0 1 1 0 0 0 0 0 | 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# BRA16-SAME: 0 1 1 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# BRA16-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# -------------------------------+------------------------------- +# BRA16-SAME: 0 1 1 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# BRA16-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# BRA16-SAME: 0 1 1 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# BRA16-SAME: 0 0 0 0 0 0 0 0 . 0 0 1 0 1 0 1 0 +name: MxBRA16 +body: | + bb.0: + BRA16 0, implicit $ccr + BRA16 -1, implicit $ccr + BRA16 42, implicit $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Control/Classes/MxBcc.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Control/Classes/MxBcc.mir @@ -0,0 +1,119 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=Bcc8,Bls8,Blt8,Beq8,Bmi8,Bne8,Bge8,Bcs8,\ +# RUN:Bpl8,Bgt8,Bhi8,Bvc8,Ble8,Bvs8,Bcc16,Bls16,Blt16,Beq16,Bmi16,Bne16,Bge16,\ +# RUN:Bcs16,Bpl16,Bgt16,Bhi16,Bvc16,Ble16,Bvs16 + +#------------------------------------------------------------------------------ +# MxScc branches if the condition is True +#------------------------------------------------------------------------------ + +--- # MxBcc8 +# ---------------+---------------+------------------------------- +# F E D C | B A 9 8 | 7 6 5 4 3 2 1 0 +# ---------------+---------------+------------------------------- +# 0 1 1 0 | CONDITION | 8-BIT DISPLACEMENT +# ---------------+---------------+------------------------------- +# Bhi8: 0 1 1 0 0 0 1 0 . 0 0 0 0 0 0 0 1 +# Bls8-SAME: 0 1 1 0 0 0 1 1 . 0 0 1 0 1 0 1 0 +# Bcc8-SAME: 0 1 1 0 0 1 0 0 . 0 0 0 0 0 0 0 1 +# Bcs8-SAME: 0 1 1 0 0 1 0 1 . 0 0 0 0 0 0 0 1 +# Bne8-SAME: 0 1 1 0 0 1 1 0 . 0 0 0 0 0 0 0 1 +# Beq8-SAME: 0 1 1 0 0 1 1 1 . 0 0 0 0 0 0 0 1 +# Bvc8-SAME: 0 1 1 0 1 0 0 0 . 0 0 0 0 0 0 0 1 +# Bvs8-SAME: 0 1 1 0 1 0 0 1 . 0 0 0 0 0 0 0 1 +# Bpl8-SAME: 0 1 1 0 1 0 1 0 . 0 0 0 0 0 0 0 1 +# Bmi8-SAME: 0 1 1 0 1 0 1 1 . 0 0 0 0 0 0 0 1 +# Bge8-SAME: 0 1 1 0 1 1 0 0 . 0 0 0 0 0 0 0 1 +# Blt8-SAME: 0 1 1 0 1 1 0 1 . 0 0 0 0 0 0 0 1 +# Bgt8-SAME: 0 1 1 0 1 1 1 0 . 0 0 0 0 0 0 0 1 +# Ble8-SAME: 0 1 1 0 1 1 1 1 . 0 0 0 0 0 0 0 1 +# +# NOTE MxBcc8 branches cannot encode 0 displacement, 0 in displacement instructs +# to use additional word. Also it cannot encode -1 since all 1s instruct to use +# two additional words to encode 32bit offset(since M68020). +name: MxBcc8 +body: | + bb.0: + Bhi8 1, implicit $ccr + Bls8 42, implicit $ccr + Bcc8 1, implicit $ccr + Bcs8 1, implicit $ccr + Bne8 1, implicit $ccr + Beq8 1, implicit $ccr + Bvc8 1, implicit $ccr + Bvs8 1, implicit $ccr + Bpl8 1, implicit $ccr + Bmi8 1, implicit $ccr + Bge8 1, implicit $ccr + Blt8 1, implicit $ccr + Bgt8 1, implicit $ccr + Ble8 1, implicit $ccr + +... +--- # MxBcc16 +# ---------------+---------------+------------------------------- +# F E D C | B A 9 8 | 7 6 5 4 3 2 1 0 +# ---------------+---------------+------------------------------- +# 0 1 1 0 | CONDITION | 0 0 0 0 0 0 0 0 +# ---------------+---------------+------------------------------- +# Bhi16-SAME: 0 1 1 0 0 0 1 0 . 0 0 0 0 0 0 0 0 +# Bhi16-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# Bls16-SAME: 0 1 1 0 0 0 1 1 . 0 0 0 0 0 0 0 0 +# Bls16-SAME: 0 0 0 0 0 0 0 0 . 0 0 1 0 1 0 1 0 +# --------------------------------------------------------------- +# Bcc16-SAME: 0 1 1 0 0 1 0 0 . 0 0 0 0 0 0 0 0 +# Bcc16-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# Bcs16-SAME: 0 1 1 0 0 1 0 1 . 0 0 0 0 0 0 0 0 +# Bcs16-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# Bne16-SAME: 0 1 1 0 0 1 1 0 . 0 0 0 0 0 0 0 0 +# Bne16-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# Beq16-SAME: 0 1 1 0 0 1 1 1 . 0 0 0 0 0 0 0 0 +# Bge16-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# Bvc16-SAME: 0 1 1 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# Bvc16-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# Bvs16-SAME: 0 1 1 0 1 0 0 1 . 0 0 0 0 0 0 0 0 +# Bvs16-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# Bpl16-SAME: 0 1 1 0 1 0 1 0 . 0 0 0 0 0 0 0 0 +# Bpl16-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# Bmi16-SAME: 0 1 1 0 1 0 1 1 . 0 0 0 0 0 0 0 0 +# Bmi16-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# Bge16-SAME: 0 1 1 0 1 1 0 0 . 0 0 0 0 0 0 0 0 +# Ble16-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# Blt16-SAME: 0 1 1 0 1 1 0 1 . 0 0 0 0 0 0 0 0 +# Blt16-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# Bgt16-SAME: 0 1 1 0 1 1 1 0 . 0 0 0 0 0 0 0 0 +# Bgt16-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# Ble16-SAME: 0 1 1 0 1 1 1 1 . 0 0 0 0 0 0 0 0 +# Ble16-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +name: MxBcc16 +body: | + bb.0: + Bhi16 -1, implicit $ccr + Bls16 42, implicit $ccr + Bcc16 0, implicit $ccr + Bcs16 0, implicit $ccr + Bne16 0, implicit $ccr + Beq16 0, implicit $ccr + Bvc16 0, implicit $ccr + Bvs16 0, implicit $ccr + Bpl16 0, implicit $ccr + Bmi16 0, implicit $ccr + Bge16 0, implicit $ccr + Blt16 0, implicit $ccr + Bgt16 0, implicit $ccr + Ble16 0, implicit $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Control/Classes/MxCALL.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Control/Classes/MxCALL.mir @@ -0,0 +1,88 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=CALLk,CALLq,CALLb,CALLj + +#------------------------------------------------------------------------------ +# MxCALL pushes address of the next instruction and jumps to the location +#------------------------------------------------------------------------------ + +--- # MxCALL_PCI +# ---------------------------------------+-----------+----------- +# F E D C B A 9 8 7 6 | 5 4 3 | 2 1 0 +# ---------------------------------------+-----------+----------- +# 0 1 0 0 1 1 1 0 1 0 | MODE | REG +# ---------------------------------------+-----------+----------- +# CALLk: 0 1 0 0 1 1 1 0 . 1 0 1 1 1 0 1 1 +# CALLk-SAME: 1 0 0 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# ---------------------------------------+-----------+----------- +# CALLk-SAME: 0 1 0 0 1 1 1 0 . 1 0 1 1 1 0 1 1 +# CALLk-SAME: 1 0 0 0 1 0 0 0 . 1 1 1 1 1 1 1 1 +# ---------------------------------------+-----------+----------- +# CALLk-SAME: 0 1 0 0 1 1 1 0 . 1 0 1 1 1 0 1 1 +# CALLk-SAME: 1 0 0 0 1 0 0 0 . 0 0 1 0 1 0 1 0 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxCALL_PCI +body: | + bb.0: + CALLk 0, $a0 + CALLk -1, $a0 + CALLk 42, $a0 + +... +--- # MxCALL_PCD +# ---------------------------------------+-----------+----------- +# F E D C B A 9 8 7 6 | 5 4 3 | 2 1 0 +# ---------------------------------------+-----------+----------- +# 0 1 0 0 1 1 1 0 1 0 | MODE | REG +# ---------------------------------------+-----------+----------- +# CALLq-SAME: 0 1 0 0 1 1 1 0 . 1 0 1 1 1 0 1 0 +# CALLq-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# ---------------------------------------+-----------+----------- +# CALLq-SAME: 0 1 0 0 1 1 1 0 . 1 0 1 1 1 0 1 0 +# CALLq-SAME: 0 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxCALL_PCD +body: | + bb.0: + CALLq 0 + CALLq 32767 + +... +--- # MxCALL_ABS +# ---------------------------------------+-----------+----------- +# F E D C B A 9 8 7 6 | 5 4 3 | 2 1 0 +# ---------------------------------------+-----------+----------- +# 0 1 0 0 1 1 1 0 1 0 | MODE | REG +# ---------------------------------------+-----------+----------- +# CALLb-SAME: 0 1 0 0 1 1 1 0 . 1 0 1 1 1 0 0 1 +# CALLb-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# CALLb-SAME: 0 0 0 0 0 0 0 0 . 0 0 1 0 1 0 1 0 +# ---------------------------------------+-----------+----------- +# CALLb-SAME: 0 1 0 0 1 1 1 0 . 1 0 1 1 1 0 0 1 +# CALLb-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# CALLb-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxCALL_ABS +body: | + bb.0: + CALLb 42 + CALLb -1 + +... +--- # MxCALL_ARI +# ---------------------------------------+-----------+----------- +# F E D C B A 9 8 7 6 | 5 4 3 | 2 1 0 +# ---------------------------------------+-----------+----------- +# 0 1 0 0 1 1 1 0 1 0 | MODE | REG +# ---------------------------------------+-----------+----------- +# CALLj-SAME: 0 1 0 0 1 1 1 0 . 1 0 0 1 0 0 0 0 +# CALLj-SAME: 0 1 0 0 1 1 1 0 . 1 0 0 1 0 0 0 1 +# CALLj-SAME: 0 1 0 0 1 1 1 0 . 1 0 0 1 0 0 1 0 +name: MxCALL_ARI +body: | + bb.0: + CALLj $a0 + CALLj $a1 + CALLj $a2 + +... Index: llvm/test/CodeGen/M680x0/OBJ/Control/Classes/MxJMP.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Control/Classes/MxJMP.mir @@ -0,0 +1,21 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=JMP32j + +#------------------------------------------------------------------------------ +# MxJMP encodes unconditional jump +#------------------------------------------------------------------------------ + +--- # MxJMP_ARI +# ---------------------------------------+-----------+----------- +# F E D C B A 9 8 7 6 | 5 4 3 | 2 1 0 +# ---------------------------------------+-----------+----------- +# 0 1 0 0 1 1 1 0 1 1 | MODE | REG +# ---------------------------------------+-----------+----------- +# JMP32j: 0 1 0 0 1 1 1 0 . 1 1 0 1 0 0 0 0 +name: MxJMP_ARI +body: | + bb.0: + JMP32j $a0 + +... Index: llvm/test/CodeGen/M680x0/OBJ/Control/Classes/MxNOP.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Control/Classes/MxNOP.mir @@ -0,0 +1,16 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=NOP + +#------------------------------------------------------------------------------ +# MxNOP +#------------------------------------------------------------------------------ + +# --------------------------------------------------------------- +# F E D C B A 9 8 7 6 5 4 3 2 1 0 +# --------------------------------------------------------------- +# NOP: 0 1 0 0 1 1 1 0 . 0 1 1 1 0 0 0 1 +name: MxNOP +body: | + bb.0: + NOP Index: llvm/test/CodeGen/M680x0/OBJ/Control/Classes/MxRTS.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Control/Classes/MxRTS.mir @@ -0,0 +1,16 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=RTS + +#------------------------------------------------------------------------------ +# MxRTS pops return address from the stack and jumps there +#------------------------------------------------------------------------------ + +# --------------------------------------------------------------- +# F E D C B A 9 8 7 6 5 4 3 2 1 0 +# --------------------------------------------------------------- +# RTS: 0 1 0 0 1 1 1 0 . 0 1 1 1 0 1 0 1 +name: MxRTS +body: | + bb.0: + RTS Index: llvm/test/CodeGen/M680x0/OBJ/Control/Classes/MxScc.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Control/Classes/MxScc.mir @@ -0,0 +1,128 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=SETd8cc,SETd8ls,SETd8lt,SETd8eq,SETd8mi,\ +# RUN:SETd8f,SETd8ne,SETd8ge,SETd8cs,SETd8pl,SETd8gt,SETd8t,SETd8hi,SETd8vc,\ +# RUN:SETd8le,SETd8vs,SETp8cc,SETp8ls,SETp8lt,SETp8eq,SETp8mi,SETp8f,SETp8ne,\ +# RUN:SETp8ge,SETp8cs,SETp8pl,SETp8gt,SETp8t,SETp8hi,SETp8vc,SETp8le,SETp8vs + +#------------------------------------------------------------------------------ +# MxScc sets byte filled with 1s or 0s based on cc condition +#------------------------------------------------------------------------------ + +--- # MxScc_D +# ---------------+---------------+-------+-----------+----------- +# F E D C | B A 9 8 | 7 6 | 5 4 3 | 2 1 0 +# ---------------+---------------+-------+-----------+----------- +# 0 1 0 1 | CONDITION | 1 1 | MODE | REG +# ---------------+---------------+-------+-----------+----------- +# SETd8t: 0 1 0 1 0 0 0 0 . 1 1 0 0 0 0 0 0 +# SETd8f-SAME: 0 1 0 1 0 0 0 1 . 1 1 0 0 0 0 0 1 +# SETd8hi-SAME: 0 1 0 1 0 0 1 0 . 1 1 0 0 0 0 1 0 +# SETd8ls-SAME: 0 1 0 1 0 0 1 1 . 1 1 0 0 0 0 1 1 +# SETd8cc-SAME: 0 1 0 1 0 1 0 0 . 1 1 0 0 0 1 0 0 +# SETd8cs-SAME: 0 1 0 1 0 1 0 1 . 1 1 0 0 0 1 0 1 +# SETd8ne-SAME: 0 1 0 1 0 1 1 0 . 1 1 0 0 0 1 1 0 +# SETd8eq-SAME: 0 1 0 1 0 1 1 1 . 1 1 0 0 0 1 1 1 +# SETd8vc-SAME: 0 1 0 1 1 0 0 0 . 1 1 0 0 0 0 0 0 +# SETd8vs-SAME: 0 1 0 1 1 0 0 1 . 1 1 0 0 0 0 0 0 +# SETd8pl-SAME: 0 1 0 1 1 0 1 0 . 1 1 0 0 0 0 0 0 +# SETd8mi-SAME: 0 1 0 1 1 0 1 1 . 1 1 0 0 0 0 0 0 +# SETd8ge-SAME: 0 1 0 1 1 1 0 0 . 1 1 0 0 0 0 0 0 +# SETd8lt-SAME: 0 1 0 1 1 1 0 1 . 1 1 0 0 0 0 0 0 +# SETd8gt-SAME: 0 1 0 1 1 1 1 0 . 1 1 0 0 0 0 0 0 +# SETd8le-SAME: 0 1 0 1 1 1 1 1 . 1 1 0 0 0 0 0 0 +name: MxScc_D +body: | + bb.0: + $bd0 = SETd8t implicit $ccr + $bd1 = SETd8f implicit $ccr + $bd2 = SETd8hi implicit $ccr + $bd3 = SETd8ls implicit $ccr + $bd4 = SETd8cc implicit $ccr + $bd5 = SETd8cs implicit $ccr + $bd6 = SETd8ne implicit $ccr + $bd7 = SETd8eq implicit $ccr + $bd0 = SETd8vc implicit $ccr + $bd0 = SETd8vs implicit $ccr + $bd0 = SETd8pl implicit $ccr + $bd0 = SETd8mi implicit $ccr + $bd0 = SETd8ge implicit $ccr + $bd0 = SETd8lt implicit $ccr + $bd0 = SETd8gt implicit $ccr + $bd0 = SETd8le implicit $ccr + +... +--- # MxScc_ARID +# ---------------+---------------+-------+-----------+----------- +# F E D C | B A 9 8 | 7 6 | 5 4 3 | 2 1 0 +# ---------------+---------------+-------+-----------+----------- +# 0 1 0 1 | CONDITION | 1 1 | MODE | REG +# ---------------+---------------+-------+-----------+----------- +# SETp8t-SAME: 0 1 0 1 0 0 0 0 . 1 1 1 0 1 0 0 0 +# SETp8t-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# SETp8f-SAME: 0 1 0 1 0 0 0 1 . 1 1 1 0 1 0 0 1 +# SETp8f-SAME: 0 0 0 0 0 0 0 0 . 0 0 1 0 1 0 1 0 +# --------------------------------------------------------------- +# SETp8hi-SAME: 0 1 0 1 0 0 1 0 . 1 1 1 0 1 0 1 0 +# SETp8hi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# SETp8ls-SAME: 0 1 0 1 0 0 1 1 . 1 1 1 0 1 0 1 1 +# SETp8ls-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# SETp8cc-SAME: 0 1 0 1 0 1 0 0 . 1 1 1 0 1 1 0 0 +# SETp8cc-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# SETp8cs-SAME: 0 1 0 1 0 1 0 1 . 1 1 1 0 1 1 0 1 +# SETp8cs-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# SETp8ne-SAME: 0 1 0 1 0 1 1 0 . 1 1 1 0 1 1 1 0 +# SETp8ne-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# SETp8eq-SAME: 0 1 0 1 0 1 1 1 . 1 1 1 0 1 0 0 0 +# SETp8eq-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# SETp8vc-SAME: 0 1 0 1 1 0 0 0 . 1 1 1 0 1 0 0 0 +# SETp8vc-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# SETp8vs-SAME: 0 1 0 1 1 0 0 1 . 1 1 1 0 1 0 0 0 +# SETp8vs-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# SETp8pl-SAME: 0 1 0 1 1 0 1 0 . 1 1 1 0 1 0 0 0 +# SETp8pl-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# SETp8mi-SAME: 0 1 0 1 1 0 1 1 . 1 1 1 0 1 0 0 0 +# SETp8mi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# SETp8ge-SAME: 0 1 0 1 1 1 0 0 . 1 1 1 0 1 0 0 0 +# SETp8ge-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# SETp8lt-SAME: 0 1 0 1 1 1 0 1 . 1 1 1 0 1 0 0 0 +# SETp8lt-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# SETp8gt-SAME: 0 1 0 1 1 1 1 0 . 1 1 1 0 1 0 0 0 +# SETp8gt-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# SETp8le-SAME: 0 1 0 1 1 1 1 1 . 1 1 1 0 1 0 0 0 +# SETp8le-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +name: MxScc_ARID +body: | + bb.0: + SETp8t -1, $a0, implicit $ccr + SETp8f 42, $a1, implicit $ccr + SETp8hi 0, $a2, implicit $ccr + SETp8ls 0, $a3, implicit $ccr + SETp8cc 0, $a4, implicit $ccr + SETp8cs 0, $a5, implicit $ccr + SETp8ne 0, $a6, implicit $ccr + SETp8eq 0, $a0, implicit $ccr + SETp8vc 0, $a0, implicit $ccr + SETp8vs 0, $a0, implicit $ccr + SETp8pl 0, $a0, implicit $ccr + SETp8mi 0, $a0, implicit $ccr + SETp8ge 0, $a0, implicit $ccr + SETp8lt 0, $a0, implicit $ccr + SETp8gt 0, $a0, implicit $ccr + SETp8le 0, $a0, implicit $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Control/branch-pc-rel.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Control/branch-pc-rel.mir @@ -0,0 +1,31 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj \ +# RUN: -code-model=small -relocation-model=pic -o - \ +# RUN: | extract-section .text -h \ +# RUN: | FileCheck %s -check-prefixes=x00 + +#------------------------------------------------------------------------------ +# This test checks whether branches have correct offset +#------------------------------------------------------------------------------ + +--- # TEXT +# 0 x00: 6702 +# 2 x00-SAME: 6008 +# 4 x00-SAME: d0bc 0000 0000 +# A x00-SAME: 4e75 +# C x00-SAME: d0bc 0000 0001 +# 12 x00-SAME: 4e75 +name: TEXT +body: | + bb.0: + successors: %bb.2,%bb.1 + + Beq8 %bb.1, implicit $ccr + BRA8 %bb.2 + bb.1: + $d0 = ADD32ri $d0, 0, implicit-def $ccr + RET 0, $d0 + bb.2: + $d0 = ADD32ri $d0, 1, implicit-def $ccr + RET 0, $d0 + +... Index: llvm/test/CodeGen/M680x0/OBJ/Control/call-pc-rel.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Control/call-pc-rel.mir @@ -0,0 +1,66 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj \ +# RUN: -code-model=small -relocation-model=pic -o - \ +# RUN: | extract-section .text -h \ +# RUN: | FileCheck %s -check-prefixes=x00 + +#------------------------------------------------------------------------------ +# Tests PC-Relative Calls' offsets. The rest requires relocation and tested +# appropriately elsewhere. +#------------------------------------------------------------------------------ + +# +# +# 00 x00: 4e71 +# 02 x00-SAME: 4e75 +# +# +# 04 x00-SAME: 4ebb 08fa +# 08 x00-SAME: 4ebb 080a +# +# +# 0c x00-SAME: 4eba fff2 +# 10 x00-SAME: 4eba 0002 +# +# +# 14 x00-SAME: 4e71 +# 16 x00-SAME: 4e75 +--- | + + define dso_local void @BACKWARD() { entry: ret void } + define dso_local void @PCI() { entry: ret void } + define dso_local void @PCD() { entry: ret void } + define dso_local void @FORWARD() { entry: ret void } + +... +--- # BACKWARD +name: BACKWARD +body: | + bb.0: + NOP + RTS + +... +--- # PCI +name: PCI +body: | + bb.0: + CALLk @BACKWARD, $d0 + CALLk @FORWARD, $d0 + +... +--- # PCD +name: PCD +body: | + bb.0: + CALLq @BACKWARD + CALLq @FORWARD + +... +--- # FORWARD +name: FORWARD +body: | + bb.0: + NOP + RTS + +... Index: llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxLEA.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxLEA.mir @@ -0,0 +1,65 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=LEA32q,LEA32f,LEA32p + +#------------------------------------------------------------------------------ +# MxLEA is used to calculate effective address and load it into a address reg +#------------------------------------------------------------------------------ + +--- # PCD +# --------------------------------------------------------------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# --------------------------------------------------------------- +# 0 1 0 0 | DST REG | 1 1 1 | MODE | REG +# --------------------------------------------------------------- +# LEA32q: 0 1 0 0 0 0 0 1 . 1 1 1 1 1 0 1 0 +# LEA32q-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# LEA32q-SAME: 0 1 0 0 0 0 0 1 . 1 1 1 1 1 0 1 0 +# LEA32q-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxLEA_PCD +body: | + bb.0: + $a0 = LEA32q 0, implicit-def $ccr + $a0 = LEA32q -1, implicit-def $ccr + +... +--- # ARII +# --------------------------------------------------------------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# --------------------------------------------------------------- +# 0 1 0 0 | DST REG | 1 1 1 | MODE | REG +# --------------------------------------------------------------- +# LEA32f-SAME: 0 1 0 0 0 0 0 1 . 1 1 1 1 0 0 0 1 +# LEA32f-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# LEA32f-SAME: 0 1 0 0 0 0 1 1 . 1 1 1 1 0 0 1 0 +# LEA32f-SAME: 1 0 1 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxLEA_ARII +body: | + bb.0: + $a0 = LEA32f 0, $a1, $d1, implicit-def $ccr + $a1 = LEA32f 0, $a2, $a2, implicit-def $ccr + +... +--- # ARID +# --------------------------------------------------------------- +# F E D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# --------------------------------------------------------------- +# 0 1 0 0 | DST REG | 1 1 1 | MODE | REG +# --------------------------------------------------------------- +# LEA32p-SAME: 0 1 0 0 0 0 0 1 . 1 1 1 0 1 0 0 1 +# LEA32p-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# LEA32p-SAME: 0 1 0 0 0 0 0 1 . 1 1 1 0 1 0 0 1 +# LEA32p-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxLEA_ARID +body: | + bb.0: + $a0 = LEA32p -1, $a1, implicit-def $ccr + $a0 = LEA32p -1, $a1, implicit-def $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMOVEM_MR.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMOVEM_MR.mir @@ -0,0 +1,52 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=MOVM32pm,MOVM32jm + +#------------------------------------------------------------------------------ +# MxMOVEM_MR is used to store a list of register sequentially into a memory +# location +#------------------------------------------------------------------------------ + +--- # ARID +# -------------------+---+-----------+---+-----------+----------- +# F E D C B | A | 9 8 7 | 6 | 5 4 3 | 2 1 0 +# -------------------+---+-----------+---+-----------+----------- +# 0 1 0 0 1 | D | 0 0 1 | S | MODE | REG +# -------------------+---+-----------+---+-----------+----------- +# REGISTER LIST MASK +# --------------------------------------------------------------- +# MOVM32pm: 0 1 0 0 1 0 0 0 . 1 1 1 0 1 0 0 1 +# MOVM32pm-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 1 +# MOVM32pm-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOVM32pm-SAME: 0 1 0 0 1 0 0 0 . 1 1 1 0 1 0 0 1 +# MOVM32pm-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 1 1 +# MOVM32pm-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxMOVEM_MR_ARID +body: | + bb.0: + MOVM32pm 0, $a1, 1 + MOVM32pm -1, $a1, 3 + +... +--- # ARI +# -------------------+---+-----------+---+-----------+----------- +# F E D C B | A | 9 8 7 | 6 | 5 4 3 | 2 1 0 +# -------------------+---+-----------+---+-----------+----------- +# 0 1 0 0 1 | D | 0 0 1 | S | MODE | REG +# -------------------+---+-----------+---+-----------+----------- +# MOVM32jm-SAME: 0 1 0 0 1 0 0 0 . 1 1 0 1 0 0 0 1 +# MOVM32jm-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 1 +# --------------------------------------------------------------- +# MOVM32jm-SAME: 0 1 0 0 1 0 0 0 . 1 1 0 1 0 0 0 1 +# MOVM32jm-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 1 1 +# --------------------------------------------------------------- +# REGISTER LIST MASK +# --------------------------------------------------------------- +name: MxMOVEM_MR_ARI +body: | + bb.0: + MOVM32jm $a1, 1 + MOVM32jm $a1, 3 + +... Index: llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMOVEM_RM.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMOVEM_RM.mir @@ -0,0 +1,52 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=MOVM32mp,MOVM32mj + +#------------------------------------------------------------------------------ +# MxMOVEM_RM is used to load a list of registers sequentially from a memory +# location +#------------------------------------------------------------------------------ + +--- # ARID +# -------------------+---+-----------+---+-----------+----------- +# F E D C B | A | 9 8 7 | 6 | 5 4 3 | 2 1 0 +# -------------------+---+-----------+---+-----------+----------- +# 0 1 0 0 1 | D | 0 0 1 | S | MODE | REG +# -------------------+---+-----------+---+-----------+----------- +# REGISTER LIST MASK +# --------------------------------------------------------------- +# MOVM32mp: 0 1 0 0 1 1 0 0 . 1 1 1 0 1 0 0 1 +# MOVM32mp-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 1 +# MOVM32mp-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOVM32mp-SAME: 0 1 0 0 1 1 0 0 . 1 1 1 0 1 0 0 1 +# MOVM32mp-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 1 1 +# MOVM32mp-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxMOVEM_RM_ARID +body: | + bb.0: + MOVM32mp 1, 0, $a1 + MOVM32mp 3, -1, $a1 + +... +--- # ARI +# -------------------+---+-----------+---+-----------+----------- +# F E D C B | A | 9 8 7 | 6 | 5 4 3 | 2 1 0 +# -------------------+---+-----------+---+-----------+----------- +# 0 1 0 0 1 | D | 0 0 1 | S | MODE | REG +# -------------------+---+-----------+---+-----------+----------- +# MOVM32mj-SAME: 0 1 0 0 1 1 0 0 . 1 1 0 1 0 0 0 1 +# MOVM32mj-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 1 +# --------------------------------------------------------------- +# MOVM32mj-SAME: 0 1 0 0 1 1 0 0 . 1 1 0 1 0 0 0 1 +# MOVM32mj-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 1 1 +# --------------------------------------------------------------- +# REGISTER LIST MASK +# --------------------------------------------------------------- +name: MxMOVEM_RM_ARI +body: | + bb.0: + MOVM32mj 1, $a1 + MOVM32mj 3, $a1 + +... Index: llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMoveCCR.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMoveCCR.mir @@ -0,0 +1,34 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=MOV16cd,MOV16dc + +#------------------------------------------------------------------------------ +# MxMoveToCCR and MxMoveFromCCR load/store condition flag register +#------------------------------------------------------------------------------ + +--- # To CCR +# ---------------------------------------+-----------+----------- +# F E D C B A 9 8 7 6 | 5 4 3 | 2 1 0 +# ---------------------------------------+-----------+----------- +# 0 1 0 0 0 1 0 0 1 1 | MODE | REG +# ---------------------------------------+-----------+----------- +# MOV16cd: 0 1 0 0 0 1 0 0 . 1 1 0 0 0 0 0 1 +name: MxMoveToCCR +body: | + bb.0: + $ccr = MOV16cd $wd1, implicit-def $ccr + +... +--- # From CCR +# ---------------------------------------+-----------+----------- +# F E D C B A 9 8 7 6 | 5 4 3 | 2 1 0 +# ---------------------------------------+-----------+----------- +# 0 1 0 0 0 0 1 0 1 1 | MODE | REG +# ---------------------------------------+-----------+----------- +# MOV16cd-SAME: 0 1 0 0 0 0 1 0 . 1 1 0 0 0 0 0 1 +name: MxMoveFromCCR +body: | + bb.0: + $wd1 = MOV16dc $ccr, implicit $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMove_MI.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMove_MI.mir @@ -0,0 +1,97 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=MOV8fi,MOV32fi,MOV8pi,MOV32pi,MOV8ji,MOV32ji + +#------------------------------------------------------------------------------ +# MxMove_MI is used for moving immediate to memory +#------------------------------------------------------------------------------ + +--- # ARII +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8fi: 0 0 0 1 0 0 0 1 . 1 0 1 1 1 1 0 0 +# MOV8fi-SAME: 0 0 0 0 0 0 0 0 . 1 1 1 1 1 1 1 1 +# MOV8fi-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV8fi-SAME: 0 0 0 1 0 0 0 1 . 1 0 1 1 1 1 0 0 +# MOV8fi-SAME: 0 0 0 0 0 0 0 0 . 0 0 1 0 1 0 1 0 +# MOV8fi-SAME: 0 0 0 1 1 0 0 0 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# MOV32fi-SAME: 0 0 1 0 0 0 1 1 . 1 0 1 1 1 1 0 0 +# MOV32fi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# MOV32fi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# MOV32fi-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32fi-SAME: 0 0 1 0 0 1 0 1 . 1 0 1 1 1 1 0 0 +# MOV32fi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV32fi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV32fi-SAME: 1 0 1 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxMove_MI_ARII +body: | + bb.0: + MOV8fi 0, $a0, $d1, -1, implicit-def $ccr + MOV8fi -1, $a0, $d1, 42, implicit-def $ccr + MOV32fi 0, $a1, $d1, -1, implicit-def $ccr + MOV32fi 0, $a2, $a2, 0, implicit-def $ccr + +... +--- # ARID +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8pi-SAME: 0 0 0 1 0 0 0 1 . 0 1 1 1 1 1 0 0 +# MOV8pi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV8pi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32pi-SAME: 0 0 1 0 0 0 1 1 . 0 1 1 1 1 1 0 0 +# MOV32pi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV32pi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV32pi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# MOV32pi-SAME: 0 0 1 0 0 0 1 1 . 0 1 1 1 1 1 0 0 +# MOV32pi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV32pi-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV32pi-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxMove_MI_ARID +body: | + bb.0: + MOV8pi 0, $a0, 0, implicit-def $ccr + MOV32pi -1, $a1, 0, implicit-def $ccr + MOV32pi -1, $a1, 0, implicit-def $ccr + +... +--- # ARI +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8ji-SAME: 0 0 0 1 0 0 0 0 . 1 0 1 1 1 1 0 0 +# MOV8ji-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32ji-SAME: 0 0 1 0 0 0 1 0 . 1 0 1 1 1 1 0 0 +# MOV32ji-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV32ji-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32ji-SAME: 0 0 1 0 0 0 1 0 . 1 0 1 1 1 1 0 0 +# MOV32ji-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV32ji-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +name: MxMove_MI_ARI +body: | + bb.0: + MOV8ji $a0, 0, implicit-def $ccr + MOV32ji $a1, 0, implicit-def $ccr + MOV32ji $a1, 0, implicit-def $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMove_MM.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMove_MM.mir @@ -0,0 +1,212 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=MOV8jk,MOV32jk,MOV8jq,MOV32jq,MOV8ff,MOV32ff,\ +# RUN:MOV8pp,MOV32pp,MOV8jj,MOV32jj,MOV8oo,MOV32oo,MOV8ee,MOV32ee,MOV8bb,MOV32bb + +#------------------------------------------------------------------------------ +# MxMove_MM is used for moving data from memory to memory +#------------------------------------------------------------------------------ + +--- # ARI <- PCI +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8jk: 0 0 0 1 0 0 0 0 . 1 0 1 1 1 0 1 1 +# MOV8jk-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV8jk-SAME: 0 0 0 1 0 0 0 0 . 1 0 1 1 1 0 1 1 +# MOV8jk-SAME: 0 0 0 1 1 0 0 0 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# MOV32jk-SAME: 0 0 1 0 0 0 0 0 . 1 0 1 1 1 0 1 1 +# MOV32jk-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32jk-SAME: 0 0 1 0 0 0 1 0 . 1 0 1 1 1 0 1 1 +# MOV32jk-SAME: 1 0 1 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxMove_RM_ARI_PCI +body: | + bb.0: + MOV8jk $a0, 0, $d1, implicit-def $ccr + MOV8jk $a0, -1, $d1, implicit-def $ccr + MOV32jk $a0, 0, $d1, implicit-def $ccr + MOV32jk $a1, 0, $a2, implicit-def $ccr + +... +--- # ARI <- PCD +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8jq-SAME: 0 0 0 1 0 0 0 0 . 1 0 1 1 1 0 1 0 +# MOV8jq-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32jq-SAME: 0 0 1 0 0 0 0 0 . 1 0 1 1 1 0 1 0 +# MOV32jq-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# MOV32jq-SAME: 0 0 1 0 0 0 0 0 . 1 0 1 1 1 0 1 0 +# MOV32jq-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxMove_RM_PCD +body: | + bb.0: + MOV8jq $a0, 0, implicit-def $ccr + MOV32jq $a0, -1, implicit-def $ccr + MOV32jq $a0, -1, implicit-def $ccr + +... +--- # ARII <- ARII +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8ff: 0 0 0 1 0 0 0 1 . 1 0 1 1 0 0 0 0 +# MOV8ff-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV8ff-SAME: 0 0 0 1 1 0 0 0 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# MOV8ff-SAME: 0 0 0 1 0 0 0 1 . 1 0 1 1 0 0 0 0 +# MOV8ff-SAME: 0 0 0 1 1 0 0 0 . 1 1 1 1 1 1 1 1 +# MOV8ff-SAME: 0 0 0 1 1 0 0 0 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# MOV32ff-SAME: 0 0 1 0 0 0 1 1 . 1 0 1 1 0 0 0 1 +# MOV32ff-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV32ff-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32ff-SAME: 0 0 1 0 0 1 0 1 . 1 0 1 1 0 0 1 0 +# MOV32ff-SAME: 1 0 1 0 1 0 0 0 . 0 0 1 0 1 0 1 0 +# MOV32ff-SAME: 1 0 1 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxMove_RM_ARII_ARII +body: | + bb.0: + MOV8ff -1, $a0, $d1, 0, $a0, $d1, implicit-def $ccr + MOV8ff -1, $a0, $d1, -1, $a0, $d1, implicit-def $ccr + MOV32ff 0, $a1, $d1, 0, $a1, $d1, implicit-def $ccr + MOV32ff 0, $a2, $a2, 42, $a2, $a2, implicit-def $ccr + +... +--- # ARID <- ARID +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8pp-SAME: 0 0 0 1 0 0 0 1 . 0 1 1 0 1 0 0 0 +# MOV8pp-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV8pp-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32pp-SAME: 0 0 1 0 0 0 1 1 . 0 1 1 0 1 0 0 1 +# MOV32pp-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# MOV32pp-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32pp-SAME: 0 0 1 0 0 0 1 1 . 0 1 1 0 1 0 0 1 +# MOV32pp-SAME: 0 0 0 0 0 0 0 0 . 0 0 1 0 1 0 1 0 +# MOV32pp-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxMove_RM_ARID +body: | + bb.0: + MOV8pp 0, $a0, 0, $a0, implicit-def $ccr + MOV32pp 0, $a1, -1, $a1, implicit-def $ccr + MOV32pp -1, $a1, 42, $a1, implicit-def $ccr + +... +--- # ARIPD <- ARIPD +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8ee-SAME: 0 0 0 1 0 0 0 1 . 0 0 1 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32ee-SAME: 0 0 1 0 0 0 1 1 . 0 0 1 0 0 0 0 1 +# --------------------------------------------------------------- +# MOV32ee-SAME: 0 0 1 0 0 0 1 1 . 0 0 1 0 0 0 0 1 +name: MxMove_RM_ARIPD +body: | + bb.0: + MOV8ee $a0, $a0, implicit-def $ccr + MOV32ee $a1, $a1, implicit-def $ccr + MOV32ee $a1, $a1, implicit-def $ccr + +... +--- # ARIPI <- ARIPI +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8oo-SAME: 0 0 0 1 0 0 0 0 . 1 1 0 1 1 0 0 0 +# --------------------------------------------------------------- +# MOV32oo-SAME: 0 0 1 0 0 0 1 0 . 1 1 0 1 1 0 0 1 +# --------------------------------------------------------------- +# MOV32oo-SAME: 0 0 1 0 0 0 1 0 . 1 1 0 1 1 0 0 1 +name: MxMove_RM_ARIPI +body: | + bb.0: + MOV8oo $a0, $a0, implicit-def $ccr + MOV32oo $a1, $a1, implicit-def $ccr + MOV32oo $a1, $a1, implicit-def $ccr + +... +--- # ARI <- ARI +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8jj-SAME: 0 0 0 1 0 0 0 0 . 1 0 0 1 0 0 0 0 +# --------------------------------------------------------------- +# MOV32jj-SAME: 0 0 1 0 0 0 1 0 . 1 0 0 1 0 0 0 1 +# --------------------------------------------------------------- +# MOV32jj-SAME: 0 0 1 0 0 0 1 0 . 1 0 0 1 0 0 0 1 +name: MxMove_RM_ARI +body: | + bb.0: + MOV8jj $a0, $a0, implicit-def $ccr + MOV32jj $a1, $a1, implicit-def $ccr + MOV32jj $a1, $a1, implicit-def $ccr + +... +--- # ABS <- ABS +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8bb-SAME: 0 0 0 1 0 0 1 1 . 1 1 1 1 1 0 0 1 +# MOV8bb-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# MOV8bb-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32bb-SAME: 0 0 1 0 0 0 1 1 . 1 1 1 1 1 0 0 1 +# MOV32bb-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV32bb-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV32bb-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# MOV32bb-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# MOV32bb-SAME: 0 0 1 0 0 0 1 1 . 1 1 1 1 1 0 0 1 +# MOV32bb-SAME: 0 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# MOV32bb-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# MOV32bb-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV32bb-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +name: MxMove_RM_ABS +body: | + bb.0: + MOV8bb 0, -1, implicit-def $ccr + MOV32bb -1, 0, implicit-def $ccr + MOV32bb 0, 2147483647, implicit-def $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMove_MR.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMove_MR.mir @@ -0,0 +1,81 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=MOV8fd,MOV32fr,MOV8pd,MOV32pr,MOV8jd,MOV32jr + +#------------------------------------------------------------------------------ +# MxMove_MR is used for moving data from register to memory +#------------------------------------------------------------------------------ + +--- # ARII +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8fd: 0 0 0 1 0 0 0 1 . 1 0 0 0 0 0 0 0 +# MOV8fd-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV8fd-SAME: 0 0 0 1 0 0 0 1 . 1 0 0 0 0 0 0 0 +# MOV8fd-SAME: 0 0 0 1 1 0 0 0 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# MOV32fr-SAME: 0 0 1 0 0 0 1 1 . 1 0 0 0 0 0 0 0 +# MOV32fr-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32fr-SAME: 0 0 1 0 0 1 0 1 . 1 0 0 0 0 0 0 1 +# MOV32fr-SAME: 1 0 1 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxMove_MR_ARII +body: | + bb.0: + MOV8fd 0, $a0, $d1, $bd0, implicit-def $ccr + MOV8fd -1, $a0, $d1, $bd0, implicit-def $ccr + MOV32fr 0, $a1, $d1, $d0, implicit-def $ccr + MOV32fr 0, $a2, $a2, $d1, implicit-def $ccr + +... +--- # ARID +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8pd-SAME: 0 0 0 1 0 0 0 1 . 0 1 0 0 0 0 0 0 +# MOV8pd-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32pr-SAME: 0 0 1 0 0 0 1 1 . 0 1 0 0 0 0 0 0 +# MOV32pr-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# MOV32pr-SAME: 0 0 1 0 0 0 1 1 . 0 1 0 0 1 0 0 0 +# MOV32pr-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxMove_MR_ARID +body: | + bb.0: + MOV8pd 0, $a0, $bd0, implicit-def $ccr + MOV32pr -1, $a1, $d0, implicit-def $ccr + MOV32pr -1, $a1, $a0, implicit-def $ccr + +... +--- # ARI +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8jd-SAME: 0 0 0 1 0 0 0 0 . 1 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32jr-SAME: 0 0 1 0 0 0 1 0 . 1 0 0 0 0 0 1 1 +# --------------------------------------------------------------- +# MOV32jr-SAME: 0 0 1 0 0 0 1 0 . 1 0 0 0 1 1 0 0 +name: MxMove_MR_ARI +body: | + bb.0: + MOV8jd $a0, $bd0, implicit-def $ccr + MOV32jr $a1, $d3, implicit-def $ccr + MOV32jr $a1, $a4, implicit-def $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMove_RI.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMove_RI.mir @@ -0,0 +1,31 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=MOV8di,MOV32ri + +#------------------------------------------------------------------------------ +# MxMove_RI is used for moving immediate to register +#------------------------------------------------------------------------------ + +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8di: 0 0 0 1 0 0 0 0 . 0 0 1 1 1 1 0 0 +# MOV8di-SAME: 0 0 0 0 0 0 0 0 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# MOV32ri-SAME: 0 0 1 0 0 0 1 0 . 0 1 1 1 1 1 0 0 +# MOV32ri-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV32ri-SAME: 0 0 0 0 0 0 0 0 . 0 0 1 0 1 0 1 0 +# --------------------------------------------------------------- +# MOV32ri-SAME: 0 0 1 0 0 0 1 0 . 0 1 1 1 1 1 0 0 +# MOV32ri-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# MOV32ri-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxMove_RI +body: | + bb.0: + $bd0 = MOV8di -1, implicit-def $ccr + $a1 = MOV32ri 42, implicit-def $ccr + $a1 = MOV32ri -1, implicit-def $ccr + Index: llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMove_RM.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMove_RM.mir @@ -0,0 +1,200 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=MOV8dk,MOV32rk,MOV8dq,MOV32rq,MOV8df,MOV32rf,\ +# RUN:MOV8dp,MOV32rp,MOV8dj,MOV32rj,MOV8do,MOV32ro,MOV8de,MOV32re,MOV8db,MOV32rb + +#------------------------------------------------------------------------------ +# MxMove_RM is used for moving data from memory to register +#------------------------------------------------------------------------------ + +--- # PCI +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8dk: 0 0 0 1 0 0 0 0 . 0 0 1 1 1 0 1 1 +# MOV8dk-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV8dk-SAME: 0 0 0 1 0 0 0 0 . 0 0 1 1 1 0 1 1 +# MOV8dk-SAME: 0 0 0 1 1 0 0 0 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# MOV32rk-SAME: 0 0 1 0 0 0 0 0 . 0 0 1 1 1 0 1 1 +# MOV32rk-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32rk-SAME: 0 0 1 0 0 0 1 0 . 0 0 1 1 1 0 1 1 +# MOV32rk-SAME: 1 0 1 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxMove_RM_PCI +body: | + bb.0: + $bd0 = MOV8dk 0, $d1, implicit-def $ccr + $bd0 = MOV8dk -1, $d1, implicit-def $ccr + $d0 = MOV32rk 0, $d1, implicit-def $ccr + $d1 = MOV32rk 0, $a2, implicit-def $ccr + +... +--- # PCD +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8dq-SAME: 0 0 0 1 0 0 0 0 . 0 0 1 1 1 0 1 0 +# MOV8dq-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32rq-SAME: 0 0 1 0 0 0 0 0 . 0 0 1 1 1 0 1 0 +# MOV32rq-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# MOV32rq-SAME: 0 0 1 0 0 0 0 0 . 0 1 1 1 1 0 1 0 +# MOV32rq-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxMove_RM_PCD +body: | + bb.0: + $bd0 = MOV8dq 0, implicit-def $ccr + $d0 = MOV32rq -1, implicit-def $ccr + $a0 = MOV32rq -1, implicit-def $ccr + +... +--- # ARII +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8df: 0 0 0 1 0 0 0 0 . 0 0 1 1 0 0 0 0 +# MOV8df-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV8df-SAME: 0 0 0 1 0 0 0 0 . 0 0 1 1 0 0 0 0 +# MOV8df-SAME: 0 0 0 1 1 0 0 0 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# MOV32rf-SAME: 0 0 1 0 0 0 0 0 . 0 0 1 1 0 0 0 1 +# MOV32rf-SAME: 0 0 0 1 1 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32rf-SAME: 0 0 1 0 0 0 1 0 . 0 0 1 1 0 0 1 0 +# MOV32rf-SAME: 1 0 1 0 1 0 0 0 . 0 0 0 0 0 0 0 0 +# ---+-----------+---+-------+---+------------------------------- +# BRIEF DA | REG | L | SCALE | 0 | DISPLACEMENT +# ---+-----------+---+-------+---+------------------------------- +name: MxMove_RM_ARII +body: | + bb.0: + $bd0 = MOV8df 0, $a0, $d1, implicit-def $ccr + $bd0 = MOV8df -1, $a0, $d1, implicit-def $ccr + $d0 = MOV32rf 0, $a1, $d1, implicit-def $ccr + $d1 = MOV32rf 0, $a2, $a2, implicit-def $ccr + +... +--- # ARID +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8dp-SAME: 0 0 0 1 0 0 0 0 . 0 0 1 0 1 0 0 0 +# MOV8dp-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32rp-SAME: 0 0 1 0 0 0 0 0 . 0 0 1 0 1 0 0 1 +# MOV32rp-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +# --------------------------------------------------------------- +# MOV32rp-SAME: 0 0 1 0 0 0 0 0 . 0 1 1 0 1 0 0 1 +# MOV32rp-SAME: 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 1 1 +name: MxMove_RM_ARID +body: | + bb.0: + $bd0 = MOV8dp 0, $a0, implicit-def $ccr + $d0 = MOV32rp -1, $a1, implicit-def $ccr + $a0 = MOV32rp -1, $a1, implicit-def $ccr + +... +--- # ARIPD +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8de-SAME: 0 0 0 1 0 0 0 0 . 0 0 1 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32re-SAME: 0 0 1 0 0 1 1 0 . 0 0 1 0 0 0 0 1 +# --------------------------------------------------------------- +# MOV32re-SAME: 0 0 1 0 1 0 0 0 . 0 1 1 0 0 0 0 1 +name: MxMove_RM_ARIPD +body: | + bb.0: + $bd0 = MOV8de $a0, implicit-def $ccr + $d3 = MOV32re $a1, implicit-def $ccr + $a4 = MOV32re $a1, implicit-def $ccr + +... +--- # ARIPI +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8do-SAME: 0 0 0 1 0 0 0 0 . 0 0 0 1 1 0 0 0 +# --------------------------------------------------------------- +# MOV32ro-SAME: 0 0 1 0 0 1 1 0 . 0 0 0 1 1 0 0 1 +# --------------------------------------------------------------- +# MOV32ro-SAME: 0 0 1 0 1 0 0 0 . 0 1 0 1 1 0 0 1 +name: MxMove_RM_ARIPI +body: | + bb.0: + $bd0 = MOV8do $a0, implicit-def $ccr + $d3 = MOV32ro $a1, implicit-def $ccr + $a4 = MOV32ro $a1, implicit-def $ccr + +... +--- # ARI +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8dj-SAME: 0 0 0 1 0 0 0 0 . 0 0 0 1 0 0 0 0 +# --------------------------------------------------------------- +# MOV32rj-SAME: 0 0 1 0 0 1 1 0 . 0 0 0 1 0 0 0 1 +# --------------------------------------------------------------- +# MOV32rj-SAME: 0 0 1 0 1 0 0 0 . 0 1 0 1 0 0 0 1 +name: MxMove_RM_ARI +body: | + bb.0: + $bd0 = MOV8dj $a0, implicit-def $ccr + $d3 = MOV32rj $a1, implicit-def $ccr + $a4 = MOV32rj $a1, implicit-def $ccr + +... +--- # ABS +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8db-SAME: 0 0 0 1 0 0 0 0 . 0 0 1 1 1 0 0 1 +# MOV8db-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32rb-SAME: 0 0 1 0 0 1 1 0 . 0 0 1 1 1 0 0 1 +# MOV32rb-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV32rb-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# --------------------------------------------------------------- +# MOV32rb-SAME: 0 0 1 0 1 0 0 0 . 0 1 1 1 1 0 0 1 +# MOV32rb-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +# MOV32rb-SAME: 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 +name: MxMove_RM_ABS +body: | + bb.0: + $bd0 = MOV8db 0, implicit-def $ccr + $d3 = MOV32rb 0, implicit-def $ccr + $a4 = MOV32rb 0, implicit-def $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMove_RR.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Data/Classes/MxMove_RR.mir @@ -0,0 +1,30 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=MOV8dd,MOV16ra,MOV32rr + +#------------------------------------------------------------------------------ +# MxMove_RR moves data from register to register +#------------------------------------------------------------------------------ + + +# ---------------------------+-----------+-----------+----------- +# F E | D C | B A 9 | 8 7 6 | 5 4 3 | 2 1 0 +# -------+-------+-----------+-----------+-----------+----------- +# | | DESTINATION | SOURCE +# 0 0 | SIZE | REG | MODE | MODE | REG +# -------+-------+-----------+-----------+-----------+----------- +# MOV8dd: 0 0 0 1 0 0 1 0 . 0 0 0 0 0 0 0 0 +# MOV16rr-SAME: 0 0 1 1 0 1 1 0 . 0 0 0 0 1 0 1 0 +# MOV16rr-SAME: 0 0 1 1 1 1 0 0 . 0 1 0 0 1 0 1 0 +# MOV32ra-SAME: 0 0 1 0 1 1 0 0 . 0 0 0 0 1 0 1 0 +# MOV32rr-SAME: 0 0 1 0 0 0 1 0 . 0 0 0 0 0 0 1 0 +# MOV32rr-SAME: 0 0 1 0 0 0 1 0 . 0 1 0 0 1 0 1 0 +name: MxMove_RR +body: | + bb.0: + $bd1 = MOV8dd $bd0, implicit-def $ccr + $wd3 = MOV16ra $wa2, implicit-def $ccr + $wa6 = MOV16ra $wa2, implicit-def $ccr + $wd1 = MOV16ra $wa2, implicit-def $ccr + $d1 = MOV32rr $d2, implicit-def $ccr + $a1 = MOV32rr $a2, implicit-def $ccr Index: llvm/test/CodeGen/M680x0/OBJ/README.md =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/README.md @@ -0,0 +1,14 @@ +# OBJECT CODE TESTS + +## Purpose +These test snippets are to test object code generation features, specifically +lowering of MxBean encoding, Relocations and specific commands encoding classes. + +### MxBean +TODO + +### Relocations +TODO + +### Encoding Classes +TODO Index: llvm/test/CodeGen/M680x0/OBJ/Relaxations/branch.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Relaxations/branch.mir @@ -0,0 +1,116 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj \ +# RUN: -code-model=small -relocation-model=pic -o - \ +# RUN: | extract-section .text -h \ +# RUN: | FileCheck %s -check-prefixes=x00 + +#------------------------------------------------------------------------------ +# Test branch relaxation. By default codegen choses smallest branch instruction, +# during object code generation it might get clear that offset does not fit and +# bigger instruction is required. +#------------------------------------------------------------------------------ + + +--- # TIGHT +# The offset for the small branch is from the PC value, which points to the +# next instruction, because there is no extension word here. +# 000 x00: 6078 +# 002 x00-SAME: 23f9 0000 0000 0000 0000 +# 00C x00-SAME: 23f9 0000 0000 0000 0000 +# 016 x00-SAME: 23f9 0000 0000 0000 0000 +# 020 x00-SAME: 23f9 0000 0000 0000 0000 +# 02A x00-SAME: 23f9 0000 0000 0000 0000 +# 034 x00-SAME: 23f9 0000 0000 0000 0000 +# 03E x00-SAME: 23f9 0000 0000 0000 0000 +# 048 x00-SAME: 23f9 0000 0000 0000 0000 +# 052 x00-SAME: 23f9 0000 0000 0000 0000 +# 05C x00-SAME: 23f9 0000 0000 0000 0000 +# 066 x00-SAME: 23f9 0000 0000 0000 0000 +# 070 x00-SAME: 23f9 0000 0000 0000 0000 +# 07A x00-SAME: d0bc 0000 0000 +# 080 x00-SAME: 4e75 +# 082 x00-SAME: 4e71 +name: TIGHT +body: | + bb.0: + successors: %bb.2 + + BRA8 %bb.2 + bb.1: + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + bb.2: + $d0 = ADD32ri $d0, 0, implicit-def $ccr + RET 0, $d0 + +... +--- # RELAXED +# 084 x00-SAME 6000 0084 +# 088 x00-SAME: 23f9 0000 0000 0000 0000 +# 092 x00-SAME: 23f9 0000 0000 0000 0000 +# 09C x00-SAME: 23f9 0000 0000 0000 0000 +# 0A6 x00-SAME: 23f9 0000 0000 0000 0000 +# 0B0 x00-SAME: 23f9 0000 0000 0000 0000 +# 0BA x00-SAME: 23f9 0000 0000 0000 0000 +# 0C4 x00-SAME: 23f9 0000 0000 0000 0000 +# 0CE x00-SAME: 23f9 0000 0000 0000 0000 +# 0D8 x00-SAME: 23f9 0000 0000 0000 0000 +# 0E2 x00-SAME: 23f9 0000 0000 0000 0000 +# 0EC x00-SAME: 23f9 0000 0000 0000 0000 +# 0F6 x00-SAME: 23f9 0000 0000 0000 0000 +# 100 x00-SAME: 23f9 0000 0000 0000 0000 +# 10A x00-SAME: d0bc 0000 0000 +# 110 x00-SAME: 4e75 +# 112 x00-SAME: 4e71 +name: RELAXED +body: | + bb.0: + successors: %bb.2 + + BRA8 %bb.2 + bb.1: + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + MOV32bb 0, 0, implicit-def $ccr + bb.2: + $d0 = ADD32ri $d0, 0, implicit-def $ccr + RET 0, $d0 + +... +--- # ZERO +# Because of the way M680x0 encodes branches it is not possible to encode 0 +# offset with the smallest insruction(0 in the offset field means exension word +# is used) thus we switch to the wider instruction. +# 114 x00-SAME: 6000 0002 +# 118 x00-SAME: d0bc 0000 0000 +# 11E x00-SAME: 4e75 +name: ZERO +body: | + bb.0: + successors: %bb.1 + + BRA8 %bb.1 + bb.1: + $d0 = ADD32ri $d0, 0, implicit-def $ccr + RET 0, $d0 + +... Index: llvm/test/CodeGen/M680x0/OBJ/Relocations/data-abs.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Relocations/data-abs.mir @@ -0,0 +1,26 @@ + +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj \ +# RUN: -code-model=small -relocation-model=pic -o - \ +# RUN: | llvm-readobj -relocations -elf-output-style=GNU - \ +# RUN: | FileCheck %s -check-prefixes=x00 + +#------------------------------------------------------------------------------ +# Test ABS relocation +#------------------------------------------------------------------------------ + +--- | + + @dst = external global i32 + + define void @DATA() { entry: ret void } + +... +--- # DATA +# Offset Info Type Sym. Value Sym S Addend +# x00: 00000002 {{[0-9a-f]+}} R_M680x0_32 {{[0-9]*}} dst + 0 +name: DATA +body: | + bb.0: + $d0 = MOV32rb @dst, implicit-def $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Relocations/data-gotoff.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Relocations/data-gotoff.mir @@ -0,0 +1,29 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj \ +# RUN: -code-model=small -relocation-model=pic -o - \ +# RUN: | llvm-readobj -relocations -elf-output-style=GNU - \ +# RUN: | FileCheck %s -check-prefixes=x00 + +#------------------------------------------------------------------------------ +# Test GOTOFF relocation +#------------------------------------------------------------------------------ + +--- | + + @dst = external global i32 + + define void @DATA() { entry: ret void } + +... +--- # DATA +# Offset Info Type Sym. Value Sym S Addend +# x00: 00000002 {{[0-9a-f]+}} R_M680x0_GOTPCREL16 {{[0-9]*}} _GLOBAL_OFFSET_TABLE_ + 0 +# x00: 00000007 {{[0-9a-f]+}} R_M680x0_GOTOFF8 {{[0-9]*}} dst + 0 +# x00: 0000000a {{[0-9a-f]+}} R_M680x0_GOTOFF16 {{[0-9]*}} dst + 0 +name: DATA +body: | + bb.0: + $a5 = LEA32q target-flags(M680x0-gotpcrel) &_GLOBAL_OFFSET_TABLE_ + $d0 = MOV32rf target-flags(M680x0-gotoff) @dst, $a5, $d0, implicit-def $ccr + $d0 = MOV32rp target-flags(M680x0-gotoff) @dst, $a5, implicit-def $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Relocations/data-gotpcrel.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Relocations/data-gotpcrel.mir @@ -0,0 +1,27 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj \ +# RUN: -code-model=small -relocation-model=pic -o - \ +# RUN: | llvm-readobj -relocations -elf-output-style=GNU - \ +# RUN: | FileCheck %s -check-prefixes=x00 + +#------------------------------------------------------------------------------ +# Test GOTPCREL relocation +#------------------------------------------------------------------------------ + +--- | + + @dst = external global i32 + + define void @DATA() { entry: ret void } + +... +--- # DATA +# Offset Info Type Sym. Value Sym S Addend +# x00: 00000003 {{[0-9]+}} R_M680x0_GOTPCREL8 {{[0-9]*}} dst + 1 +# x00: 00000006 {{[0-9]+}} R_M680x0_GOTPCREL16 {{[0-9]*}} dst + 0 +name: DATA +body: | + bb.0: + $a0 = MOV32rk target-flags(M680x0-gotpcrel) @dst, $d0, implicit-def $ccr + $a0 = MOV32rq target-flags(M680x0-gotpcrel) @dst, implicit-def $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Relocations/data-pc-rel.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Relocations/data-pc-rel.mir @@ -0,0 +1,30 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj \ +# RUN: -code-model=small -relocation-model=pic -o - \ +# RUN: | llvm-readobj -relocations -elf-output-style=GNU - \ +# RUN: | FileCheck %s -check-prefixes=x00 + +#------------------------------------------------------------------------------ +# Tests PC-Relative data relocations +#------------------------------------------------------------------------------ + +--- | + + @dst = external global i32 + + define void @DATA() { entry: ret void } + +... +--- # DATA +# Offset Info Type Sym. Value Sym S Addend +# x00: 00000003 {{[0-9]+}} R_M680x0_PC8 {{[0-9]*}} dst + 1 +# x00: 00000006 {{[0-9]+}} R_M680x0_PC16 {{[0-9]*}} dst + 0 +# No need for relocation here +# x00-NOT: 0000000a {{[0-9]+}} R_M680x0_PC16 0 +name: DATA +body: | + bb.0: + $a0 = MOV32rk @dst, $a0, implicit-def $ccr + $a0 = MOV32rq @dst, implicit-def $ccr + $a0 = MOV32rq 0, implicit-def $ccr + +... Index: llvm/test/CodeGen/M680x0/OBJ/Relocations/text-plt.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/Relocations/text-plt.mir @@ -0,0 +1,24 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj \ +# RUN: -code-model=small -relocation-model=pic -o - \ +# RUN: | llvm-readobj -relocations -elf-output-style=GNU - \ +# RUN: | FileCheck %s -check-prefixes=x00 + +#------------------------------------------------------------------------------ +# Test PLT relocation +#------------------------------------------------------------------------------ + +--- | + + declare void @TARGET() + define void @TEXT() { entry: ret void } + +... +--- # TEXT +# Offset Info Type Sym. Value Sym S Addend +# x00: 00000002 {{[0-9a-f]+}} R_M680x0_PLT16 {{[0-9]*}} TARGET + 0 +name: TEXT +body: | + bb.0: + CALLq target-flags(M680x0-plt) @TARGET + +... Index: llvm/test/CodeGen/M680x0/OBJ/ShiftRotate/Classes/MxSR_DD.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/ShiftRotate/Classes/MxSR_DD.mir @@ -0,0 +1,41 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=SHL8dd,SHL32dd,LSR8dd,LSR32dd,ASR8dd,ASR32dd,\ +# RUN:ROL8dd,ROL32dd,ROR8dd,ROR32dd + +#------------------------------------------------------------------------------ +# MxSR_DD encodes shift or rotate instructions; shift count is in register +#------------------------------------------------------------------------------ + +# ---------------+-----------+---+-------+---+-------+----------- +# F E D C | B A 9 | 8 | 7 6 | 5 | 4 3 | 2 1 0 +# ---------------+-----------+---+-------+---+-------+----------- +# 1 1 1 0 | Dx | D | SIZE | 1 | OP | Dy +# ---------------+-----------+---+-------+---+-------+----------- +# SHL8dd: 1 1 1 0 0 0 0 1 . 0 0 1 0 1 0 0 1 +# SHL32dd-SAME: 1 1 1 0 0 0 1 1 . 1 0 1 0 1 0 1 0 +# ---------------+-----------+---+-------+---+-------+----------- +# LSR8dd-SAME: 1 1 1 0 0 1 0 0 . 0 0 1 0 1 0 1 1 +# LSR32dd-SAME: 1 1 1 0 0 1 1 0 . 1 0 1 0 1 1 0 0 +# ---------------+-----------+---+-------+---+-------+----------- +# ASR8dd-SAME: 1 1 1 0 1 0 0 0 . 0 0 1 0 0 1 0 1 +# ASR32dd-SAME: 1 1 1 0 1 0 1 0 . 1 0 1 0 0 1 1 0 +# ---------------+-----------+---+-------+---+-------+----------- +# ROL8dd-SAME: 1 1 1 0 1 1 0 1 . 0 0 1 1 1 1 1 1 +# ROL32dd-SAME: 1 1 1 0 1 1 1 1 . 1 0 1 1 1 0 0 1 +# ---------------+-----------+---+-------+---+-------+----------- +# ROR8dd-SAME: 1 1 1 0 0 0 0 0 . 0 0 1 1 1 0 0 1 +# ROR32dd-SAME: 1 1 1 0 0 0 0 0 . 1 0 1 1 1 0 0 1 +name: MxSR_DD +body: | + bb.0: + $bd1 = SHL8dd $bd1, $bd0, implicit-def $ccr + $d2 = SHL32dd $d2, $d1, implicit-def $ccr + $bd3 = LSR8dd $bd3, $bd2, implicit-def $ccr + $d4 = LSR32dd $d4, $d3, implicit-def $ccr + $bd5 = ASR8dd $bd5, $bd4, implicit-def $ccr + $d6 = ASR32dd $d6, $d5, implicit-def $ccr + $bd7 = ROL8dd $bd7, $bd6, implicit-def $ccr + $d1 = ROL32dd $d1, $d7, implicit-def $ccr + $bd1 = ROR8dd $bd1, $bd0, implicit-def $ccr + $d1 = ROR32dd $d1, $d0, implicit-def $ccr Index: llvm/test/CodeGen/M680x0/OBJ/ShiftRotate/Classes/MxSR_DI.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/OBJ/ShiftRotate/Classes/MxSR_DI.mir @@ -0,0 +1,56 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=obj -o - \ +# RUN: | extract-section .text \ +# RUN: | FileCheck %s -check-prefixes=SHL8di,SHL32di,LSR8di,LSR32di,ASR8di,ASR32di,\ +# RUN:ROL8di,ROL32di,ROR8di,ROR32di + +#------------------------------------------------------------------------------ +# MxSR_DI encodes shift or rotate instructions; shift count is encoded into +# the instruction +#------------------------------------------------------------------------------ + +# ---------------+-----------+---+-------+---+-------+----------- +# F E D C | B A 9 | 8 | 7 6 | 5 | 4 3 | 2 1 0 +# ---------------+-----------+---+-------+---+-------+----------- +# 1 1 1 0 | Dx | D | SIZE | 0 | OP | Dy +# ---------------+-----------+---+-------+---+-------+----------- +# SHL8di: 1 1 1 0 0 0 1 1 . 0 0 0 0 1 0 0 1 +# SHL32di-SAME: 1 1 1 0 0 0 1 1 . 1 0 0 0 1 0 0 1 +# ---------------+-----------+---+-------+---+-------+----------- +# LSR8di-SAME: 1 1 1 0 0 0 1 0 . 0 0 0 0 1 0 0 1 +# LSR32di-SAME: 1 1 1 0 0 0 1 0 . 1 0 0 0 1 0 0 1 +# ---------------+-----------+---+-------+---+-------+----------- +# ASR8di-SAME: 1 1 1 0 0 0 1 0 . 0 0 0 0 0 0 0 1 +# ASR32di-SAME: 1 1 1 0 0 0 1 0 . 1 0 0 0 0 0 0 1 +# ---------------+-----------+---+-------+---+-------+----------- +# ROL8di-SAME: 1 1 1 0 0 0 1 1 . 0 0 0 1 1 0 0 1 +# ROL32di-SAME: 1 1 1 0 0 0 1 1 . 1 0 0 1 1 0 0 1 +# ---------------+-----------+---+-------+---+-------+----------- +# ROR8di-SAME: 1 1 1 0 0 0 1 0 . 0 0 0 1 1 0 0 1 +# ROR32di-SAME: 1 1 1 0 0 0 1 0 . 1 0 0 1 1 0 0 1 +# ROR32di-SAME: 1 1 1 0 0 1 0 0 . 1 0 0 1 1 0 0 1 +# ROR32di-SAME: 1 1 1 0 0 1 1 0 . 1 0 0 1 1 0 0 1 +# ROR32di-SAME: 1 1 1 0 1 0 0 0 . 1 0 0 1 1 0 0 1 +# ROR32di-SAME: 1 1 1 0 1 0 1 0 . 1 0 0 1 1 0 0 1 +# ROR32di-SAME: 1 1 1 0 1 1 0 0 . 1 0 0 1 1 0 0 1 +# ROR32di-SAME: 1 1 1 0 1 1 1 0 . 1 0 0 1 1 0 0 1 +# ROR32di-SAME: 1 1 1 0 0 0 0 0 . 1 0 0 1 1 0 0 1 +name: MxSR_DI +body: | + bb.0: + $bd1 = SHL8di $bd1, 1, implicit-def $ccr + $d1 = SHL32di $d1, 1, implicit-def $ccr + $bd1 = LSR8di $bd1, 1, implicit-def $ccr + $d1 = LSR32di $d1, 1, implicit-def $ccr + $bd1 = ASR8di $bd1, 1, implicit-def $ccr + $d1 = ASR32di $d1, 1, implicit-def $ccr + $bd1 = ROL8di $bd1, 1, implicit-def $ccr + $d1 = ROL32di $d1, 1, implicit-def $ccr + $bd1 = ROR8di $bd1, 1, implicit-def $ccr + $d1 = ROR32di $d1, 1, implicit-def $ccr + $d1 = ROR32di $d1, 2, implicit-def $ccr + $d1 = ROR32di $d1, 3, implicit-def $ccr + $d1 = ROR32di $d1, 4, implicit-def $ccr + $d1 = ROR32di $d1, 5, implicit-def $ccr + $d1 = ROR32di $d1, 6, implicit-def $ccr + $d1 = ROR32di $d1, 7, implicit-def $ccr + $d1 = ROR32di $d1, 8, implicit-def $ccr Index: llvm/test/CodeGen/M680x0/PAS/CollapseMOVEM.mir =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/PAS/CollapseMOVEM.mir @@ -0,0 +1,162 @@ +# RUN: llc %s -mtriple=m680x0 -start-after=prologepilog -O0 -filetype=asm -o - \ +# RUN: | FileCheck %s -check-prefixes=x00 + +#------------------------------------------------------------------------------ +# CollapseMOVEM pass finds sequences of MOVEM instructions and collapse them +# into a single instruciton with merged masks. This only works with stack data +#------------------------------------------------------------------------------ + +--- # CollapseMOVEM_RM +# +# x00-LABEL: CollapseMOVEM_RM +# x00: movem.l (0,%sp), %d0-%d2,%d7,%a1-%a3,%a5 +name: CollapseMOVEM_RM +body: | + bb.0: + MOVM32mp 1, 0, $sp + MOVM32mp 2, 4, $sp + MOVM32mp 4, 8, $sp + MOVM32mp 128, 12, $sp + MOVM32mp 512, 16, $sp + MOVM32mp 1024, 20, $sp + MOVM32mp 2048, 24, $sp + MOVM32mp 8192, 28, $sp + +... +# +# x00-LABEL: CollapseMOVEM_RM_Reversed +# x00: movem.l (0,%sp), %d0-%d2,%d7,%a1-%a3,%a5 +name: CollapseMOVEM_RM_Reversed +body: | + bb.0: + MOVM32mp 8192, 28, $sp + MOVM32mp 2048, 24, $sp + MOVM32mp 1024, 20, $sp + MOVM32mp 512, 16, $sp + MOVM32mp 128, 12, $sp + MOVM32mp 4, 8, $sp + MOVM32mp 2, 4, $sp + MOVM32mp 1, 0, $sp + +... +# This async reg/mem order is impossible to store with MOVEM +# x00-LABEL: CollapseMOVEM_RM_ReversedStoreOrder +# x00: movem.l (0,%sp), %a5 +# x00: movem.l (4,%sp), %a3 +# x00: movem.l (8,%sp), %a2 +# x00: movem.l (12,%sp), %a1 +# x00: movem.l (16,%sp), %d7 +# x00: movem.l (20,%sp), %d2 +# x00: movem.l (24,%sp), %d1 +# x00: movem.l (28,%sp), %d0 +name: CollapseMOVEM_RM_ReversedStoreOrder +body: | + bb.0: + MOVM32mp 8192, 0, $sp + MOVM32mp 2048, 4, $sp + MOVM32mp 1024, 8, $sp + MOVM32mp 512, 12, $sp + MOVM32mp 128, 16, $sp + MOVM32mp 4, 20, $sp + MOVM32mp 2, 24, $sp + MOVM32mp 1, 28, $sp + +... +--- # CollapseMOVEM_MR +# +# x00-LABEL: CollapseMOVEM_MR +# x00: movem.l %d0-%d2,%d7,%a1-%a3,%a5, (0,%sp) +name: CollapseMOVEM_MR +body: | + bb.0: + MOVM32pm 0, $sp, 1 + MOVM32pm 4, $sp, 2 + MOVM32pm 8, $sp, 4 + MOVM32pm 12, $sp, 128 + MOVM32pm 16, $sp, 512 + MOVM32pm 20, $sp, 1024 + MOVM32pm 24, $sp, 2048 + MOVM32pm 28, $sp, 8192 + +... +--- # CollapseMOVEM_Mixed +# +# x00-LABEL: CollapseMOVEM_Mixed +# x00: movem.l %d0-%d1, (0,%sp) +# x00: movem.l (8,%sp), %d2,%d7 +# x00: movem.l %a1-%a2, (16,%sp) +# x00: movem.l (24,%sp), %a3 +# x00: movem.l %a5, (28,%sp) +name: CollapseMOVEM_Mixed +body: | + bb.0: + MOVM32pm 0, $sp, 1 + MOVM32pm 4, $sp, 2 + MOVM32mp 4, 8, $sp + MOVM32mp 128, 12, $sp + MOVM32pm 16, $sp, 512 + MOVM32pm 20, $sp, 1024 + MOVM32mp 2048, 24, $sp + MOVM32pm 28, $sp, 8192 + +... +--- # CollapseMOVEM_Zero +# +# x00-LABEL: CollapseMOVEM_Zero +# x00: movem.l %d0-%d4, (-8,%sp) +name: CollapseMOVEM_Zero +body: | + bb.0: + MOVM32pm -8, $sp, 1 + MOVM32pm -4, $sp, 2 + MOVM32pm 0, $sp, 4 + MOVM32pm 4, $sp, 8 + MOVM32pm 8, $sp, 16 + +... +# +# x00-LABEL: CollapseMOVEM_Zero_Mixed +# x00: movem.l %d3, (4,%sp) +# x00: movem.l %d0-%d2, (-8,%sp) +# x00: movem.l %d4, (8,%sp) +name: CollapseMOVEM_Zero_Mixed +body: | + bb.0: + MOVM32pm 4, $sp, 8 + MOVM32pm -4, $sp, 2 + MOVM32pm -8, $sp, 1 + MOVM32pm 0, $sp, 4 + MOVM32pm 8, $sp, 16 + +... +--- # CollapseMOVEM_Zero_Reversed +# +# x00-LABEL: CollapseMOVEM_Zero_Reversed +# x00: movem.l %d0-%d4, (-8,%sp) +name: CollapseMOVEM_Zero_Reversed +body: | + bb.0: + MOVM32pm 8, $sp, 16 + MOVM32pm 4, $sp, 8 + MOVM32pm 0, $sp, 4 + MOVM32pm -4, $sp, 2 + MOVM32pm -8, $sp, 1 + +... +# +# x00-LABEL: CollapseMOVEM_Zero_ReversedStoreOrder +# x00: movem.l %d0, (8,%sp) +# x00: movem.l %d1, (4,%sp) +# x00: movem.l %d2, (0,%sp) +# x00: movem.l %d3, (-4,%sp) +# x00: movem.l %d4, (-8,%sp) +name: CollapseMOVEM_Zero_ReversedStoreOrder +body: | + bb.0: + MOVM32pm 8, $sp, 1 + MOVM32pm 4, $sp, 2 + MOVM32pm 0, $sp, 4 + MOVM32pm -4, $sp, 8 + MOVM32pm -8, $sp, 16 + +... Index: llvm/test/CodeGen/M680x0/lit.local.cfg =================================================================== --- /dev/null +++ llvm/test/CodeGen/M680x0/lit.local.cfg @@ -0,0 +1,11 @@ +import os + +config.suffixes = ['.ll', '.mir', '.test', '.txt'] + +config.environment['PATH'] = os.pathsep.join( + [os.path.join(config.llvm_src_root, 'utils')] + + [config.environment.get('PATH')]) + +if not 'M680x0' in config.root.targets: + config.unsupported = True + Index: llvm/utils/extract-section =================================================================== --- /dev/null +++ llvm/utils/extract-section @@ -0,0 +1,38 @@ +#!/bin/bash + +#------------------------------------------------------------------------------- +# Extract Section +# +# Read object file from stdin, extract named section and print its bit-pattern +#------------------------------------------------------------------------------- + +SECTION="\s$1"; shift; +BASE=${1:-'-b'}; + +DIR=/tmp/extract-section +TEMP=$DIR/$(uuidgen).o + +[ -d $DIR ] || mkdir $DIR + +cat > $TEMP + +if [[ $BASE == '-b' ]]; then +llvm-readobj -elf-output-style=GNU --sections $TEMP \ + | grep $SECTION \ + | awk '{print "dd if='$TEMP' bs=1 count=$[0x" $7 "] skip=$[0x" $6 "]"}' \ + | bash 2> /dev/null \ + | xxd -bits -groupsize 0 \ + | cut -d " " -f 2 \ + | tr -d "\n" \ + | fold -w8 | paste -sd'.' - \ + | fold -w1 | paste -sd' ' - +elif [[ $BASE == '-h' ]]; then +llvm-readobj -elf-output-style=GNU --sections $TEMP \ + | grep $SECTION \ + | awk '{print "dd if='$TEMP' bs=1 count=$[0x" $7 "] skip=$[0x" $6 "]"}' \ + | bash 2> /dev/null \ + | xxd -p \ + | fold -w4 | paste -sd' ' - +fi + +rm $TEMP