This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static const uint8_t reverse_lookup[16] = { | |
0x0, 0x8, 0x4, 0xc, 0x2, 0xa, 0x6, 0xe, | |
0x1, 0x9, 0x5, 0xd, 0x3, 0xb, 0x7, 0xf, | |
}; | |
uint8_t reverse_bits(uint8_t n) | |
{ | |
return (reverse_lookup[n & 0xf] << 4) | reverse_lookup[n >> 4]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ | |
|* *| | |
|* DAG Instruction Selector for the MSP430 target *| | |
|* *| | |
|* Automatically generated file, do not edit! *| | |
|* *| | |
\*===----------------------------------------------------------------------===*/ | |
// *** NOTE: This file is #included into the middle of the target | |
// *** instruction selector class. These functions are really methods. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
target triple = "msp430-none-elf" | |
@bar = global i32 0, align 2 | |
define void @foo() { | |
start: | |
%0 = load i32, i32* @bar, align 2 | |
%1 = add i32 %0, 1 | |
store i32 %1, i32* @bar, align 2 | |
ret void |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/Target/MSP430/MSP430InstrInfo.td b/lib/Target/MSP430/MSP430InstrInfo.td | |
index cec43040f60..44869e78649 100644 | |
--- a/lib/Target/MSP430/MSP430InstrInfo.td | |
+++ b/lib/Target/MSP430/MSP430InstrInfo.td | |
@@ -1178,6 +1178,8 @@ def : Pat<(store (addc (load addr:$dst), GR16:$src), addr:$dst), | |
(ADD16mr addr:$dst, GR16:$src)>; | |
def : Pat<(store (addc (load addr:$dst), (i16 (load addr:$src))), addr:$dst), | |
(ADD16mm addr:$dst, addr:$src)>; | |
+def : Pat<(store (addc (load addr:$dst), (i16 imm:$src)), addr:$dst), | |
+ (ADD16mi addr:$dst, imm:$src)>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//===-- MSP430InstrInfo.td - MSP430 Instruction defs -------*- tablegen -*-===// | |
// | |
// The LLVM Compiler Infrastructure | |
// | |
// This file is distributed under the University of Illinois Open Source | |
// License. See LICENSE.TXT for details. | |
// | |
//===----------------------------------------------------------------------===// | |
// | |
// This file describes the MSP430 instructions in TableGen format. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./llvm-build/bin/llc func.ll -debug-only=isel | |
=== foo | |
Initial selection DAG: BB#0 'foo:start' | |
SelectionDAG has 9 nodes: | |
t2: i16 = Constant<0> | |
t0: ch = EntryToken | |
t4: i32,ch = load<LD4[@bar](align=2)(dereferenceable)> t0, GlobalAddress:i16<i32* @bar> 0, undef:i16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate core; | |
use core::default::Default; | |
use core::sync::atomic::{AtomicUsize, Ordering}; | |
use core::cell::UnsafeCell; | |
const RING_SIZE: usize = 32; | |
pub struct Ring<T: Clone + Copy> { | |
head: AtomicUsize, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ring.h" | |
int ring_add(ring_t *ring, ring_data_t data) | |
{ | |
ring_pos_t next_head = (ring->head + 1) % RING_SIZE; | |
if (next_head != ring->tail) { | |
ring->data[ring->head] = data; | |
ring->head = next_head; | |
return 0; | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::str; | |
use std::process; | |
use std::fs::File; | |
use std::io::{BufRead, BufReader}; | |
use std::collections::HashMap; | |
fn main() { | |
let mut args = std::env::args(); | |
if args.len() < 4 { | |
let prog = args.next().unwrap(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From b239677c8dd4a574ab7407a4a2539d3f15857c91 Mon Sep 17 00:00:00 2001 | |
From: Vadzim Dambrouski <[email protected]> | |
Date: Thu, 18 May 2017 20:51:55 +0300 | |
Subject: [PATCH] [MSP430] Add subtarget features for hardware multiplier. | |
--- | |
lib/Target/MSP430/MSP430.td | 15 ++++++++++++++- | |
lib/Target/MSP430/MSP430ISelLowering.cpp | 27 +++------------------------ | |
lib/Target/MSP430/MSP430Subtarget.cpp | 27 ++++++++++++++++++++++++++- | |
lib/Target/MSP430/MSP430Subtarget.h | 11 +++++++++++ |