Skip to content

Instantly share code, notes, and snippets.

View phire's full-sized avatar

Scott Mansell phire

View GitHub Profile
@phire
phire / gist:2757608
Created May 20, 2012 10:31
conditional/unconditional jump weirdness
phire@Osiris:~/projects/funwithtemplates$ cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
driver: acpi-cpufreq
CPUs which run at the same hardware frequency: 0 1
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 10.0 us.
hardware limits: 800 MHz - 1.30 GHz
available frequency steps: 1.30 GHz, 1.20 GHz, 800 MHz
@phire
phire / test.cpp
Last active December 16, 2015 06:49
#include <stdio.h>
typedef union mytype {
const char *string;
int num;
mytype(int n) : num(n) {}
mytype(const char *n) : string(n) {}
} mytype;
#include <stdio.h>
#include "typelist.h"
using namespace iatsbg;
// This whole thing would be a lot cleaner if c++ had a static if
#define ADD_RETURN_TYPE(type) \
template<typename T> static T cast(type); \
template<> type cast(type val) { return val; }
@phire
phire / input.c
Created July 15, 2013 14:56
Videocore llvm conditionals test
int main()
{
unsigned int a = 0;
int b = 1;
int c = 2;
int d = 3;
int e = 4;
int f = 5;
int g = 6;
int h = 7;
@phire
phire / gist:6127686
Created August 1, 2013 01:12
llvm based assembler WIP
phire@osiris:~/projects/llvm/build$ ./bin/llvm-mc ch3.s -arch=videocore
.text
.file "ch3.ll"
.globl main
.align 4
.type main,@function
main:
@phire
phire / gist:6133846
Created August 1, 2013 18:21
llvm disassembler test
phire@osiris:~/projects/llvm/build$ echo "0x30 0x60 0x20 0xa3 0xfc 0xcf 0x5a 0x00" | bin/llvm-mc -disassemble -arch=videocore
.text
mov r0, 3
st r0, (r27-4)
blr
mov vpm, qpu_num
mov vpm, elem_num
# Configure vpm write to memory
ldi vw_setup, vw_setup0(2, 16)
ldi vw_setup, vw_setup1(0, 0)
# Trigger transfer to destination in memory (address is from uniforms)
nop; mov vw_addr, unif
.global entry
entry:
nop
nop
mov r0, vary; mov r3.8d, 1.0
add rb0, r0, r5; mov r1, vary
add rb1, r1, r5; mov r2, vary
add rb2, r2, r5; mov r3.8a, rb0
nop; mov r3.8b, rb1
@phire
phire / Makefile
Created August 12, 2014 04:37
segfault benchmark.
benchmark: main.cpp
g++ main.cpp -O3 -g -std=c++11 -o benchmark
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include <algorithm>
#include <deque>
#include "Core/PowerPC/Pipeline.h"
#include "Core/PowerPC/PPCTables.h"