id
int32 0
27.3k
| func
stringlengths 26
142k
| target
bool 2
classes | project
stringclasses 2
values | commit_id
stringlengths 40
40
| func_clean
stringlengths 26
131k
| vul_lines
dict | normalized_func
stringlengths 24
132k
| lines
sequencelengths 1
2.8k
| label
sequencelengths 1
2.8k
| line_no
sequencelengths 1
2.8k
|
---|---|---|---|---|---|---|---|---|---|---|
1,479 | static void boston_mach_init(MachineState *machine)
{
DeviceState *dev;
BostonState *s;
Error *err = NULL;
const char *cpu_model;
MemoryRegion *flash, *ddr, *ddr_low_alias, *lcd, *platreg;
MemoryRegion *sys_mem = get_system_memory();
XilinxPCIEHost *pcie2;
PCIDevice *ahci;
DriveInfo *hd[6];
Chardev *chr;
int fw_size, fit_err;
bool is_64b;
if ((machine->ram_size % G_BYTE) ||
(machine->ram_size > (2 * G_BYTE))) {
error_report("Memory size must be 1GB or 2GB");
exit(1);
}
cpu_model = machine->cpu_model ?: "I6400";
dev = qdev_create(NULL, TYPE_MIPS_BOSTON);
qdev_init_nofail(dev);
s = BOSTON(dev);
s->mach = machine;
s->cps = g_new0(MIPSCPSState, 1);
if (!cpu_supports_cps_smp(cpu_model)) {
error_report("Boston requires CPUs which support CPS");
exit(1);
}
is_64b = cpu_supports_isa(cpu_model, ISA_MIPS64);
object_initialize(s->cps, sizeof(MIPSCPSState), TYPE_MIPS_CPS);
qdev_set_parent_bus(DEVICE(s->cps), sysbus_get_default());
object_property_set_str(OBJECT(s->cps), cpu_model, "cpu-model", &err);
object_property_set_int(OBJECT(s->cps), smp_cpus, "num-vp", &err);
object_property_set_bool(OBJECT(s->cps), true, "realized", &err);
if (err != NULL) {
error_report("%s", error_get_pretty(err));
exit(1);
}
sysbus_mmio_map_overlap(SYS_BUS_DEVICE(s->cps), 0, 0, 1);
flash = g_new(MemoryRegion, 1);
memory_region_init_rom_device(flash, NULL, &boston_flash_ops, s,
"boston.flash", 128 * M_BYTE, &err);
memory_region_add_subregion_overlap(sys_mem, 0x18000000, flash, 0);
ddr = g_new(MemoryRegion, 1);
memory_region_allocate_system_memory(ddr, NULL, "boston.ddr",
machine->ram_size);
memory_region_add_subregion_overlap(sys_mem, 0x80000000, ddr, 0);
ddr_low_alias = g_new(MemoryRegion, 1);
memory_region_init_alias(ddr_low_alias, NULL, "boston_low.ddr",
ddr, 0, MIN(machine->ram_size, (256 * M_BYTE)));
memory_region_add_subregion_overlap(sys_mem, 0, ddr_low_alias, 0);
xilinx_pcie_init(sys_mem, 0,
0x10000000, 32 * M_BYTE,
0x40000000, 1 * G_BYTE,
get_cps_irq(s->cps, 2), false);
xilinx_pcie_init(sys_mem, 1,
0x12000000, 32 * M_BYTE,
0x20000000, 512 * M_BYTE,
get_cps_irq(s->cps, 1), false);
pcie2 = xilinx_pcie_init(sys_mem, 2,
0x14000000, 32 * M_BYTE,
0x16000000, 1 * M_BYTE,
get_cps_irq(s->cps, 0), true);
platreg = g_new(MemoryRegion, 1);
memory_region_init_io(platreg, NULL, &boston_platreg_ops, s,
"boston-platregs", 0x1000);
memory_region_add_subregion_overlap(sys_mem, 0x17ffd000, platreg, 0);
if (!serial_hds[0]) {
serial_hds[0] = qemu_chr_new("serial0", "null");
}
s->uart = serial_mm_init(sys_mem, 0x17ffe000, 2,
get_cps_irq(s->cps, 3), 10000000,
serial_hds[0], DEVICE_NATIVE_ENDIAN);
lcd = g_new(MemoryRegion, 1);
memory_region_init_io(lcd, NULL, &boston_lcd_ops, s, "boston-lcd", 0x8);
memory_region_add_subregion_overlap(sys_mem, 0x17fff000, lcd, 0);
chr = qemu_chr_new("lcd", "vc:320x240");
qemu_chr_fe_init(&s->lcd_display, chr, NULL);
qemu_chr_fe_set_handlers(&s->lcd_display, NULL, NULL,
boston_lcd_event, s, NULL, true);
ahci = pci_create_simple_multifunction(&PCI_BRIDGE(&pcie2->root)->sec_bus,
PCI_DEVFN(0, 0),
true, TYPE_ICH9_AHCI);
g_assert(ARRAY_SIZE(hd) == ICH_AHCI(ahci)->ahci.ports);
ide_drive_get(hd, ICH_AHCI(ahci)->ahci.ports);
ahci_ide_create_devs(ahci, hd);
if (machine->firmware) {
fw_size = load_image_targphys(machine->firmware,
0x1fc00000, 4 * M_BYTE);
if (fw_size == -1) {
error_printf("unable to load firmware image '%s'\n",
machine->firmware);
exit(1);
}
} else if (machine->kernel_filename) {
fit_err = load_fit(&boston_fit_loader, machine->kernel_filename, s);
if (fit_err) {
error_printf("unable to load FIT image\n");
exit(1);
}
gen_firmware(memory_region_get_ram_ptr(flash) + 0x7c00000,
s->kernel_entry, s->fdt_base, is_64b);
} else if (!qtest_enabled()) {
error_printf("Please provide either a -kernel or -bios argument\n");
exit(1);
}
}
| true | qemu | 2d896b454a0e19ec4c1ddbb0e0b65b7e54fcedf3 | static void boston_mach_init(MachineState *machine)
{
DeviceState *dev;
BostonState *s;
Error *err = NULL;
const char *cpu_model;
MemoryRegion *flash, *ddr, *ddr_low_alias, *lcd, *platreg;
MemoryRegion *sys_mem = get_system_memory();
XilinxPCIEHost *pcie2;
PCIDevice *ahci;
DriveInfo *hd[6];
Chardev *chr;
int fw_size, fit_err;
bool is_64b;
if ((machine->ram_size % G_BYTE) ||
(machine->ram_size > (2 * G_BYTE))) {
error_report("Memory size must be 1GB or 2GB");
exit(1);
}
cpu_model = machine->cpu_model ?: "I6400";
dev = qdev_create(NULL, TYPE_MIPS_BOSTON);
qdev_init_nofail(dev);
s = BOSTON(dev);
s->mach = machine;
s->cps = g_new0(MIPSCPSState, 1);
if (!cpu_supports_cps_smp(cpu_model)) {
error_report("Boston requires CPUs which support CPS");
exit(1);
}
is_64b = cpu_supports_isa(cpu_model, ISA_MIPS64);
object_initialize(s->cps, sizeof(MIPSCPSState), TYPE_MIPS_CPS);
qdev_set_parent_bus(DEVICE(s->cps), sysbus_get_default());
object_property_set_str(OBJECT(s->cps), cpu_model, "cpu-model", &err);
object_property_set_int(OBJECT(s->cps), smp_cpus, "num-vp", &err);
object_property_set_bool(OBJECT(s->cps), true, "realized", &err);
if (err != NULL) {
error_report("%s", error_get_pretty(err));
exit(1);
}
sysbus_mmio_map_overlap(SYS_BUS_DEVICE(s->cps), 0, 0, 1);
flash = g_new(MemoryRegion, 1);
memory_region_init_rom_device(flash, NULL, &boston_flash_ops, s,
"boston.flash", 128 * M_BYTE, &err);
memory_region_add_subregion_overlap(sys_mem, 0x18000000, flash, 0);
ddr = g_new(MemoryRegion, 1);
memory_region_allocate_system_memory(ddr, NULL, "boston.ddr",
machine->ram_size);
memory_region_add_subregion_overlap(sys_mem, 0x80000000, ddr, 0);
ddr_low_alias = g_new(MemoryRegion, 1);
memory_region_init_alias(ddr_low_alias, NULL, "boston_low.ddr",
ddr, 0, MIN(machine->ram_size, (256 * M_BYTE)));
memory_region_add_subregion_overlap(sys_mem, 0, ddr_low_alias, 0);
xilinx_pcie_init(sys_mem, 0,
0x10000000, 32 * M_BYTE,
0x40000000, 1 * G_BYTE,
get_cps_irq(s->cps, 2), false);
xilinx_pcie_init(sys_mem, 1,
0x12000000, 32 * M_BYTE,
0x20000000, 512 * M_BYTE,
get_cps_irq(s->cps, 1), false);
pcie2 = xilinx_pcie_init(sys_mem, 2,
0x14000000, 32 * M_BYTE,
0x16000000, 1 * M_BYTE,
get_cps_irq(s->cps, 0), true);
platreg = g_new(MemoryRegion, 1);
memory_region_init_io(platreg, NULL, &boston_platreg_ops, s,
"boston-platregs", 0x1000);
memory_region_add_subregion_overlap(sys_mem, 0x17ffd000, platreg, 0);
if (!serial_hds[0]) {
serial_hds[0] = qemu_chr_new("serial0", "null");
}
s->uart = serial_mm_init(sys_mem, 0x17ffe000, 2,
get_cps_irq(s->cps, 3), 10000000,
serial_hds[0], DEVICE_NATIVE_ENDIAN);
lcd = g_new(MemoryRegion, 1);
memory_region_init_io(lcd, NULL, &boston_lcd_ops, s, "boston-lcd", 0x8);
memory_region_add_subregion_overlap(sys_mem, 0x17fff000, lcd, 0);
chr = qemu_chr_new("lcd", "vc:320x240");
qemu_chr_fe_init(&s->lcd_display, chr, NULL);
qemu_chr_fe_set_handlers(&s->lcd_display, NULL, NULL,
boston_lcd_event, s, NULL, true);
ahci = pci_create_simple_multifunction(&PCI_BRIDGE(&pcie2->root)->sec_bus,
PCI_DEVFN(0, 0),
true, TYPE_ICH9_AHCI);
g_assert(ARRAY_SIZE(hd) == ICH_AHCI(ahci)->ahci.ports);
ide_drive_get(hd, ICH_AHCI(ahci)->ahci.ports);
ahci_ide_create_devs(ahci, hd);
if (machine->firmware) {
fw_size = load_image_targphys(machine->firmware,
0x1fc00000, 4 * M_BYTE);
if (fw_size == -1) {
error_printf("unable to load firmware image '%s'\n",
machine->firmware);
exit(1);
}
} else if (machine->kernel_filename) {
fit_err = load_fit(&boston_fit_loader, machine->kernel_filename, s);
if (fit_err) {
error_printf("unable to load FIT image\n");
exit(1);
}
gen_firmware(memory_region_get_ram_ptr(flash) + 0x7c00000,
s->kernel_entry, s->fdt_base, is_64b);
} else if (!qtest_enabled()) {
error_printf("Please provide either a -kernel or -bios argument\n");
exit(1);
}
}
| {
"code": [
" DeviceState *dev;",
" qdev_init_nofail(dev);",
"static void boston_mach_init(MachineState *machine)",
" DeviceState *dev;",
" BostonState *s;",
" Error *err = NULL;",
" const char *cpu_model;",
" MemoryRegion *flash, *ddr, *ddr_low_alias, *lcd, *platreg;",
" MemoryRegion *sys_mem = get_system_memory();",
" XilinxPCIEHost *pcie2;",
" PCIDevice *ahci;",
" DriveInfo *hd[6];",
" Chardev *chr;",
" int fw_size, fit_err;",
" bool is_64b;",
" if ((machine->ram_size % G_BYTE) ||",
" (machine->ram_size > (2 * G_BYTE))) {",
" error_report(\"Memory size must be 1GB or 2GB\");",
" exit(1);",
" cpu_model = machine->cpu_model ?: \"I6400\";",
" dev = qdev_create(NULL, TYPE_MIPS_BOSTON);",
" qdev_init_nofail(dev);",
" s = BOSTON(dev);",
" s->mach = machine;",
" s->cps = g_new0(MIPSCPSState, 1);",
" if (!cpu_supports_cps_smp(cpu_model)) {",
" error_report(\"Boston requires CPUs which support CPS\");",
" exit(1);",
" is_64b = cpu_supports_isa(cpu_model, ISA_MIPS64);",
" object_initialize(s->cps, sizeof(MIPSCPSState), TYPE_MIPS_CPS);",
" qdev_set_parent_bus(DEVICE(s->cps), sysbus_get_default());",
" object_property_set_str(OBJECT(s->cps), cpu_model, \"cpu-model\", &err);",
" object_property_set_int(OBJECT(s->cps), smp_cpus, \"num-vp\", &err);",
" object_property_set_bool(OBJECT(s->cps), true, \"realized\", &err);",
" if (err != NULL) {",
" error_report(\"%s\", error_get_pretty(err));",
" exit(1);",
" sysbus_mmio_map_overlap(SYS_BUS_DEVICE(s->cps), 0, 0, 1);",
" flash = g_new(MemoryRegion, 1);",
" memory_region_init_rom_device(flash, NULL, &boston_flash_ops, s,",
" \"boston.flash\", 128 * M_BYTE, &err);",
" memory_region_add_subregion_overlap(sys_mem, 0x18000000, flash, 0);",
" ddr = g_new(MemoryRegion, 1);",
" memory_region_allocate_system_memory(ddr, NULL, \"boston.ddr\",",
" machine->ram_size);",
" memory_region_add_subregion_overlap(sys_mem, 0x80000000, ddr, 0);",
" ddr_low_alias = g_new(MemoryRegion, 1);",
" memory_region_init_alias(ddr_low_alias, NULL, \"boston_low.ddr\",",
" ddr, 0, MIN(machine->ram_size, (256 * M_BYTE)));",
" memory_region_add_subregion_overlap(sys_mem, 0, ddr_low_alias, 0);",
" xilinx_pcie_init(sys_mem, 0,",
" 0x10000000, 32 * M_BYTE,",
" 0x40000000, 1 * G_BYTE,",
" get_cps_irq(s->cps, 2), false);",
" xilinx_pcie_init(sys_mem, 1,",
" 0x12000000, 32 * M_BYTE,",
" 0x20000000, 512 * M_BYTE,",
" get_cps_irq(s->cps, 1), false);",
" pcie2 = xilinx_pcie_init(sys_mem, 2,",
" 0x14000000, 32 * M_BYTE,",
" 0x16000000, 1 * M_BYTE,",
" get_cps_irq(s->cps, 0), true);",
" platreg = g_new(MemoryRegion, 1);",
" memory_region_init_io(platreg, NULL, &boston_platreg_ops, s,",
" \"boston-platregs\", 0x1000);",
" memory_region_add_subregion_overlap(sys_mem, 0x17ffd000, platreg, 0);",
" if (!serial_hds[0]) {",
" serial_hds[0] = qemu_chr_new(\"serial0\", \"null\");",
" s->uart = serial_mm_init(sys_mem, 0x17ffe000, 2,",
" get_cps_irq(s->cps, 3), 10000000,",
" serial_hds[0], DEVICE_NATIVE_ENDIAN);",
" lcd = g_new(MemoryRegion, 1);",
" memory_region_init_io(lcd, NULL, &boston_lcd_ops, s, \"boston-lcd\", 0x8);",
" memory_region_add_subregion_overlap(sys_mem, 0x17fff000, lcd, 0);",
" chr = qemu_chr_new(\"lcd\", \"vc:320x240\");",
" qemu_chr_fe_init(&s->lcd_display, chr, NULL);",
" qemu_chr_fe_set_handlers(&s->lcd_display, NULL, NULL,",
" boston_lcd_event, s, NULL, true);",
" ahci = pci_create_simple_multifunction(&PCI_BRIDGE(&pcie2->root)->sec_bus,",
" PCI_DEVFN(0, 0),",
" true, TYPE_ICH9_AHCI);",
" g_assert(ARRAY_SIZE(hd) == ICH_AHCI(ahci)->ahci.ports);",
" ide_drive_get(hd, ICH_AHCI(ahci)->ahci.ports);",
" ahci_ide_create_devs(ahci, hd);",
" if (machine->firmware) {",
" fw_size = load_image_targphys(machine->firmware,",
" 0x1fc00000, 4 * M_BYTE);",
" if (fw_size == -1) {",
" error_printf(\"unable to load firmware image '%s'\\n\",",
" machine->firmware);",
" exit(1);",
" } else if (machine->kernel_filename) {",
" fit_err = load_fit(&boston_fit_loader, machine->kernel_filename, s);",
" if (fit_err) {",
" error_printf(\"unable to load FIT image\\n\");",
" exit(1);",
" gen_firmware(memory_region_get_ram_ptr(flash) + 0x7c00000,",
" s->kernel_entry, s->fdt_base, is_64b);",
" } else if (!qtest_enabled()) {",
" error_printf(\"Please provide either a -kernel or -bios argument\\n\");",
" exit(1);"
],
"line_no": [
5,
49,
1,
5,
7,
9,
11,
13,
15,
17,
19,
21,
23,
25,
27,
31,
33,
35,
37,
43,
47,
49,
53,
55,
57,
61,
63,
37,
71,
75,
77,
81,
83,
85,
89,
91,
37,
99,
103,
105,
107,
109,
113,
115,
117,
119,
123,
125,
127,
129,
133,
135,
137,
139,
143,
145,
147,
149,
153,
155,
157,
159,
163,
165,
167,
169,
173,
175,
181,
183,
185,
189,
191,
193,
197,
199,
201,
203,
207,
209,
211,
213,
215,
217,
221,
223,
225,
227,
229,
231,
233,
237,
239,
241,
243,
233,
251,
253,
255,
257,
37
]
} | static void FUNC_0(MachineState *VAR_0)
{
DeviceState *dev;
BostonState *s;
Error *err = NULL;
const char *VAR_1;
MemoryRegion *flash, *ddr, *ddr_low_alias, *lcd, *platreg;
MemoryRegion *sys_mem = get_system_memory();
XilinxPCIEHost *pcie2;
PCIDevice *ahci;
DriveInfo *hd[6];
Chardev *chr;
int VAR_2, VAR_3;
bool is_64b;
if ((VAR_0->ram_size % G_BYTE) ||
(VAR_0->ram_size > (2 * G_BYTE))) {
error_report("Memory size must be 1GB or 2GB");
exit(1);
}
VAR_1 = VAR_0->VAR_1 ?: "I6400";
dev = qdev_create(NULL, TYPE_MIPS_BOSTON);
qdev_init_nofail(dev);
s = BOSTON(dev);
s->mach = VAR_0;
s->cps = g_new0(MIPSCPSState, 1);
if (!cpu_supports_cps_smp(VAR_1)) {
error_report("Boston requires CPUs which support CPS");
exit(1);
}
is_64b = cpu_supports_isa(VAR_1, ISA_MIPS64);
object_initialize(s->cps, sizeof(MIPSCPSState), TYPE_MIPS_CPS);
qdev_set_parent_bus(DEVICE(s->cps), sysbus_get_default());
object_property_set_str(OBJECT(s->cps), VAR_1, "cpu-model", &err);
object_property_set_int(OBJECT(s->cps), smp_cpus, "num-vp", &err);
object_property_set_bool(OBJECT(s->cps), true, "realized", &err);
if (err != NULL) {
error_report("%s", error_get_pretty(err));
exit(1);
}
sysbus_mmio_map_overlap(SYS_BUS_DEVICE(s->cps), 0, 0, 1);
flash = g_new(MemoryRegion, 1);
memory_region_init_rom_device(flash, NULL, &boston_flash_ops, s,
"boston.flash", 128 * M_BYTE, &err);
memory_region_add_subregion_overlap(sys_mem, 0x18000000, flash, 0);
ddr = g_new(MemoryRegion, 1);
memory_region_allocate_system_memory(ddr, NULL, "boston.ddr",
VAR_0->ram_size);
memory_region_add_subregion_overlap(sys_mem, 0x80000000, ddr, 0);
ddr_low_alias = g_new(MemoryRegion, 1);
memory_region_init_alias(ddr_low_alias, NULL, "boston_low.ddr",
ddr, 0, MIN(VAR_0->ram_size, (256 * M_BYTE)));
memory_region_add_subregion_overlap(sys_mem, 0, ddr_low_alias, 0);
xilinx_pcie_init(sys_mem, 0,
0x10000000, 32 * M_BYTE,
0x40000000, 1 * G_BYTE,
get_cps_irq(s->cps, 2), false);
xilinx_pcie_init(sys_mem, 1,
0x12000000, 32 * M_BYTE,
0x20000000, 512 * M_BYTE,
get_cps_irq(s->cps, 1), false);
pcie2 = xilinx_pcie_init(sys_mem, 2,
0x14000000, 32 * M_BYTE,
0x16000000, 1 * M_BYTE,
get_cps_irq(s->cps, 0), true);
platreg = g_new(MemoryRegion, 1);
memory_region_init_io(platreg, NULL, &boston_platreg_ops, s,
"boston-platregs", 0x1000);
memory_region_add_subregion_overlap(sys_mem, 0x17ffd000, platreg, 0);
if (!serial_hds[0]) {
serial_hds[0] = qemu_chr_new("serial0", "null");
}
s->uart = serial_mm_init(sys_mem, 0x17ffe000, 2,
get_cps_irq(s->cps, 3), 10000000,
serial_hds[0], DEVICE_NATIVE_ENDIAN);
lcd = g_new(MemoryRegion, 1);
memory_region_init_io(lcd, NULL, &boston_lcd_ops, s, "boston-lcd", 0x8);
memory_region_add_subregion_overlap(sys_mem, 0x17fff000, lcd, 0);
chr = qemu_chr_new("lcd", "vc:320x240");
qemu_chr_fe_init(&s->lcd_display, chr, NULL);
qemu_chr_fe_set_handlers(&s->lcd_display, NULL, NULL,
boston_lcd_event, s, NULL, true);
ahci = pci_create_simple_multifunction(&PCI_BRIDGE(&pcie2->root)->sec_bus,
PCI_DEVFN(0, 0),
true, TYPE_ICH9_AHCI);
g_assert(ARRAY_SIZE(hd) == ICH_AHCI(ahci)->ahci.ports);
ide_drive_get(hd, ICH_AHCI(ahci)->ahci.ports);
ahci_ide_create_devs(ahci, hd);
if (VAR_0->firmware) {
VAR_2 = load_image_targphys(VAR_0->firmware,
0x1fc00000, 4 * M_BYTE);
if (VAR_2 == -1) {
error_printf("unable to load firmware image '%s'\n",
VAR_0->firmware);
exit(1);
}
} else if (VAR_0->kernel_filename) {
VAR_3 = load_fit(&boston_fit_loader, VAR_0->kernel_filename, s);
if (VAR_3) {
error_printf("unable to load FIT image\n");
exit(1);
}
gen_firmware(memory_region_get_ram_ptr(flash) + 0x7c00000,
s->kernel_entry, s->fdt_base, is_64b);
} else if (!qtest_enabled()) {
error_printf("Please provide either a -kernel or -bios argument\n");
exit(1);
}
}
| [
"static void FUNC_0(MachineState *VAR_0)\n{",
"DeviceState *dev;",
"BostonState *s;",
"Error *err = NULL;",
"const char *VAR_1;",
"MemoryRegion *flash, *ddr, *ddr_low_alias, *lcd, *platreg;",
"MemoryRegion *sys_mem = get_system_memory();",
"XilinxPCIEHost *pcie2;",
"PCIDevice *ahci;",
"DriveInfo *hd[6];",
"Chardev *chr;",
"int VAR_2, VAR_3;",
"bool is_64b;",
"if ((VAR_0->ram_size % G_BYTE) ||\n(VAR_0->ram_size > (2 * G_BYTE))) {",
"error_report(\"Memory size must be 1GB or 2GB\");",
"exit(1);",
"}",
"VAR_1 = VAR_0->VAR_1 ?: \"I6400\";",
"dev = qdev_create(NULL, TYPE_MIPS_BOSTON);",
"qdev_init_nofail(dev);",
"s = BOSTON(dev);",
"s->mach = VAR_0;",
"s->cps = g_new0(MIPSCPSState, 1);",
"if (!cpu_supports_cps_smp(VAR_1)) {",
"error_report(\"Boston requires CPUs which support CPS\");",
"exit(1);",
"}",
"is_64b = cpu_supports_isa(VAR_1, ISA_MIPS64);",
"object_initialize(s->cps, sizeof(MIPSCPSState), TYPE_MIPS_CPS);",
"qdev_set_parent_bus(DEVICE(s->cps), sysbus_get_default());",
"object_property_set_str(OBJECT(s->cps), VAR_1, \"cpu-model\", &err);",
"object_property_set_int(OBJECT(s->cps), smp_cpus, \"num-vp\", &err);",
"object_property_set_bool(OBJECT(s->cps), true, \"realized\", &err);",
"if (err != NULL) {",
"error_report(\"%s\", error_get_pretty(err));",
"exit(1);",
"}",
"sysbus_mmio_map_overlap(SYS_BUS_DEVICE(s->cps), 0, 0, 1);",
"flash = g_new(MemoryRegion, 1);",
"memory_region_init_rom_device(flash, NULL, &boston_flash_ops, s,\n\"boston.flash\", 128 * M_BYTE, &err);",
"memory_region_add_subregion_overlap(sys_mem, 0x18000000, flash, 0);",
"ddr = g_new(MemoryRegion, 1);",
"memory_region_allocate_system_memory(ddr, NULL, \"boston.ddr\",\nVAR_0->ram_size);",
"memory_region_add_subregion_overlap(sys_mem, 0x80000000, ddr, 0);",
"ddr_low_alias = g_new(MemoryRegion, 1);",
"memory_region_init_alias(ddr_low_alias, NULL, \"boston_low.ddr\",\nddr, 0, MIN(VAR_0->ram_size, (256 * M_BYTE)));",
"memory_region_add_subregion_overlap(sys_mem, 0, ddr_low_alias, 0);",
"xilinx_pcie_init(sys_mem, 0,\n0x10000000, 32 * M_BYTE,\n0x40000000, 1 * G_BYTE,\nget_cps_irq(s->cps, 2), false);",
"xilinx_pcie_init(sys_mem, 1,\n0x12000000, 32 * M_BYTE,\n0x20000000, 512 * M_BYTE,\nget_cps_irq(s->cps, 1), false);",
"pcie2 = xilinx_pcie_init(sys_mem, 2,\n0x14000000, 32 * M_BYTE,\n0x16000000, 1 * M_BYTE,\nget_cps_irq(s->cps, 0), true);",
"platreg = g_new(MemoryRegion, 1);",
"memory_region_init_io(platreg, NULL, &boston_platreg_ops, s,\n\"boston-platregs\", 0x1000);",
"memory_region_add_subregion_overlap(sys_mem, 0x17ffd000, platreg, 0);",
"if (!serial_hds[0]) {",
"serial_hds[0] = qemu_chr_new(\"serial0\", \"null\");",
"}",
"s->uart = serial_mm_init(sys_mem, 0x17ffe000, 2,\nget_cps_irq(s->cps, 3), 10000000,\nserial_hds[0], DEVICE_NATIVE_ENDIAN);",
"lcd = g_new(MemoryRegion, 1);",
"memory_region_init_io(lcd, NULL, &boston_lcd_ops, s, \"boston-lcd\", 0x8);",
"memory_region_add_subregion_overlap(sys_mem, 0x17fff000, lcd, 0);",
"chr = qemu_chr_new(\"lcd\", \"vc:320x240\");",
"qemu_chr_fe_init(&s->lcd_display, chr, NULL);",
"qemu_chr_fe_set_handlers(&s->lcd_display, NULL, NULL,\nboston_lcd_event, s, NULL, true);",
"ahci = pci_create_simple_multifunction(&PCI_BRIDGE(&pcie2->root)->sec_bus,\nPCI_DEVFN(0, 0),\ntrue, TYPE_ICH9_AHCI);",
"g_assert(ARRAY_SIZE(hd) == ICH_AHCI(ahci)->ahci.ports);",
"ide_drive_get(hd, ICH_AHCI(ahci)->ahci.ports);",
"ahci_ide_create_devs(ahci, hd);",
"if (VAR_0->firmware) {",
"VAR_2 = load_image_targphys(VAR_0->firmware,\n0x1fc00000, 4 * M_BYTE);",
"if (VAR_2 == -1) {",
"error_printf(\"unable to load firmware image '%s'\\n\",\nVAR_0->firmware);",
"exit(1);",
"}",
"} else if (VAR_0->kernel_filename) {",
"VAR_3 = load_fit(&boston_fit_loader, VAR_0->kernel_filename, s);",
"if (VAR_3) {",
"error_printf(\"unable to load FIT image\\n\");",
"exit(1);",
"}",
"gen_firmware(memory_region_get_ram_ptr(flash) + 0x7c00000,\ns->kernel_entry, s->fdt_base, is_64b);",
"} else if (!qtest_enabled()) {",
"error_printf(\"Please provide either a -kernel or -bios argument\\n\");",
"exit(1);",
"}",
"}"
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
0,
0,
1,
1,
1,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31,
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
47
],
[
49
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
71
],
[
75
],
[
77
],
[
81
],
[
83
],
[
85
],
[
89
],
[
91
],
[
93
],
[
95
],
[
99
],
[
103
],
[
105,
107
],
[
109
],
[
113
],
[
115,
117
],
[
119
],
[
123
],
[
125,
127
],
[
129
],
[
133,
135,
137,
139
],
[
143,
145,
147,
149
],
[
153,
155,
157,
159
],
[
163
],
[
165,
167
],
[
169
],
[
173
],
[
175
],
[
177
],
[
181,
183,
185
],
[
189
],
[
191
],
[
193
],
[
197
],
[
199
],
[
201,
203
],
[
207,
209,
211
],
[
213
],
[
215
],
[
217
],
[
221
],
[
223,
225
],
[
227
],
[
229,
231
],
[
233
],
[
235
],
[
237
],
[
239
],
[
241
],
[
243
],
[
245
],
[
247
],
[
251,
253
],
[
255
],
[
257
],
[
259
],
[
261
],
[
263
]
] |
1,480 | static int cng_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
AVFrame *frame = data;
CNGContext *p = avctx->priv_data;
int buf_size = avpkt->size;
int ret, i;
int16_t *buf_out;
float e = 1.0;
float scaling;
if (avpkt->size) {
int dbov = -avpkt->data[0];
p->target_energy = 1081109975 * ff_exp10(dbov / 10.0) * 0.75;
memset(p->target_refl_coef, 0, p->order * sizeof(*p->target_refl_coef));
for (i = 0; i < FFMIN(avpkt->size - 1, p->order); i++) {
p->target_refl_coef[i] = (avpkt->data[1 + i] - 127) / 128.0;
if (p->inited) {
p->energy = p->energy / 2 + p->target_energy / 2;
for (i = 0; i < p->order; i++)
p->refl_coef[i] = 0.6 *p->refl_coef[i] + 0.4 * p->target_refl_coef[i];
} else {
p->energy = p->target_energy;
memcpy(p->refl_coef, p->target_refl_coef, p->order * sizeof(*p->refl_coef));
p->inited = 1;
make_lpc_coefs(p->lpc_coef, p->refl_coef, p->order);
for (i = 0; i < p->order; i++)
e *= 1.0 - p->refl_coef[i]*p->refl_coef[i];
scaling = sqrt(e * p->energy / 1081109975);
for (i = 0; i < avctx->frame_size; i++) {
int r = (av_lfg_get(&p->lfg) & 0xffff) - 0x8000;
p->excitation[i] = scaling * r;
ff_celp_lp_synthesis_filterf(p->filter_out + p->order, p->lpc_coef,
p->excitation, avctx->frame_size, p->order);
frame->nb_samples = avctx->frame_size;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
buf_out = (int16_t *)frame->data[0];
for (i = 0; i < avctx->frame_size; i++)
buf_out[i] = p->filter_out[i + p->order];
memcpy(p->filter_out, p->filter_out + avctx->frame_size,
p->order * sizeof(*p->filter_out));
*got_frame_ptr = 1;
return buf_size; | true | FFmpeg | e7b9d136a1ba2d048b1a17df5778e426b825676d | static int cng_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
AVFrame *frame = data;
CNGContext *p = avctx->priv_data;
int buf_size = avpkt->size;
int ret, i;
int16_t *buf_out;
float e = 1.0;
float scaling;
if (avpkt->size) {
int dbov = -avpkt->data[0];
p->target_energy = 1081109975 * ff_exp10(dbov / 10.0) * 0.75;
memset(p->target_refl_coef, 0, p->order * sizeof(*p->target_refl_coef));
for (i = 0; i < FFMIN(avpkt->size - 1, p->order); i++) {
p->target_refl_coef[i] = (avpkt->data[1 + i] - 127) / 128.0;
if (p->inited) {
p->energy = p->energy / 2 + p->target_energy / 2;
for (i = 0; i < p->order; i++)
p->refl_coef[i] = 0.6 *p->refl_coef[i] + 0.4 * p->target_refl_coef[i];
} else {
p->energy = p->target_energy;
memcpy(p->refl_coef, p->target_refl_coef, p->order * sizeof(*p->refl_coef));
p->inited = 1;
make_lpc_coefs(p->lpc_coef, p->refl_coef, p->order);
for (i = 0; i < p->order; i++)
e *= 1.0 - p->refl_coef[i]*p->refl_coef[i];
scaling = sqrt(e * p->energy / 1081109975);
for (i = 0; i < avctx->frame_size; i++) {
int r = (av_lfg_get(&p->lfg) & 0xffff) - 0x8000;
p->excitation[i] = scaling * r;
ff_celp_lp_synthesis_filterf(p->filter_out + p->order, p->lpc_coef,
p->excitation, avctx->frame_size, p->order);
frame->nb_samples = avctx->frame_size;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
buf_out = (int16_t *)frame->data[0];
for (i = 0; i < avctx->frame_size; i++)
buf_out[i] = p->filter_out[i + p->order];
memcpy(p->filter_out, p->filter_out + avctx->frame_size,
p->order * sizeof(*p->filter_out));
*got_frame_ptr = 1;
return buf_size; | {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,
int *VAR_2, AVPacket *VAR_3)
{
AVFrame *frame = VAR_1;
CNGContext *p = VAR_0->priv_data;
int VAR_4 = VAR_3->size;
int VAR_5, VAR_6;
int16_t *buf_out;
float VAR_7 = 1.0;
float VAR_8;
if (VAR_3->size) {
int VAR_9 = -VAR_3->VAR_1[0];
p->target_energy = 1081109975 * ff_exp10(VAR_9 / 10.0) * 0.75;
memset(p->target_refl_coef, 0, p->order * sizeof(*p->target_refl_coef));
for (VAR_6 = 0; VAR_6 < FFMIN(VAR_3->size - 1, p->order); VAR_6++) {
p->target_refl_coef[VAR_6] = (VAR_3->VAR_1[1 + VAR_6] - 127) / 128.0;
if (p->inited) {
p->energy = p->energy / 2 + p->target_energy / 2;
for (VAR_6 = 0; VAR_6 < p->order; VAR_6++)
p->refl_coef[VAR_6] = 0.6 *p->refl_coef[VAR_6] + 0.4 * p->target_refl_coef[VAR_6];
} else {
p->energy = p->target_energy;
memcpy(p->refl_coef, p->target_refl_coef, p->order * sizeof(*p->refl_coef));
p->inited = 1;
make_lpc_coefs(p->lpc_coef, p->refl_coef, p->order);
for (VAR_6 = 0; VAR_6 < p->order; VAR_6++)
VAR_7 *= 1.0 - p->refl_coef[VAR_6]*p->refl_coef[VAR_6];
VAR_8 = sqrt(VAR_7 * p->energy / 1081109975);
for (VAR_6 = 0; VAR_6 < VAR_0->frame_size; VAR_6++) {
int r = (av_lfg_get(&p->lfg) & 0xffff) - 0x8000;
p->excitation[VAR_6] = VAR_8 * r;
ff_celp_lp_synthesis_filterf(p->filter_out + p->order, p->lpc_coef,
p->excitation, VAR_0->frame_size, p->order);
frame->nb_samples = VAR_0->frame_size;
if ((VAR_5 = ff_get_buffer(VAR_0, frame, 0)) < 0)
return VAR_5;
buf_out = (int16_t *)frame->VAR_1[0];
for (VAR_6 = 0; VAR_6 < VAR_0->frame_size; VAR_6++)
buf_out[VAR_6] = p->filter_out[VAR_6 + p->order];
memcpy(p->filter_out, p->filter_out + VAR_0->frame_size,
p->order * sizeof(*p->filter_out));
*VAR_2 = 1;
return VAR_4; | [
"static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{",
"AVFrame *frame = VAR_1;",
"CNGContext *p = VAR_0->priv_data;",
"int VAR_4 = VAR_3->size;",
"int VAR_5, VAR_6;",
"int16_t *buf_out;",
"float VAR_7 = 1.0;",
"float VAR_8;",
"if (VAR_3->size) {",
"int VAR_9 = -VAR_3->VAR_1[0];",
"p->target_energy = 1081109975 * ff_exp10(VAR_9 / 10.0) * 0.75;",
"memset(p->target_refl_coef, 0, p->order * sizeof(*p->target_refl_coef));",
"for (VAR_6 = 0; VAR_6 < FFMIN(VAR_3->size - 1, p->order); VAR_6++) {",
"p->target_refl_coef[VAR_6] = (VAR_3->VAR_1[1 + VAR_6] - 127) / 128.0;",
"if (p->inited) {",
"p->energy = p->energy / 2 + p->target_energy / 2;",
"for (VAR_6 = 0; VAR_6 < p->order; VAR_6++)",
"p->refl_coef[VAR_6] = 0.6 *p->refl_coef[VAR_6] + 0.4 * p->target_refl_coef[VAR_6];",
"} else {",
"p->energy = p->target_energy;",
"memcpy(p->refl_coef, p->target_refl_coef, p->order * sizeof(*p->refl_coef));",
"p->inited = 1;",
"make_lpc_coefs(p->lpc_coef, p->refl_coef, p->order);",
"for (VAR_6 = 0; VAR_6 < p->order; VAR_6++)",
"VAR_7 *= 1.0 - p->refl_coef[VAR_6]*p->refl_coef[VAR_6];",
"VAR_8 = sqrt(VAR_7 * p->energy / 1081109975);",
"for (VAR_6 = 0; VAR_6 < VAR_0->frame_size; VAR_6++) {",
"int r = (av_lfg_get(&p->lfg) & 0xffff) - 0x8000;",
"p->excitation[VAR_6] = VAR_8 * r;",
"ff_celp_lp_synthesis_filterf(p->filter_out + p->order, p->lpc_coef,\np->excitation, VAR_0->frame_size, p->order);",
"frame->nb_samples = VAR_0->frame_size;",
"if ((VAR_5 = ff_get_buffer(VAR_0, frame, 0)) < 0)\nreturn VAR_5;",
"buf_out = (int16_t *)frame->VAR_1[0];",
"for (VAR_6 = 0; VAR_6 < VAR_0->frame_size; VAR_6++)",
"buf_out[VAR_6] = p->filter_out[VAR_6 + p->order];",
"memcpy(p->filter_out, p->filter_out + VAR_0->frame_size,\np->order * sizeof(*p->filter_out));",
"*VAR_2 = 1;",
"return VAR_4;"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
2,
3
],
[
4
],
[
5
],
[
6
],
[
7
],
[
8
],
[
9
],
[
10
],
[
11
],
[
12
],
[
13
],
[
14
],
[
15
],
[
16
],
[
17
],
[
18
],
[
19
],
[
20
],
[
21
],
[
22
],
[
23
],
[
24
],
[
25
],
[
26
],
[
27
],
[
28
],
[
29
],
[
30
],
[
31
],
[
32,
33
],
[
34
],
[
35,
36
],
[
37
],
[
38
],
[
39
],
[
40,
41
],
[
42
],
[
43
]
] |
1,481 | static int vfio_pci_hot_reset_multi(VFIOPCIDevice *vdev)
{
return vfio_pci_hot_reset(vdev, false);
}
| false | qemu | b47d8efa9f430c332bf96ce6eede169eb48422ad | static int vfio_pci_hot_reset_multi(VFIOPCIDevice *vdev)
{
return vfio_pci_hot_reset(vdev, false);
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(VFIOPCIDevice *VAR_0)
{
return vfio_pci_hot_reset(VAR_0, false);
}
| [
"static int FUNC_0(VFIOPCIDevice *VAR_0)\n{",
"return vfio_pci_hot_reset(VAR_0, false);",
"}"
] | [
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
]
] |
1,482 | void qerror_print(QError *qerror)
{
QString *qstring = qerror_human(qerror);
loc_push_restore(&qerror->loc);
error_report("%s", qstring_get_str(qstring));
loc_pop(&qerror->loc);
QDECREF(qstring);
}
| false | qemu | 2a74440547ea0a15195224fa2b7784b267cbfe15 | void qerror_print(QError *qerror)
{
QString *qstring = qerror_human(qerror);
loc_push_restore(&qerror->loc);
error_report("%s", qstring_get_str(qstring));
loc_pop(&qerror->loc);
QDECREF(qstring);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(QError *VAR_0)
{
QString *qstring = qerror_human(VAR_0);
loc_push_restore(&VAR_0->loc);
error_report("%s", qstring_get_str(qstring));
loc_pop(&VAR_0->loc);
QDECREF(qstring);
}
| [
"void FUNC_0(QError *VAR_0)\n{",
"QString *qstring = qerror_human(VAR_0);",
"loc_push_restore(&VAR_0->loc);",
"error_report(\"%s\", qstring_get_str(qstring));",
"loc_pop(&VAR_0->loc);",
"QDECREF(qstring);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
]
] |
1,483 | static int is_async_return(const QObject *data)
{
if (data && qobject_type(data) == QTYPE_QDICT) {
return qdict_haskey(qobject_to_qdict(data), "__mon_async");
}
return 0;
}
| false | qemu | d4551293d68a1876df87400be6c71c657756d0bb | static int is_async_return(const QObject *data)
{
if (data && qobject_type(data) == QTYPE_QDICT) {
return qdict_haskey(qobject_to_qdict(data), "__mon_async");
}
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(const QObject *VAR_0)
{
if (VAR_0 && qobject_type(VAR_0) == QTYPE_QDICT) {
return qdict_haskey(qobject_to_qdict(VAR_0), "__mon_async");
}
return 0;
}
| [
"static int FUNC_0(const QObject *VAR_0)\n{",
"if (VAR_0 && qobject_type(VAR_0) == QTYPE_QDICT) {",
"return qdict_haskey(qobject_to_qdict(VAR_0), \"__mon_async\");",
"}",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
]
] |
1,484 | static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2], int is34)
{
int e, b, k, n;
float (*H11)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H11;
float (*H12)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H12;
float (*H21)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H21;
float (*H22)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H22;
int8_t *opd_hist = ps->opd_hist;
int8_t *ipd_hist = ps->ipd_hist;
int8_t iid_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
int8_t icc_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
int8_t ipd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
int8_t opd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
int8_t (*iid_mapped)[PS_MAX_NR_IIDICC] = iid_mapped_buf;
int8_t (*icc_mapped)[PS_MAX_NR_IIDICC] = icc_mapped_buf;
int8_t (*ipd_mapped)[PS_MAX_NR_IIDICC] = ipd_mapped_buf;
int8_t (*opd_mapped)[PS_MAX_NR_IIDICC] = opd_mapped_buf;
const int8_t *k_to_i = is34 ? k_to_i_34 : k_to_i_20;
const float (*H_LUT)[8][4] = (PS_BASELINE || ps->icc_mode < 3) ? HA : HB;
//Remapping
if (ps->num_env_old) {
memcpy(H11[0][0], H11[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[0][0][0]));
memcpy(H11[1][0], H11[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[1][0][0]));
memcpy(H12[0][0], H12[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[0][0][0]));
memcpy(H12[1][0], H12[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[1][0][0]));
memcpy(H21[0][0], H21[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[0][0][0]));
memcpy(H21[1][0], H21[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[1][0][0]));
memcpy(H22[0][0], H22[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[0][0][0]));
memcpy(H22[1][0], H22[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[1][0][0]));
}
if (is34) {
remap34(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1);
remap34(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1);
if (ps->enable_ipdopd) {
remap34(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0);
remap34(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0);
}
if (!ps->is34bands_old) {
map_val_20_to_34(H11[0][0]);
map_val_20_to_34(H11[1][0]);
map_val_20_to_34(H12[0][0]);
map_val_20_to_34(H12[1][0]);
map_val_20_to_34(H21[0][0]);
map_val_20_to_34(H21[1][0]);
map_val_20_to_34(H22[0][0]);
map_val_20_to_34(H22[1][0]);
ipdopd_reset(ipd_hist, opd_hist);
}
} else {
remap20(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1);
remap20(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1);
if (ps->enable_ipdopd) {
remap20(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0);
remap20(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0);
}
if (ps->is34bands_old) {
map_val_34_to_20(H11[0][0]);
map_val_34_to_20(H11[1][0]);
map_val_34_to_20(H12[0][0]);
map_val_34_to_20(H12[1][0]);
map_val_34_to_20(H21[0][0]);
map_val_34_to_20(H21[1][0]);
map_val_34_to_20(H22[0][0]);
map_val_34_to_20(H22[1][0]);
ipdopd_reset(ipd_hist, opd_hist);
}
}
//Mixing
for (e = 0; e < ps->num_env; e++) {
for (b = 0; b < NR_PAR_BANDS[is34]; b++) {
float h11, h12, h21, h22;
h11 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][0];
h12 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][1];
h21 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][2];
h22 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][3];
if (!PS_BASELINE && ps->enable_ipdopd && b < ps->nr_ipdopd_par) {
//The spec say says to only run this smoother when enable_ipdopd
//is set but the reference decoder appears to run it constantly
float h11i, h12i, h21i, h22i;
float ipd_adj_re, ipd_adj_im;
int opd_idx = opd_hist[b] * 8 + opd_mapped[e][b];
int ipd_idx = ipd_hist[b] * 8 + ipd_mapped[e][b];
float opd_re = pd_re_smooth[opd_idx];
float opd_im = pd_im_smooth[opd_idx];
float ipd_re = pd_re_smooth[ipd_idx];
float ipd_im = pd_im_smooth[ipd_idx];
opd_hist[b] = opd_idx & 0x3F;
ipd_hist[b] = ipd_idx & 0x3F;
ipd_adj_re = opd_re*ipd_re + opd_im*ipd_im;
ipd_adj_im = opd_im*ipd_re - opd_re*ipd_im;
h11i = h11 * opd_im;
h11 = h11 * opd_re;
h12i = h12 * ipd_adj_im;
h12 = h12 * ipd_adj_re;
h21i = h21 * opd_im;
h21 = h21 * opd_re;
h22i = h22 * ipd_adj_im;
h22 = h22 * ipd_adj_re;
H11[1][e+1][b] = h11i;
H12[1][e+1][b] = h12i;
H21[1][e+1][b] = h21i;
H22[1][e+1][b] = h22i;
}
H11[0][e+1][b] = h11;
H12[0][e+1][b] = h12;
H21[0][e+1][b] = h21;
H22[0][e+1][b] = h22;
}
for (k = 0; k < NR_BANDS[is34]; k++) {
float h11r, h12r, h21r, h22r;
float h11i, h12i, h21i, h22i;
float h11r_step, h12r_step, h21r_step, h22r_step;
float h11i_step, h12i_step, h21i_step, h22i_step;
int start = ps->border_position[e];
int stop = ps->border_position[e+1];
float width = 1.f / (stop - start);
b = k_to_i[k];
h11r = H11[0][e][b];
h12r = H12[0][e][b];
h21r = H21[0][e][b];
h22r = H22[0][e][b];
if (!PS_BASELINE && ps->enable_ipdopd) {
//Is this necessary? ps_04_new seems unchanged
if ((is34 && k <= 13 && k >= 9) || (!is34 && k <= 1)) {
h11i = -H11[1][e][b];
h12i = -H12[1][e][b];
h21i = -H21[1][e][b];
h22i = -H22[1][e][b];
} else {
h11i = H11[1][e][b];
h12i = H12[1][e][b];
h21i = H21[1][e][b];
h22i = H22[1][e][b];
}
}
//Interpolation
h11r_step = (H11[0][e+1][b] - h11r) * width;
h12r_step = (H12[0][e+1][b] - h12r) * width;
h21r_step = (H21[0][e+1][b] - h21r) * width;
h22r_step = (H22[0][e+1][b] - h22r) * width;
if (!PS_BASELINE && ps->enable_ipdopd) {
h11i_step = (H11[1][e+1][b] - h11i) * width;
h12i_step = (H12[1][e+1][b] - h12i) * width;
h21i_step = (H21[1][e+1][b] - h21i) * width;
h22i_step = (H22[1][e+1][b] - h22i) * width;
}
for (n = start + 1; n <= stop; n++) {
//l is s, r is d
float l_re = l[k][n][0];
float l_im = l[k][n][1];
float r_re = r[k][n][0];
float r_im = r[k][n][1];
h11r += h11r_step;
h12r += h12r_step;
h21r += h21r_step;
h22r += h22r_step;
if (!PS_BASELINE && ps->enable_ipdopd) {
h11i += h11i_step;
h12i += h12i_step;
h21i += h21i_step;
h22i += h22i_step;
l[k][n][0] = h11r*l_re + h21r*r_re - h11i*l_im - h21i*r_im;
l[k][n][1] = h11r*l_im + h21r*r_im + h11i*l_re + h21i*r_re;
r[k][n][0] = h12r*l_re + h22r*r_re - h12i*l_im - h22i*r_im;
r[k][n][1] = h12r*l_im + h22r*r_im + h12i*l_re + h22i*r_re;
} else {
l[k][n][0] = h11r*l_re + h21r*r_re;
l[k][n][1] = h11r*l_im + h21r*r_im;
r[k][n][0] = h12r*l_re + h22r*r_re;
r[k][n][1] = h12r*l_im + h22r*r_im;
}
}
}
}
}
| false | FFmpeg | bf1945af301aff54c33352e75f17aec6cb5269d7 | static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2], int is34)
{
int e, b, k, n;
float (*H11)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H11;
float (*H12)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H12;
float (*H21)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H21;
float (*H22)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H22;
int8_t *opd_hist = ps->opd_hist;
int8_t *ipd_hist = ps->ipd_hist;
int8_t iid_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
int8_t icc_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
int8_t ipd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
int8_t opd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
int8_t (*iid_mapped)[PS_MAX_NR_IIDICC] = iid_mapped_buf;
int8_t (*icc_mapped)[PS_MAX_NR_IIDICC] = icc_mapped_buf;
int8_t (*ipd_mapped)[PS_MAX_NR_IIDICC] = ipd_mapped_buf;
int8_t (*opd_mapped)[PS_MAX_NR_IIDICC] = opd_mapped_buf;
const int8_t *k_to_i = is34 ? k_to_i_34 : k_to_i_20;
const float (*H_LUT)[8][4] = (PS_BASELINE || ps->icc_mode < 3) ? HA : HB;
if (ps->num_env_old) {
memcpy(H11[0][0], H11[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[0][0][0]));
memcpy(H11[1][0], H11[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[1][0][0]));
memcpy(H12[0][0], H12[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[0][0][0]));
memcpy(H12[1][0], H12[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[1][0][0]));
memcpy(H21[0][0], H21[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[0][0][0]));
memcpy(H21[1][0], H21[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[1][0][0]));
memcpy(H22[0][0], H22[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[0][0][0]));
memcpy(H22[1][0], H22[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[1][0][0]));
}
if (is34) {
remap34(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1);
remap34(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1);
if (ps->enable_ipdopd) {
remap34(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0);
remap34(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0);
}
if (!ps->is34bands_old) {
map_val_20_to_34(H11[0][0]);
map_val_20_to_34(H11[1][0]);
map_val_20_to_34(H12[0][0]);
map_val_20_to_34(H12[1][0]);
map_val_20_to_34(H21[0][0]);
map_val_20_to_34(H21[1][0]);
map_val_20_to_34(H22[0][0]);
map_val_20_to_34(H22[1][0]);
ipdopd_reset(ipd_hist, opd_hist);
}
} else {
remap20(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1);
remap20(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1);
if (ps->enable_ipdopd) {
remap20(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0);
remap20(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0);
}
if (ps->is34bands_old) {
map_val_34_to_20(H11[0][0]);
map_val_34_to_20(H11[1][0]);
map_val_34_to_20(H12[0][0]);
map_val_34_to_20(H12[1][0]);
map_val_34_to_20(H21[0][0]);
map_val_34_to_20(H21[1][0]);
map_val_34_to_20(H22[0][0]);
map_val_34_to_20(H22[1][0]);
ipdopd_reset(ipd_hist, opd_hist);
}
}
for (e = 0; e < ps->num_env; e++) {
for (b = 0; b < NR_PAR_BANDS[is34]; b++) {
float h11, h12, h21, h22;
h11 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][0];
h12 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][1];
h21 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][2];
h22 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][3];
if (!PS_BASELINE && ps->enable_ipdopd && b < ps->nr_ipdopd_par) {
float h11i, h12i, h21i, h22i;
float ipd_adj_re, ipd_adj_im;
int opd_idx = opd_hist[b] * 8 + opd_mapped[e][b];
int ipd_idx = ipd_hist[b] * 8 + ipd_mapped[e][b];
float opd_re = pd_re_smooth[opd_idx];
float opd_im = pd_im_smooth[opd_idx];
float ipd_re = pd_re_smooth[ipd_idx];
float ipd_im = pd_im_smooth[ipd_idx];
opd_hist[b] = opd_idx & 0x3F;
ipd_hist[b] = ipd_idx & 0x3F;
ipd_adj_re = opd_re*ipd_re + opd_im*ipd_im;
ipd_adj_im = opd_im*ipd_re - opd_re*ipd_im;
h11i = h11 * opd_im;
h11 = h11 * opd_re;
h12i = h12 * ipd_adj_im;
h12 = h12 * ipd_adj_re;
h21i = h21 * opd_im;
h21 = h21 * opd_re;
h22i = h22 * ipd_adj_im;
h22 = h22 * ipd_adj_re;
H11[1][e+1][b] = h11i;
H12[1][e+1][b] = h12i;
H21[1][e+1][b] = h21i;
H22[1][e+1][b] = h22i;
}
H11[0][e+1][b] = h11;
H12[0][e+1][b] = h12;
H21[0][e+1][b] = h21;
H22[0][e+1][b] = h22;
}
for (k = 0; k < NR_BANDS[is34]; k++) {
float h11r, h12r, h21r, h22r;
float h11i, h12i, h21i, h22i;
float h11r_step, h12r_step, h21r_step, h22r_step;
float h11i_step, h12i_step, h21i_step, h22i_step;
int start = ps->border_position[e];
int stop = ps->border_position[e+1];
float width = 1.f / (stop - start);
b = k_to_i[k];
h11r = H11[0][e][b];
h12r = H12[0][e][b];
h21r = H21[0][e][b];
h22r = H22[0][e][b];
if (!PS_BASELINE && ps->enable_ipdopd) {
if ((is34 && k <= 13 && k >= 9) || (!is34 && k <= 1)) {
h11i = -H11[1][e][b];
h12i = -H12[1][e][b];
h21i = -H21[1][e][b];
h22i = -H22[1][e][b];
} else {
h11i = H11[1][e][b];
h12i = H12[1][e][b];
h21i = H21[1][e][b];
h22i = H22[1][e][b];
}
}
h11r_step = (H11[0][e+1][b] - h11r) * width;
h12r_step = (H12[0][e+1][b] - h12r) * width;
h21r_step = (H21[0][e+1][b] - h21r) * width;
h22r_step = (H22[0][e+1][b] - h22r) * width;
if (!PS_BASELINE && ps->enable_ipdopd) {
h11i_step = (H11[1][e+1][b] - h11i) * width;
h12i_step = (H12[1][e+1][b] - h12i) * width;
h21i_step = (H21[1][e+1][b] - h21i) * width;
h22i_step = (H22[1][e+1][b] - h22i) * width;
}
for (n = start + 1; n <= stop; n++) {
float l_re = l[k][n][0];
float l_im = l[k][n][1];
float r_re = r[k][n][0];
float r_im = r[k][n][1];
h11r += h11r_step;
h12r += h12r_step;
h21r += h21r_step;
h22r += h22r_step;
if (!PS_BASELINE && ps->enable_ipdopd) {
h11i += h11i_step;
h12i += h12i_step;
h21i += h21i_step;
h22i += h22i_step;
l[k][n][0] = h11r*l_re + h21r*r_re - h11i*l_im - h21i*r_im;
l[k][n][1] = h11r*l_im + h21r*r_im + h11i*l_re + h21i*r_re;
r[k][n][0] = h12r*l_re + h22r*r_re - h12i*l_im - h22i*r_im;
r[k][n][1] = h12r*l_im + h22r*r_im + h12i*l_re + h22i*r_re;
} else {
l[k][n][0] = h11r*l_re + h21r*r_re;
l[k][n][1] = h11r*l_im + h21r*r_im;
r[k][n][0] = h12r*l_re + h22r*r_re;
r[k][n][1] = h12r*l_im + h22r*r_im;
}
}
}
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(PSContext *VAR_0, float (*VAR_1)[32][2], float (*VAR_2)[32][2], int VAR_3)
{
int VAR_4, VAR_5, VAR_6, VAR_7;
float (*VAR_8)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = VAR_0->VAR_8;
float (*VAR_9)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = VAR_0->VAR_9;
float (*VAR_10)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = VAR_0->VAR_10;
float (*VAR_11)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = VAR_0->VAR_11;
int8_t *opd_hist = VAR_0->opd_hist;
int8_t *ipd_hist = VAR_0->ipd_hist;
int8_t iid_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
int8_t icc_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
int8_t ipd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
int8_t opd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
int8_t (*iid_mapped)[PS_MAX_NR_IIDICC] = iid_mapped_buf;
int8_t (*icc_mapped)[PS_MAX_NR_IIDICC] = icc_mapped_buf;
int8_t (*ipd_mapped)[PS_MAX_NR_IIDICC] = ipd_mapped_buf;
int8_t (*opd_mapped)[PS_MAX_NR_IIDICC] = opd_mapped_buf;
const int8_t *VAR_12 = VAR_3 ? k_to_i_34 : k_to_i_20;
const float (*VAR_13)[8][4] = (PS_BASELINE || VAR_0->icc_mode < 3) ? HA : HB;
if (VAR_0->num_env_old) {
memcpy(VAR_8[0][0], VAR_8[0][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_8[0][0][0]));
memcpy(VAR_8[1][0], VAR_8[1][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_8[1][0][0]));
memcpy(VAR_9[0][0], VAR_9[0][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_9[0][0][0]));
memcpy(VAR_9[1][0], VAR_9[1][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_9[1][0][0]));
memcpy(VAR_10[0][0], VAR_10[0][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_10[0][0][0]));
memcpy(VAR_10[1][0], VAR_10[1][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_10[1][0][0]));
memcpy(VAR_11[0][0], VAR_11[0][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_11[0][0][0]));
memcpy(VAR_11[1][0], VAR_11[1][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_11[1][0][0]));
}
if (VAR_3) {
remap34(&iid_mapped, VAR_0->iid_par, VAR_0->nr_iid_par, VAR_0->num_env, 1);
remap34(&icc_mapped, VAR_0->icc_par, VAR_0->nr_icc_par, VAR_0->num_env, 1);
if (VAR_0->enable_ipdopd) {
remap34(&ipd_mapped, VAR_0->ipd_par, VAR_0->nr_ipdopd_par, VAR_0->num_env, 0);
remap34(&opd_mapped, VAR_0->opd_par, VAR_0->nr_ipdopd_par, VAR_0->num_env, 0);
}
if (!VAR_0->is34bands_old) {
map_val_20_to_34(VAR_8[0][0]);
map_val_20_to_34(VAR_8[1][0]);
map_val_20_to_34(VAR_9[0][0]);
map_val_20_to_34(VAR_9[1][0]);
map_val_20_to_34(VAR_10[0][0]);
map_val_20_to_34(VAR_10[1][0]);
map_val_20_to_34(VAR_11[0][0]);
map_val_20_to_34(VAR_11[1][0]);
ipdopd_reset(ipd_hist, opd_hist);
}
} else {
remap20(&iid_mapped, VAR_0->iid_par, VAR_0->nr_iid_par, VAR_0->num_env, 1);
remap20(&icc_mapped, VAR_0->icc_par, VAR_0->nr_icc_par, VAR_0->num_env, 1);
if (VAR_0->enable_ipdopd) {
remap20(&ipd_mapped, VAR_0->ipd_par, VAR_0->nr_ipdopd_par, VAR_0->num_env, 0);
remap20(&opd_mapped, VAR_0->opd_par, VAR_0->nr_ipdopd_par, VAR_0->num_env, 0);
}
if (VAR_0->is34bands_old) {
map_val_34_to_20(VAR_8[0][0]);
map_val_34_to_20(VAR_8[1][0]);
map_val_34_to_20(VAR_9[0][0]);
map_val_34_to_20(VAR_9[1][0]);
map_val_34_to_20(VAR_10[0][0]);
map_val_34_to_20(VAR_10[1][0]);
map_val_34_to_20(VAR_11[0][0]);
map_val_34_to_20(VAR_11[1][0]);
ipdopd_reset(ipd_hist, opd_hist);
}
}
for (VAR_4 = 0; VAR_4 < VAR_0->num_env; VAR_4++) {
for (VAR_5 = 0; VAR_5 < NR_PAR_BANDS[VAR_3]; VAR_5++) {
float h11, h12, h21, h22;
h11 = VAR_13[iid_mapped[VAR_4][VAR_5] + 7 + 23 * VAR_0->iid_quant][icc_mapped[VAR_4][VAR_5]][0];
h12 = VAR_13[iid_mapped[VAR_4][VAR_5] + 7 + 23 * VAR_0->iid_quant][icc_mapped[VAR_4][VAR_5]][1];
h21 = VAR_13[iid_mapped[VAR_4][VAR_5] + 7 + 23 * VAR_0->iid_quant][icc_mapped[VAR_4][VAR_5]][2];
h22 = VAR_13[iid_mapped[VAR_4][VAR_5] + 7 + 23 * VAR_0->iid_quant][icc_mapped[VAR_4][VAR_5]][3];
if (!PS_BASELINE && VAR_0->enable_ipdopd && VAR_5 < VAR_0->nr_ipdopd_par) {
float h11i, h12i, h21i, h22i;
float ipd_adj_re, ipd_adj_im;
int opd_idx = opd_hist[VAR_5] * 8 + opd_mapped[VAR_4][VAR_5];
int ipd_idx = ipd_hist[VAR_5] * 8 + ipd_mapped[VAR_4][VAR_5];
float opd_re = pd_re_smooth[opd_idx];
float opd_im = pd_im_smooth[opd_idx];
float ipd_re = pd_re_smooth[ipd_idx];
float ipd_im = pd_im_smooth[ipd_idx];
opd_hist[VAR_5] = opd_idx & 0x3F;
ipd_hist[VAR_5] = ipd_idx & 0x3F;
ipd_adj_re = opd_re*ipd_re + opd_im*ipd_im;
ipd_adj_im = opd_im*ipd_re - opd_re*ipd_im;
h11i = h11 * opd_im;
h11 = h11 * opd_re;
h12i = h12 * ipd_adj_im;
h12 = h12 * ipd_adj_re;
h21i = h21 * opd_im;
h21 = h21 * opd_re;
h22i = h22 * ipd_adj_im;
h22 = h22 * ipd_adj_re;
VAR_8[1][VAR_4+1][VAR_5] = h11i;
VAR_9[1][VAR_4+1][VAR_5] = h12i;
VAR_10[1][VAR_4+1][VAR_5] = h21i;
VAR_11[1][VAR_4+1][VAR_5] = h22i;
}
VAR_8[0][VAR_4+1][VAR_5] = h11;
VAR_9[0][VAR_4+1][VAR_5] = h12;
VAR_10[0][VAR_4+1][VAR_5] = h21;
VAR_11[0][VAR_4+1][VAR_5] = h22;
}
for (VAR_6 = 0; VAR_6 < NR_BANDS[VAR_3]; VAR_6++) {
float h11r, h12r, h21r, h22r;
float h11i, h12i, h21i, h22i;
float h11r_step, h12r_step, h21r_step, h22r_step;
float h11i_step, h12i_step, h21i_step, h22i_step;
int start = VAR_0->border_position[VAR_4];
int stop = VAR_0->border_position[VAR_4+1];
float width = 1.f / (stop - start);
VAR_5 = VAR_12[VAR_6];
h11r = VAR_8[0][VAR_4][VAR_5];
h12r = VAR_9[0][VAR_4][VAR_5];
h21r = VAR_10[0][VAR_4][VAR_5];
h22r = VAR_11[0][VAR_4][VAR_5];
if (!PS_BASELINE && VAR_0->enable_ipdopd) {
if ((VAR_3 && VAR_6 <= 13 && VAR_6 >= 9) || (!VAR_3 && VAR_6 <= 1)) {
h11i = -VAR_8[1][VAR_4][VAR_5];
h12i = -VAR_9[1][VAR_4][VAR_5];
h21i = -VAR_10[1][VAR_4][VAR_5];
h22i = -VAR_11[1][VAR_4][VAR_5];
} else {
h11i = VAR_8[1][VAR_4][VAR_5];
h12i = VAR_9[1][VAR_4][VAR_5];
h21i = VAR_10[1][VAR_4][VAR_5];
h22i = VAR_11[1][VAR_4][VAR_5];
}
}
h11r_step = (VAR_8[0][VAR_4+1][VAR_5] - h11r) * width;
h12r_step = (VAR_9[0][VAR_4+1][VAR_5] - h12r) * width;
h21r_step = (VAR_10[0][VAR_4+1][VAR_5] - h21r) * width;
h22r_step = (VAR_11[0][VAR_4+1][VAR_5] - h22r) * width;
if (!PS_BASELINE && VAR_0->enable_ipdopd) {
h11i_step = (VAR_8[1][VAR_4+1][VAR_5] - h11i) * width;
h12i_step = (VAR_9[1][VAR_4+1][VAR_5] - h12i) * width;
h21i_step = (VAR_10[1][VAR_4+1][VAR_5] - h21i) * width;
h22i_step = (VAR_11[1][VAR_4+1][VAR_5] - h22i) * width;
}
for (VAR_7 = start + 1; VAR_7 <= stop; VAR_7++) {
float l_re = VAR_1[VAR_6][VAR_7][0];
float l_im = VAR_1[VAR_6][VAR_7][1];
float r_re = VAR_2[VAR_6][VAR_7][0];
float r_im = VAR_2[VAR_6][VAR_7][1];
h11r += h11r_step;
h12r += h12r_step;
h21r += h21r_step;
h22r += h22r_step;
if (!PS_BASELINE && VAR_0->enable_ipdopd) {
h11i += h11i_step;
h12i += h12i_step;
h21i += h21i_step;
h22i += h22i_step;
VAR_1[VAR_6][VAR_7][0] = h11r*l_re + h21r*r_re - h11i*l_im - h21i*r_im;
VAR_1[VAR_6][VAR_7][1] = h11r*l_im + h21r*r_im + h11i*l_re + h21i*r_re;
VAR_2[VAR_6][VAR_7][0] = h12r*l_re + h22r*r_re - h12i*l_im - h22i*r_im;
VAR_2[VAR_6][VAR_7][1] = h12r*l_im + h22r*r_im + h12i*l_re + h22i*r_re;
} else {
VAR_1[VAR_6][VAR_7][0] = h11r*l_re + h21r*r_re;
VAR_1[VAR_6][VAR_7][1] = h11r*l_im + h21r*r_im;
VAR_2[VAR_6][VAR_7][0] = h12r*l_re + h22r*r_re;
VAR_2[VAR_6][VAR_7][1] = h12r*l_im + h22r*r_im;
}
}
}
}
}
| [
"static void FUNC_0(PSContext *VAR_0, float (*VAR_1)[32][2], float (*VAR_2)[32][2], int VAR_3)\n{",
"int VAR_4, VAR_5, VAR_6, VAR_7;",
"float (*VAR_8)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = VAR_0->VAR_8;",
"float (*VAR_9)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = VAR_0->VAR_9;",
"float (*VAR_10)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = VAR_0->VAR_10;",
"float (*VAR_11)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = VAR_0->VAR_11;",
"int8_t *opd_hist = VAR_0->opd_hist;",
"int8_t *ipd_hist = VAR_0->ipd_hist;",
"int8_t iid_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];",
"int8_t icc_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];",
"int8_t ipd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];",
"int8_t opd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];",
"int8_t (*iid_mapped)[PS_MAX_NR_IIDICC] = iid_mapped_buf;",
"int8_t (*icc_mapped)[PS_MAX_NR_IIDICC] = icc_mapped_buf;",
"int8_t (*ipd_mapped)[PS_MAX_NR_IIDICC] = ipd_mapped_buf;",
"int8_t (*opd_mapped)[PS_MAX_NR_IIDICC] = opd_mapped_buf;",
"const int8_t *VAR_12 = VAR_3 ? k_to_i_34 : k_to_i_20;",
"const float (*VAR_13)[8][4] = (PS_BASELINE || VAR_0->icc_mode < 3) ? HA : HB;",
"if (VAR_0->num_env_old) {",
"memcpy(VAR_8[0][0], VAR_8[0][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_8[0][0][0]));",
"memcpy(VAR_8[1][0], VAR_8[1][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_8[1][0][0]));",
"memcpy(VAR_9[0][0], VAR_9[0][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_9[0][0][0]));",
"memcpy(VAR_9[1][0], VAR_9[1][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_9[1][0][0]));",
"memcpy(VAR_10[0][0], VAR_10[0][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_10[0][0][0]));",
"memcpy(VAR_10[1][0], VAR_10[1][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_10[1][0][0]));",
"memcpy(VAR_11[0][0], VAR_11[0][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_11[0][0][0]));",
"memcpy(VAR_11[1][0], VAR_11[1][VAR_0->num_env_old], PS_MAX_NR_IIDICC*sizeof(VAR_11[1][0][0]));",
"}",
"if (VAR_3) {",
"remap34(&iid_mapped, VAR_0->iid_par, VAR_0->nr_iid_par, VAR_0->num_env, 1);",
"remap34(&icc_mapped, VAR_0->icc_par, VAR_0->nr_icc_par, VAR_0->num_env, 1);",
"if (VAR_0->enable_ipdopd) {",
"remap34(&ipd_mapped, VAR_0->ipd_par, VAR_0->nr_ipdopd_par, VAR_0->num_env, 0);",
"remap34(&opd_mapped, VAR_0->opd_par, VAR_0->nr_ipdopd_par, VAR_0->num_env, 0);",
"}",
"if (!VAR_0->is34bands_old) {",
"map_val_20_to_34(VAR_8[0][0]);",
"map_val_20_to_34(VAR_8[1][0]);",
"map_val_20_to_34(VAR_9[0][0]);",
"map_val_20_to_34(VAR_9[1][0]);",
"map_val_20_to_34(VAR_10[0][0]);",
"map_val_20_to_34(VAR_10[1][0]);",
"map_val_20_to_34(VAR_11[0][0]);",
"map_val_20_to_34(VAR_11[1][0]);",
"ipdopd_reset(ipd_hist, opd_hist);",
"}",
"} else {",
"remap20(&iid_mapped, VAR_0->iid_par, VAR_0->nr_iid_par, VAR_0->num_env, 1);",
"remap20(&icc_mapped, VAR_0->icc_par, VAR_0->nr_icc_par, VAR_0->num_env, 1);",
"if (VAR_0->enable_ipdopd) {",
"remap20(&ipd_mapped, VAR_0->ipd_par, VAR_0->nr_ipdopd_par, VAR_0->num_env, 0);",
"remap20(&opd_mapped, VAR_0->opd_par, VAR_0->nr_ipdopd_par, VAR_0->num_env, 0);",
"}",
"if (VAR_0->is34bands_old) {",
"map_val_34_to_20(VAR_8[0][0]);",
"map_val_34_to_20(VAR_8[1][0]);",
"map_val_34_to_20(VAR_9[0][0]);",
"map_val_34_to_20(VAR_9[1][0]);",
"map_val_34_to_20(VAR_10[0][0]);",
"map_val_34_to_20(VAR_10[1][0]);",
"map_val_34_to_20(VAR_11[0][0]);",
"map_val_34_to_20(VAR_11[1][0]);",
"ipdopd_reset(ipd_hist, opd_hist);",
"}",
"}",
"for (VAR_4 = 0; VAR_4 < VAR_0->num_env; VAR_4++) {",
"for (VAR_5 = 0; VAR_5 < NR_PAR_BANDS[VAR_3]; VAR_5++) {",
"float h11, h12, h21, h22;",
"h11 = VAR_13[iid_mapped[VAR_4][VAR_5] + 7 + 23 * VAR_0->iid_quant][icc_mapped[VAR_4][VAR_5]][0];",
"h12 = VAR_13[iid_mapped[VAR_4][VAR_5] + 7 + 23 * VAR_0->iid_quant][icc_mapped[VAR_4][VAR_5]][1];",
"h21 = VAR_13[iid_mapped[VAR_4][VAR_5] + 7 + 23 * VAR_0->iid_quant][icc_mapped[VAR_4][VAR_5]][2];",
"h22 = VAR_13[iid_mapped[VAR_4][VAR_5] + 7 + 23 * VAR_0->iid_quant][icc_mapped[VAR_4][VAR_5]][3];",
"if (!PS_BASELINE && VAR_0->enable_ipdopd && VAR_5 < VAR_0->nr_ipdopd_par) {",
"float h11i, h12i, h21i, h22i;",
"float ipd_adj_re, ipd_adj_im;",
"int opd_idx = opd_hist[VAR_5] * 8 + opd_mapped[VAR_4][VAR_5];",
"int ipd_idx = ipd_hist[VAR_5] * 8 + ipd_mapped[VAR_4][VAR_5];",
"float opd_re = pd_re_smooth[opd_idx];",
"float opd_im = pd_im_smooth[opd_idx];",
"float ipd_re = pd_re_smooth[ipd_idx];",
"float ipd_im = pd_im_smooth[ipd_idx];",
"opd_hist[VAR_5] = opd_idx & 0x3F;",
"ipd_hist[VAR_5] = ipd_idx & 0x3F;",
"ipd_adj_re = opd_re*ipd_re + opd_im*ipd_im;",
"ipd_adj_im = opd_im*ipd_re - opd_re*ipd_im;",
"h11i = h11 * opd_im;",
"h11 = h11 * opd_re;",
"h12i = h12 * ipd_adj_im;",
"h12 = h12 * ipd_adj_re;",
"h21i = h21 * opd_im;",
"h21 = h21 * opd_re;",
"h22i = h22 * ipd_adj_im;",
"h22 = h22 * ipd_adj_re;",
"VAR_8[1][VAR_4+1][VAR_5] = h11i;",
"VAR_9[1][VAR_4+1][VAR_5] = h12i;",
"VAR_10[1][VAR_4+1][VAR_5] = h21i;",
"VAR_11[1][VAR_4+1][VAR_5] = h22i;",
"}",
"VAR_8[0][VAR_4+1][VAR_5] = h11;",
"VAR_9[0][VAR_4+1][VAR_5] = h12;",
"VAR_10[0][VAR_4+1][VAR_5] = h21;",
"VAR_11[0][VAR_4+1][VAR_5] = h22;",
"}",
"for (VAR_6 = 0; VAR_6 < NR_BANDS[VAR_3]; VAR_6++) {",
"float h11r, h12r, h21r, h22r;",
"float h11i, h12i, h21i, h22i;",
"float h11r_step, h12r_step, h21r_step, h22r_step;",
"float h11i_step, h12i_step, h21i_step, h22i_step;",
"int start = VAR_0->border_position[VAR_4];",
"int stop = VAR_0->border_position[VAR_4+1];",
"float width = 1.f / (stop - start);",
"VAR_5 = VAR_12[VAR_6];",
"h11r = VAR_8[0][VAR_4][VAR_5];",
"h12r = VAR_9[0][VAR_4][VAR_5];",
"h21r = VAR_10[0][VAR_4][VAR_5];",
"h22r = VAR_11[0][VAR_4][VAR_5];",
"if (!PS_BASELINE && VAR_0->enable_ipdopd) {",
"if ((VAR_3 && VAR_6 <= 13 && VAR_6 >= 9) || (!VAR_3 && VAR_6 <= 1)) {",
"h11i = -VAR_8[1][VAR_4][VAR_5];",
"h12i = -VAR_9[1][VAR_4][VAR_5];",
"h21i = -VAR_10[1][VAR_4][VAR_5];",
"h22i = -VAR_11[1][VAR_4][VAR_5];",
"} else {",
"h11i = VAR_8[1][VAR_4][VAR_5];",
"h12i = VAR_9[1][VAR_4][VAR_5];",
"h21i = VAR_10[1][VAR_4][VAR_5];",
"h22i = VAR_11[1][VAR_4][VAR_5];",
"}",
"}",
"h11r_step = (VAR_8[0][VAR_4+1][VAR_5] - h11r) * width;",
"h12r_step = (VAR_9[0][VAR_4+1][VAR_5] - h12r) * width;",
"h21r_step = (VAR_10[0][VAR_4+1][VAR_5] - h21r) * width;",
"h22r_step = (VAR_11[0][VAR_4+1][VAR_5] - h22r) * width;",
"if (!PS_BASELINE && VAR_0->enable_ipdopd) {",
"h11i_step = (VAR_8[1][VAR_4+1][VAR_5] - h11i) * width;",
"h12i_step = (VAR_9[1][VAR_4+1][VAR_5] - h12i) * width;",
"h21i_step = (VAR_10[1][VAR_4+1][VAR_5] - h21i) * width;",
"h22i_step = (VAR_11[1][VAR_4+1][VAR_5] - h22i) * width;",
"}",
"for (VAR_7 = start + 1; VAR_7 <= stop; VAR_7++) {",
"float l_re = VAR_1[VAR_6][VAR_7][0];",
"float l_im = VAR_1[VAR_6][VAR_7][1];",
"float r_re = VAR_2[VAR_6][VAR_7][0];",
"float r_im = VAR_2[VAR_6][VAR_7][1];",
"h11r += h11r_step;",
"h12r += h12r_step;",
"h21r += h21r_step;",
"h22r += h22r_step;",
"if (!PS_BASELINE && VAR_0->enable_ipdopd) {",
"h11i += h11i_step;",
"h12i += h12i_step;",
"h21i += h21i_step;",
"h22i += h22i_step;",
"VAR_1[VAR_6][VAR_7][0] = h11r*l_re + h21r*r_re - h11i*l_im - h21i*r_im;",
"VAR_1[VAR_6][VAR_7][1] = h11r*l_im + h21r*r_im + h11i*l_re + h21i*r_re;",
"VAR_2[VAR_6][VAR_7][0] = h12r*l_re + h22r*r_re - h12i*l_im - h22i*r_im;",
"VAR_2[VAR_6][VAR_7][1] = h12r*l_im + h22r*r_im + h12i*l_re + h22i*r_re;",
"} else {",
"VAR_1[VAR_6][VAR_7][0] = h11r*l_re + h21r*r_re;",
"VAR_1[VAR_6][VAR_7][1] = h11r*l_im + h21r*r_im;",
"VAR_2[VAR_6][VAR_7][0] = h12r*l_re + h22r*r_re;",
"VAR_2[VAR_6][VAR_7][1] = h12r*l_im + h22r*r_im;",
"}",
"}",
"}",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
215
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
231
],
[
233
],
[
235
],
[
237
],
[
239
],
[
241
],
[
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
253
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273
],
[
275
],
[
277
],
[
279
],
[
283
],
[
285
],
[
287
],
[
289
],
[
291
],
[
293
],
[
295
],
[
297
],
[
299
],
[
301
],
[
303
],
[
307
],
[
309
],
[
311
],
[
313
],
[
315
],
[
317
],
[
319
],
[
321
],
[
323
],
[
325
],
[
327
],
[
329
],
[
331
],
[
335
],
[
337
],
[
339
],
[
341
],
[
343
],
[
345
],
[
347
],
[
349
],
[
351
],
[
353
],
[
355
],
[
357
],
[
359
],
[
361
]
] |
1,485 | static int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,
void *opaque)
{
if (mon->rs) {
readline_start(mon->rs, "Password: ", 1, readline_func, opaque);
/* prompt is printed on return from the command handler */
return 0;
} else {
monitor_printf(mon, "terminal does not support password prompting\n");
return -ENOTTY;
}
}
| false | qemu | 94171e119cb6f7bab2578896643b0daff1d9b184 | static int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,
void *opaque)
{
if (mon->rs) {
readline_start(mon->rs, "Password: ", 1, readline_func, opaque);
return 0;
} else {
monitor_printf(mon, "terminal does not support password prompting\n");
return -ENOTTY;
}
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(Monitor *VAR_0, ReadLineFunc *VAR_1,
void *VAR_2)
{
if (VAR_0->rs) {
readline_start(VAR_0->rs, "Password: ", 1, VAR_1, VAR_2);
return 0;
} else {
monitor_printf(VAR_0, "terminal does not support password prompting\n");
return -ENOTTY;
}
}
| [
"static int FUNC_0(Monitor *VAR_0, ReadLineFunc *VAR_1,\nvoid *VAR_2)\n{",
"if (VAR_0->rs) {",
"readline_start(VAR_0->rs, \"Password: \", 1, VAR_1, VAR_2);",
"return 0;",
"} else {",
"monitor_printf(VAR_0, \"terminal does not support password prompting\\n\");",
"return -ENOTTY;",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
]
] |
1,486 | static inline void gen_efdnabs(DisasContext *ctx)
{
if (unlikely(!ctx->spe_enabled)) {
gen_exception(ctx, POWERPC_EXCP_APU);
return;
}
#if defined(TARGET_PPC64)
tcg_gen_ori_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], 0x8000000000000000LL);
#else
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);
tcg_gen_ori_tl(cpu_gprh[rD(ctx->opcode)], cpu_gprh[rA(ctx->opcode)], 0x80000000);
#endif
}
| false | qemu | 27a69bb088bee6d4efea254659422fb9c751b3c7 | static inline void gen_efdnabs(DisasContext *ctx)
{
if (unlikely(!ctx->spe_enabled)) {
gen_exception(ctx, POWERPC_EXCP_APU);
return;
}
#if defined(TARGET_PPC64)
tcg_gen_ori_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)], 0x8000000000000000LL);
#else
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_gpr[rA(ctx->opcode)]);
tcg_gen_ori_tl(cpu_gprh[rD(ctx->opcode)], cpu_gprh[rA(ctx->opcode)], 0x80000000);
#endif
}
| {
"code": [],
"line_no": []
} | static inline void FUNC_0(DisasContext *VAR_0)
{
if (unlikely(!VAR_0->spe_enabled)) {
gen_exception(VAR_0, POWERPC_EXCP_APU);
return;
}
#if defined(TARGET_PPC64)
tcg_gen_ori_tl(cpu_gpr[rD(VAR_0->opcode)], cpu_gpr[rA(VAR_0->opcode)], 0x8000000000000000LL);
#else
tcg_gen_mov_tl(cpu_gpr[rD(VAR_0->opcode)], cpu_gpr[rA(VAR_0->opcode)]);
tcg_gen_ori_tl(cpu_gprh[rD(VAR_0->opcode)], cpu_gprh[rA(VAR_0->opcode)], 0x80000000);
#endif
}
| [
"static inline void FUNC_0(DisasContext *VAR_0)\n{",
"if (unlikely(!VAR_0->spe_enabled)) {",
"gen_exception(VAR_0, POWERPC_EXCP_APU);",
"return;",
"}",
"#if defined(TARGET_PPC64)\ntcg_gen_ori_tl(cpu_gpr[rD(VAR_0->opcode)], cpu_gpr[rA(VAR_0->opcode)], 0x8000000000000000LL);",
"#else\ntcg_gen_mov_tl(cpu_gpr[rD(VAR_0->opcode)], cpu_gpr[rA(VAR_0->opcode)]);",
"tcg_gen_ori_tl(cpu_gprh[rD(VAR_0->opcode)], cpu_gprh[rA(VAR_0->opcode)], 0x80000000);",
"#endif\n}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13,
15
],
[
17,
19
],
[
21
],
[
23,
25
]
] |
1,488 | int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
VhostBackendType backend_type)
{
uint64_t features;
int i, r;
if (vhost_set_backend_type(hdev, backend_type) < 0) {
close((uintptr_t)opaque);
return -1;
}
if (hdev->vhost_ops->vhost_backend_init(hdev, opaque) < 0) {
close((uintptr_t)opaque);
return -errno;
}
r = hdev->vhost_ops->vhost_call(hdev, VHOST_SET_OWNER, NULL);
if (r < 0) {
goto fail;
}
r = hdev->vhost_ops->vhost_call(hdev, VHOST_GET_FEATURES, &features);
if (r < 0) {
goto fail;
}
for (i = 0; i < hdev->nvqs; ++i) {
r = vhost_virtqueue_init(hdev, hdev->vqs + i, i);
if (r < 0) {
goto fail_vq;
}
}
hdev->features = features;
hdev->memory_listener = (MemoryListener) {
.begin = vhost_begin,
.commit = vhost_commit,
.region_add = vhost_region_add,
.region_del = vhost_region_del,
.region_nop = vhost_region_nop,
.log_start = vhost_log_start,
.log_stop = vhost_log_stop,
.log_sync = vhost_log_sync,
.log_global_start = vhost_log_global_start,
.log_global_stop = vhost_log_global_stop,
.eventfd_add = vhost_eventfd_add,
.eventfd_del = vhost_eventfd_del,
.priority = 10
};
hdev->migration_blocker = NULL;
if (!(hdev->features & (0x1ULL << VHOST_F_LOG_ALL))) {
error_setg(&hdev->migration_blocker,
"Migration disabled: vhost lacks VHOST_F_LOG_ALL feature.");
migrate_add_blocker(hdev->migration_blocker);
}
hdev->mem = g_malloc0(offsetof(struct vhost_memory, regions));
hdev->n_mem_sections = 0;
hdev->mem_sections = NULL;
hdev->log = NULL;
hdev->log_size = 0;
hdev->log_enabled = false;
hdev->started = false;
hdev->memory_changed = false;
memory_listener_register(&hdev->memory_listener, &address_space_memory);
return 0;
fail_vq:
while (--i >= 0) {
vhost_virtqueue_cleanup(hdev->vqs + i);
}
fail:
r = -errno;
hdev->vhost_ops->vhost_backend_cleanup(hdev);
return r;
}
| false | qemu | b931bfbf042983f311b3b09894d8030b2755a638 | int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
VhostBackendType backend_type)
{
uint64_t features;
int i, r;
if (vhost_set_backend_type(hdev, backend_type) < 0) {
close((uintptr_t)opaque);
return -1;
}
if (hdev->vhost_ops->vhost_backend_init(hdev, opaque) < 0) {
close((uintptr_t)opaque);
return -errno;
}
r = hdev->vhost_ops->vhost_call(hdev, VHOST_SET_OWNER, NULL);
if (r < 0) {
goto fail;
}
r = hdev->vhost_ops->vhost_call(hdev, VHOST_GET_FEATURES, &features);
if (r < 0) {
goto fail;
}
for (i = 0; i < hdev->nvqs; ++i) {
r = vhost_virtqueue_init(hdev, hdev->vqs + i, i);
if (r < 0) {
goto fail_vq;
}
}
hdev->features = features;
hdev->memory_listener = (MemoryListener) {
.begin = vhost_begin,
.commit = vhost_commit,
.region_add = vhost_region_add,
.region_del = vhost_region_del,
.region_nop = vhost_region_nop,
.log_start = vhost_log_start,
.log_stop = vhost_log_stop,
.log_sync = vhost_log_sync,
.log_global_start = vhost_log_global_start,
.log_global_stop = vhost_log_global_stop,
.eventfd_add = vhost_eventfd_add,
.eventfd_del = vhost_eventfd_del,
.priority = 10
};
hdev->migration_blocker = NULL;
if (!(hdev->features & (0x1ULL << VHOST_F_LOG_ALL))) {
error_setg(&hdev->migration_blocker,
"Migration disabled: vhost lacks VHOST_F_LOG_ALL feature.");
migrate_add_blocker(hdev->migration_blocker);
}
hdev->mem = g_malloc0(offsetof(struct vhost_memory, regions));
hdev->n_mem_sections = 0;
hdev->mem_sections = NULL;
hdev->log = NULL;
hdev->log_size = 0;
hdev->log_enabled = false;
hdev->started = false;
hdev->memory_changed = false;
memory_listener_register(&hdev->memory_listener, &address_space_memory);
return 0;
fail_vq:
while (--i >= 0) {
vhost_virtqueue_cleanup(hdev->vqs + i);
}
fail:
r = -errno;
hdev->vhost_ops->vhost_backend_cleanup(hdev);
return r;
}
| {
"code": [],
"line_no": []
} | int FUNC_0(struct vhost_dev *VAR_0, void *VAR_1,
VhostBackendType VAR_2)
{
uint64_t features;
int VAR_3, VAR_4;
if (vhost_set_backend_type(VAR_0, VAR_2) < 0) {
close((uintptr_t)VAR_1);
return -1;
}
if (VAR_0->vhost_ops->vhost_backend_init(VAR_0, VAR_1) < 0) {
close((uintptr_t)VAR_1);
return -errno;
}
VAR_4 = VAR_0->vhost_ops->vhost_call(VAR_0, VHOST_SET_OWNER, NULL);
if (VAR_4 < 0) {
goto fail;
}
VAR_4 = VAR_0->vhost_ops->vhost_call(VAR_0, VHOST_GET_FEATURES, &features);
if (VAR_4 < 0) {
goto fail;
}
for (VAR_3 = 0; VAR_3 < VAR_0->nvqs; ++VAR_3) {
VAR_4 = vhost_virtqueue_init(VAR_0, VAR_0->vqs + VAR_3, VAR_3);
if (VAR_4 < 0) {
goto fail_vq;
}
}
VAR_0->features = features;
VAR_0->memory_listener = (MemoryListener) {
.begin = vhost_begin,
.commit = vhost_commit,
.region_add = vhost_region_add,
.region_del = vhost_region_del,
.region_nop = vhost_region_nop,
.log_start = vhost_log_start,
.log_stop = vhost_log_stop,
.log_sync = vhost_log_sync,
.log_global_start = vhost_log_global_start,
.log_global_stop = vhost_log_global_stop,
.eventfd_add = vhost_eventfd_add,
.eventfd_del = vhost_eventfd_del,
.priority = 10
};
VAR_0->migration_blocker = NULL;
if (!(VAR_0->features & (0x1ULL << VHOST_F_LOG_ALL))) {
error_setg(&VAR_0->migration_blocker,
"Migration disabled: vhost lacks VHOST_F_LOG_ALL feature.");
migrate_add_blocker(VAR_0->migration_blocker);
}
VAR_0->mem = g_malloc0(offsetof(struct vhost_memory, regions));
VAR_0->n_mem_sections = 0;
VAR_0->mem_sections = NULL;
VAR_0->log = NULL;
VAR_0->log_size = 0;
VAR_0->log_enabled = false;
VAR_0->started = false;
VAR_0->memory_changed = false;
memory_listener_register(&VAR_0->memory_listener, &address_space_memory);
return 0;
fail_vq:
while (--VAR_3 >= 0) {
vhost_virtqueue_cleanup(VAR_0->vqs + VAR_3);
}
fail:
VAR_4 = -errno;
VAR_0->vhost_ops->vhost_backend_cleanup(VAR_0);
return VAR_4;
}
| [
"int FUNC_0(struct vhost_dev *VAR_0, void *VAR_1,\nVhostBackendType VAR_2)\n{",
"uint64_t features;",
"int VAR_3, VAR_4;",
"if (vhost_set_backend_type(VAR_0, VAR_2) < 0) {",
"close((uintptr_t)VAR_1);",
"return -1;",
"}",
"if (VAR_0->vhost_ops->vhost_backend_init(VAR_0, VAR_1) < 0) {",
"close((uintptr_t)VAR_1);",
"return -errno;",
"}",
"VAR_4 = VAR_0->vhost_ops->vhost_call(VAR_0, VHOST_SET_OWNER, NULL);",
"if (VAR_4 < 0) {",
"goto fail;",
"}",
"VAR_4 = VAR_0->vhost_ops->vhost_call(VAR_0, VHOST_GET_FEATURES, &features);",
"if (VAR_4 < 0) {",
"goto fail;",
"}",
"for (VAR_3 = 0; VAR_3 < VAR_0->nvqs; ++VAR_3) {",
"VAR_4 = vhost_virtqueue_init(VAR_0, VAR_0->vqs + VAR_3, VAR_3);",
"if (VAR_4 < 0) {",
"goto fail_vq;",
"}",
"}",
"VAR_0->features = features;",
"VAR_0->memory_listener = (MemoryListener) {",
".begin = vhost_begin,\n.commit = vhost_commit,\n.region_add = vhost_region_add,\n.region_del = vhost_region_del,\n.region_nop = vhost_region_nop,\n.log_start = vhost_log_start,\n.log_stop = vhost_log_stop,\n.log_sync = vhost_log_sync,\n.log_global_start = vhost_log_global_start,\n.log_global_stop = vhost_log_global_stop,\n.eventfd_add = vhost_eventfd_add,\n.eventfd_del = vhost_eventfd_del,\n.priority = 10\n};",
"VAR_0->migration_blocker = NULL;",
"if (!(VAR_0->features & (0x1ULL << VHOST_F_LOG_ALL))) {",
"error_setg(&VAR_0->migration_blocker,\n\"Migration disabled: vhost lacks VHOST_F_LOG_ALL feature.\");",
"migrate_add_blocker(VAR_0->migration_blocker);",
"}",
"VAR_0->mem = g_malloc0(offsetof(struct vhost_memory, regions));",
"VAR_0->n_mem_sections = 0;",
"VAR_0->mem_sections = NULL;",
"VAR_0->log = NULL;",
"VAR_0->log_size = 0;",
"VAR_0->log_enabled = false;",
"VAR_0->started = false;",
"VAR_0->memory_changed = false;",
"memory_listener_register(&VAR_0->memory_listener, &address_space_memory);",
"return 0;",
"fail_vq:\nwhile (--VAR_3 >= 0) {",
"vhost_virtqueue_cleanup(VAR_0->vqs + VAR_3);",
"}",
"fail:\nVAR_4 = -errno;",
"VAR_0->vhost_ops->vhost_backend_cleanup(VAR_0);",
"return VAR_4;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71,
73,
75,
77,
79,
81,
83,
85,
87,
89,
91,
93,
95,
97
],
[
99
],
[
101
],
[
103,
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131,
133
],
[
135
],
[
137
],
[
139,
141
],
[
143
],
[
145
],
[
147
]
] |
1,489 | static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg1,
tcg_target_long arg2)
{
uint8_t *old_code_ptr = s->code_ptr;
if (type == TCG_TYPE_I32) {
tcg_out_op_t(s, INDEX_op_ld_i32);
tcg_out_r(s, ret);
tcg_out_r(s, arg1);
tcg_out32(s, arg2);
} else {
assert(type == TCG_TYPE_I64);
#if TCG_TARGET_REG_BITS == 64
tcg_out_op_t(s, INDEX_op_ld_i64);
tcg_out_r(s, ret);
tcg_out_r(s, arg1);
assert(arg2 == (uint32_t)arg2);
tcg_out32(s, arg2);
#else
TODO();
#endif
}
old_code_ptr[1] = s->code_ptr - old_code_ptr;
}
| false | qemu | 03fc0548b70393b0c8d43703591a9e34fb8e3123 | static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg1,
tcg_target_long arg2)
{
uint8_t *old_code_ptr = s->code_ptr;
if (type == TCG_TYPE_I32) {
tcg_out_op_t(s, INDEX_op_ld_i32);
tcg_out_r(s, ret);
tcg_out_r(s, arg1);
tcg_out32(s, arg2);
} else {
assert(type == TCG_TYPE_I64);
#if TCG_TARGET_REG_BITS == 64
tcg_out_op_t(s, INDEX_op_ld_i64);
tcg_out_r(s, ret);
tcg_out_r(s, arg1);
assert(arg2 == (uint32_t)arg2);
tcg_out32(s, arg2);
#else
TODO();
#endif
}
old_code_ptr[1] = s->code_ptr - old_code_ptr;
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(TCGContext *VAR_0, TCGType VAR_1, TCGReg VAR_2, TCGReg VAR_3,
tcg_target_long VAR_4)
{
uint8_t *old_code_ptr = VAR_0->code_ptr;
if (VAR_1 == TCG_TYPE_I32) {
tcg_out_op_t(VAR_0, INDEX_op_ld_i32);
tcg_out_r(VAR_0, VAR_2);
tcg_out_r(VAR_0, VAR_3);
tcg_out32(VAR_0, VAR_4);
} else {
assert(VAR_1 == TCG_TYPE_I64);
#if TCG_TARGET_REG_BITS == 64
tcg_out_op_t(VAR_0, INDEX_op_ld_i64);
tcg_out_r(VAR_0, VAR_2);
tcg_out_r(VAR_0, VAR_3);
assert(VAR_4 == (uint32_t)VAR_4);
tcg_out32(VAR_0, VAR_4);
#else
TODO();
#endif
}
old_code_ptr[1] = VAR_0->code_ptr - old_code_ptr;
}
| [
"static void FUNC_0(TCGContext *VAR_0, TCGType VAR_1, TCGReg VAR_2, TCGReg VAR_3,\ntcg_target_long VAR_4)\n{",
"uint8_t *old_code_ptr = VAR_0->code_ptr;",
"if (VAR_1 == TCG_TYPE_I32) {",
"tcg_out_op_t(VAR_0, INDEX_op_ld_i32);",
"tcg_out_r(VAR_0, VAR_2);",
"tcg_out_r(VAR_0, VAR_3);",
"tcg_out32(VAR_0, VAR_4);",
"} else {",
"assert(VAR_1 == TCG_TYPE_I64);",
"#if TCG_TARGET_REG_BITS == 64\ntcg_out_op_t(VAR_0, INDEX_op_ld_i64);",
"tcg_out_r(VAR_0, VAR_2);",
"tcg_out_r(VAR_0, VAR_3);",
"assert(VAR_4 == (uint32_t)VAR_4);",
"tcg_out32(VAR_0, VAR_4);",
"#else\nTODO();",
"#endif\n}",
"old_code_ptr[1] = VAR_0->code_ptr - old_code_ptr;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23,
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35,
37
],
[
39,
41
],
[
43
],
[
45
]
] |
1,490 | static int tight_send_framebuffer_update(VncState *vs, int x, int y,
int w, int h)
{
int max_rows;
if (vs->clientds.pf.bytes_per_pixel == 4 && vs->clientds.pf.rmax == 0xFF &&
vs->clientds.pf.bmax == 0xFF && vs->clientds.pf.gmax == 0xFF) {
vs->tight.pixel24 = true;
} else {
vs->tight.pixel24 = false;
}
if (vs->tight.quality != -1) {
double freq = vnc_update_freq(vs, x, y, w, h);
if (freq > tight_jpeg_conf[vs->tight.quality].jpeg_freq_threshold) {
return send_rect_simple(vs, x, y, w, h, false);
}
}
if (w * h < VNC_TIGHT_MIN_SPLIT_RECT_SIZE) {
return send_rect_simple(vs, x, y, w, h, true);
}
/* Calculate maximum number of rows in one non-solid rectangle. */
max_rows = tight_conf[vs->tight.compression].max_rect_size;
max_rows /= MIN(tight_conf[vs->tight.compression].max_rect_width, w);
return find_large_solid_color_rect(vs, x, y, w, h, max_rows);
}
| false | qemu | 368d25881c94f9e09ef19a3d93e8fec797dbcd05 | static int tight_send_framebuffer_update(VncState *vs, int x, int y,
int w, int h)
{
int max_rows;
if (vs->clientds.pf.bytes_per_pixel == 4 && vs->clientds.pf.rmax == 0xFF &&
vs->clientds.pf.bmax == 0xFF && vs->clientds.pf.gmax == 0xFF) {
vs->tight.pixel24 = true;
} else {
vs->tight.pixel24 = false;
}
if (vs->tight.quality != -1) {
double freq = vnc_update_freq(vs, x, y, w, h);
if (freq > tight_jpeg_conf[vs->tight.quality].jpeg_freq_threshold) {
return send_rect_simple(vs, x, y, w, h, false);
}
}
if (w * h < VNC_TIGHT_MIN_SPLIT_RECT_SIZE) {
return send_rect_simple(vs, x, y, w, h, true);
}
max_rows = tight_conf[vs->tight.compression].max_rect_size;
max_rows /= MIN(tight_conf[vs->tight.compression].max_rect_width, w);
return find_large_solid_color_rect(vs, x, y, w, h, max_rows);
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2,
int VAR_3, int VAR_4)
{
int VAR_5;
if (VAR_0->clientds.pf.bytes_per_pixel == 4 && VAR_0->clientds.pf.rmax == 0xFF &&
VAR_0->clientds.pf.bmax == 0xFF && VAR_0->clientds.pf.gmax == 0xFF) {
VAR_0->tight.pixel24 = true;
} else {
VAR_0->tight.pixel24 = false;
}
if (VAR_0->tight.quality != -1) {
double VAR_6 = vnc_update_freq(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);
if (VAR_6 > tight_jpeg_conf[VAR_0->tight.quality].jpeg_freq_threshold) {
return send_rect_simple(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, false);
}
}
if (VAR_3 * VAR_4 < VNC_TIGHT_MIN_SPLIT_RECT_SIZE) {
return send_rect_simple(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, true);
}
VAR_5 = tight_conf[VAR_0->tight.compression].max_rect_size;
VAR_5 /= MIN(tight_conf[VAR_0->tight.compression].max_rect_width, VAR_3);
return find_large_solid_color_rect(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5);
}
| [
"static int FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int VAR_4)\n{",
"int VAR_5;",
"if (VAR_0->clientds.pf.bytes_per_pixel == 4 && VAR_0->clientds.pf.rmax == 0xFF &&\nVAR_0->clientds.pf.bmax == 0xFF && VAR_0->clientds.pf.gmax == 0xFF) {",
"VAR_0->tight.pixel24 = true;",
"} else {",
"VAR_0->tight.pixel24 = false;",
"}",
"if (VAR_0->tight.quality != -1) {",
"double VAR_6 = vnc_update_freq(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);",
"if (VAR_6 > tight_jpeg_conf[VAR_0->tight.quality].jpeg_freq_threshold) {",
"return send_rect_simple(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, false);",
"}",
"}",
"if (VAR_3 * VAR_4 < VNC_TIGHT_MIN_SPLIT_RECT_SIZE) {",
"return send_rect_simple(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, true);",
"}",
"VAR_5 = tight_conf[VAR_0->tight.compression].max_rect_size;",
"VAR_5 /= MIN(tight_conf[VAR_0->tight.compression].max_rect_width, VAR_3);",
"return find_large_solid_color_rect(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
11,
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43
],
[
45
],
[
53
],
[
55
],
[
59
],
[
61
]
] |
1,491 | void helper_booke206_tlbwe(CPUPPCState *env)
{
PowerPCCPU *cpu = ppc_env_get_cpu(env);
uint32_t tlbncfg, tlbn;
ppcmas_tlb_t *tlb;
uint32_t size_tlb, size_ps;
target_ulong mask;
switch (env->spr[SPR_BOOKE_MAS0] & MAS0_WQ_MASK) {
case MAS0_WQ_ALWAYS:
/* good to go, write that entry */
break;
case MAS0_WQ_COND:
/* XXX check if reserved */
if (0) {
return;
}
break;
case MAS0_WQ_CLR_RSRV:
/* XXX clear entry */
return;
default:
/* no idea what to do */
return;
}
if (((env->spr[SPR_BOOKE_MAS0] & MAS0_ATSEL) == MAS0_ATSEL_LRAT) &&
!msr_gs) {
/* XXX we don't support direct LRAT setting yet */
fprintf(stderr, "cpu: don't support LRAT setting yet\n");
return;
}
tlbn = (env->spr[SPR_BOOKE_MAS0] & MAS0_TLBSEL_MASK) >> MAS0_TLBSEL_SHIFT;
tlbncfg = env->spr[SPR_BOOKE_TLB0CFG + tlbn];
tlb = booke206_cur_tlb(env);
if (!tlb) {
raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM,
POWERPC_EXCP_INVAL |
POWERPC_EXCP_INVAL_INVAL, GETPC());
}
/* check that we support the targeted size */
size_tlb = (env->spr[SPR_BOOKE_MAS1] & MAS1_TSIZE_MASK) >> MAS1_TSIZE_SHIFT;
size_ps = booke206_tlbnps(env, tlbn);
if ((env->spr[SPR_BOOKE_MAS1] & MAS1_VALID) && (tlbncfg & TLBnCFG_AVAIL) &&
!(size_ps & (1 << size_tlb))) {
raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM,
POWERPC_EXCP_INVAL |
POWERPC_EXCP_INVAL_INVAL, GETPC());
}
if (msr_gs) {
cpu_abort(CPU(cpu), "missing HV implementation\n");
}
tlb->mas7_3 = ((uint64_t)env->spr[SPR_BOOKE_MAS7] << 32) |
env->spr[SPR_BOOKE_MAS3];
tlb->mas1 = env->spr[SPR_BOOKE_MAS1];
if ((env->spr[SPR_MMUCFG] & MMUCFG_MAVN) == MMUCFG_MAVN_V2) {
/* For TLB which has a fixed size TSIZE is ignored with MAV2 */
booke206_fixed_size_tlbn(env, tlbn, tlb);
} else {
if (!(tlbncfg & TLBnCFG_AVAIL)) {
/* force !AVAIL TLB entries to correct page size */
tlb->mas1 &= ~MAS1_TSIZE_MASK;
/* XXX can be configured in MMUCSR0 */
tlb->mas1 |= (tlbncfg & TLBnCFG_MINSIZE) >> 12;
}
}
/* Make a mask from TLB size to discard invalid bits in EPN field */
mask = ~(booke206_tlb_to_page_size(env, tlb) - 1);
/* Add a mask for page attributes */
mask |= MAS2_ACM | MAS2_VLE | MAS2_W | MAS2_I | MAS2_M | MAS2_G | MAS2_E;
if (!msr_cm) {
/* Executing a tlbwe instruction in 32-bit mode will set
* bits 0:31 of the TLB EPN field to zero.
*/
mask &= 0xffffffff;
}
tlb->mas2 = env->spr[SPR_BOOKE_MAS2] & mask;
if (!(tlbncfg & TLBnCFG_IPROT)) {
/* no IPROT supported by TLB */
tlb->mas1 &= ~MAS1_IPROT;
}
if (booke206_tlb_to_page_size(env, tlb) == TARGET_PAGE_SIZE) {
tlb_flush_page(CPU(cpu), tlb->mas2 & MAS2_EPN_MASK);
} else {
tlb_flush(CPU(cpu));
}
}
| false | qemu | 2e569845bd314fc1dde83d65dc9b87e71b4d29b4 | void helper_booke206_tlbwe(CPUPPCState *env)
{
PowerPCCPU *cpu = ppc_env_get_cpu(env);
uint32_t tlbncfg, tlbn;
ppcmas_tlb_t *tlb;
uint32_t size_tlb, size_ps;
target_ulong mask;
switch (env->spr[SPR_BOOKE_MAS0] & MAS0_WQ_MASK) {
case MAS0_WQ_ALWAYS:
break;
case MAS0_WQ_COND:
if (0) {
return;
}
break;
case MAS0_WQ_CLR_RSRV:
return;
default:
return;
}
if (((env->spr[SPR_BOOKE_MAS0] & MAS0_ATSEL) == MAS0_ATSEL_LRAT) &&
!msr_gs) {
fprintf(stderr, "cpu: don't support LRAT setting yet\n");
return;
}
tlbn = (env->spr[SPR_BOOKE_MAS0] & MAS0_TLBSEL_MASK) >> MAS0_TLBSEL_SHIFT;
tlbncfg = env->spr[SPR_BOOKE_TLB0CFG + tlbn];
tlb = booke206_cur_tlb(env);
if (!tlb) {
raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM,
POWERPC_EXCP_INVAL |
POWERPC_EXCP_INVAL_INVAL, GETPC());
}
size_tlb = (env->spr[SPR_BOOKE_MAS1] & MAS1_TSIZE_MASK) >> MAS1_TSIZE_SHIFT;
size_ps = booke206_tlbnps(env, tlbn);
if ((env->spr[SPR_BOOKE_MAS1] & MAS1_VALID) && (tlbncfg & TLBnCFG_AVAIL) &&
!(size_ps & (1 << size_tlb))) {
raise_exception_err_ra(env, POWERPC_EXCP_PROGRAM,
POWERPC_EXCP_INVAL |
POWERPC_EXCP_INVAL_INVAL, GETPC());
}
if (msr_gs) {
cpu_abort(CPU(cpu), "missing HV implementation\n");
}
tlb->mas7_3 = ((uint64_t)env->spr[SPR_BOOKE_MAS7] << 32) |
env->spr[SPR_BOOKE_MAS3];
tlb->mas1 = env->spr[SPR_BOOKE_MAS1];
if ((env->spr[SPR_MMUCFG] & MMUCFG_MAVN) == MMUCFG_MAVN_V2) {
booke206_fixed_size_tlbn(env, tlbn, tlb);
} else {
if (!(tlbncfg & TLBnCFG_AVAIL)) {
tlb->mas1 &= ~MAS1_TSIZE_MASK;
tlb->mas1 |= (tlbncfg & TLBnCFG_MINSIZE) >> 12;
}
}
mask = ~(booke206_tlb_to_page_size(env, tlb) - 1);
mask |= MAS2_ACM | MAS2_VLE | MAS2_W | MAS2_I | MAS2_M | MAS2_G | MAS2_E;
if (!msr_cm) {
mask &= 0xffffffff;
}
tlb->mas2 = env->spr[SPR_BOOKE_MAS2] & mask;
if (!(tlbncfg & TLBnCFG_IPROT)) {
tlb->mas1 &= ~MAS1_IPROT;
}
if (booke206_tlb_to_page_size(env, tlb) == TARGET_PAGE_SIZE) {
tlb_flush_page(CPU(cpu), tlb->mas2 & MAS2_EPN_MASK);
} else {
tlb_flush(CPU(cpu));
}
}
| {
"code": [],
"line_no": []
} | void FUNC_0(CPUPPCState *VAR_0)
{
PowerPCCPU *cpu = ppc_env_get_cpu(VAR_0);
uint32_t tlbncfg, tlbn;
ppcmas_tlb_t *tlb;
uint32_t size_tlb, size_ps;
target_ulong mask;
switch (VAR_0->spr[SPR_BOOKE_MAS0] & MAS0_WQ_MASK) {
case MAS0_WQ_ALWAYS:
break;
case MAS0_WQ_COND:
if (0) {
return;
}
break;
case MAS0_WQ_CLR_RSRV:
return;
default:
return;
}
if (((VAR_0->spr[SPR_BOOKE_MAS0] & MAS0_ATSEL) == MAS0_ATSEL_LRAT) &&
!msr_gs) {
fprintf(stderr, "cpu: don't support LRAT setting yet\n");
return;
}
tlbn = (VAR_0->spr[SPR_BOOKE_MAS0] & MAS0_TLBSEL_MASK) >> MAS0_TLBSEL_SHIFT;
tlbncfg = VAR_0->spr[SPR_BOOKE_TLB0CFG + tlbn];
tlb = booke206_cur_tlb(VAR_0);
if (!tlb) {
raise_exception_err_ra(VAR_0, POWERPC_EXCP_PROGRAM,
POWERPC_EXCP_INVAL |
POWERPC_EXCP_INVAL_INVAL, GETPC());
}
size_tlb = (VAR_0->spr[SPR_BOOKE_MAS1] & MAS1_TSIZE_MASK) >> MAS1_TSIZE_SHIFT;
size_ps = booke206_tlbnps(VAR_0, tlbn);
if ((VAR_0->spr[SPR_BOOKE_MAS1] & MAS1_VALID) && (tlbncfg & TLBnCFG_AVAIL) &&
!(size_ps & (1 << size_tlb))) {
raise_exception_err_ra(VAR_0, POWERPC_EXCP_PROGRAM,
POWERPC_EXCP_INVAL |
POWERPC_EXCP_INVAL_INVAL, GETPC());
}
if (msr_gs) {
cpu_abort(CPU(cpu), "missing HV implementation\n");
}
tlb->mas7_3 = ((uint64_t)VAR_0->spr[SPR_BOOKE_MAS7] << 32) |
VAR_0->spr[SPR_BOOKE_MAS3];
tlb->mas1 = VAR_0->spr[SPR_BOOKE_MAS1];
if ((VAR_0->spr[SPR_MMUCFG] & MMUCFG_MAVN) == MMUCFG_MAVN_V2) {
booke206_fixed_size_tlbn(VAR_0, tlbn, tlb);
} else {
if (!(tlbncfg & TLBnCFG_AVAIL)) {
tlb->mas1 &= ~MAS1_TSIZE_MASK;
tlb->mas1 |= (tlbncfg & TLBnCFG_MINSIZE) >> 12;
}
}
mask = ~(booke206_tlb_to_page_size(VAR_0, tlb) - 1);
mask |= MAS2_ACM | MAS2_VLE | MAS2_W | MAS2_I | MAS2_M | MAS2_G | MAS2_E;
if (!msr_cm) {
mask &= 0xffffffff;
}
tlb->mas2 = VAR_0->spr[SPR_BOOKE_MAS2] & mask;
if (!(tlbncfg & TLBnCFG_IPROT)) {
tlb->mas1 &= ~MAS1_IPROT;
}
if (booke206_tlb_to_page_size(VAR_0, tlb) == TARGET_PAGE_SIZE) {
tlb_flush_page(CPU(cpu), tlb->mas2 & MAS2_EPN_MASK);
} else {
tlb_flush(CPU(cpu));
}
}
| [
"void FUNC_0(CPUPPCState *VAR_0)\n{",
"PowerPCCPU *cpu = ppc_env_get_cpu(VAR_0);",
"uint32_t tlbncfg, tlbn;",
"ppcmas_tlb_t *tlb;",
"uint32_t size_tlb, size_ps;",
"target_ulong mask;",
"switch (VAR_0->spr[SPR_BOOKE_MAS0] & MAS0_WQ_MASK) {",
"case MAS0_WQ_ALWAYS:\nbreak;",
"case MAS0_WQ_COND:\nif (0) {",
"return;",
"}",
"break;",
"case MAS0_WQ_CLR_RSRV:\nreturn;",
"default:\nreturn;",
"}",
"if (((VAR_0->spr[SPR_BOOKE_MAS0] & MAS0_ATSEL) == MAS0_ATSEL_LRAT) &&\n!msr_gs) {",
"fprintf(stderr, \"cpu: don't support LRAT setting yet\\n\");",
"return;",
"}",
"tlbn = (VAR_0->spr[SPR_BOOKE_MAS0] & MAS0_TLBSEL_MASK) >> MAS0_TLBSEL_SHIFT;",
"tlbncfg = VAR_0->spr[SPR_BOOKE_TLB0CFG + tlbn];",
"tlb = booke206_cur_tlb(VAR_0);",
"if (!tlb) {",
"raise_exception_err_ra(VAR_0, POWERPC_EXCP_PROGRAM,\nPOWERPC_EXCP_INVAL |\nPOWERPC_EXCP_INVAL_INVAL, GETPC());",
"}",
"size_tlb = (VAR_0->spr[SPR_BOOKE_MAS1] & MAS1_TSIZE_MASK) >> MAS1_TSIZE_SHIFT;",
"size_ps = booke206_tlbnps(VAR_0, tlbn);",
"if ((VAR_0->spr[SPR_BOOKE_MAS1] & MAS1_VALID) && (tlbncfg & TLBnCFG_AVAIL) &&\n!(size_ps & (1 << size_tlb))) {",
"raise_exception_err_ra(VAR_0, POWERPC_EXCP_PROGRAM,\nPOWERPC_EXCP_INVAL |\nPOWERPC_EXCP_INVAL_INVAL, GETPC());",
"}",
"if (msr_gs) {",
"cpu_abort(CPU(cpu), \"missing HV implementation\\n\");",
"}",
"tlb->mas7_3 = ((uint64_t)VAR_0->spr[SPR_BOOKE_MAS7] << 32) |\nVAR_0->spr[SPR_BOOKE_MAS3];",
"tlb->mas1 = VAR_0->spr[SPR_BOOKE_MAS1];",
"if ((VAR_0->spr[SPR_MMUCFG] & MMUCFG_MAVN) == MMUCFG_MAVN_V2) {",
"booke206_fixed_size_tlbn(VAR_0, tlbn, tlb);",
"} else {",
"if (!(tlbncfg & TLBnCFG_AVAIL)) {",
"tlb->mas1 &= ~MAS1_TSIZE_MASK;",
"tlb->mas1 |= (tlbncfg & TLBnCFG_MINSIZE) >> 12;",
"}",
"}",
"mask = ~(booke206_tlb_to_page_size(VAR_0, tlb) - 1);",
"mask |= MAS2_ACM | MAS2_VLE | MAS2_W | MAS2_I | MAS2_M | MAS2_G | MAS2_E;",
"if (!msr_cm) {",
"mask &= 0xffffffff;",
"}",
"tlb->mas2 = VAR_0->spr[SPR_BOOKE_MAS2] & mask;",
"if (!(tlbncfg & TLBnCFG_IPROT)) {",
"tlb->mas1 &= ~MAS1_IPROT;",
"}",
"if (booke206_tlb_to_page_size(VAR_0, tlb) == TARGET_PAGE_SIZE) {",
"tlb_flush_page(CPU(cpu), tlb->mas2 & MAS2_EPN_MASK);",
"} else {",
"tlb_flush(CPU(cpu));",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
19
],
[
21,
25
],
[
27,
31
],
[
33
],
[
35
],
[
37
],
[
39,
43
],
[
45,
49
],
[
51
],
[
55,
57
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71
],
[
75
],
[
79
],
[
81,
83,
85
],
[
87
],
[
93
],
[
95
],
[
97,
99
],
[
101,
103,
105
],
[
107
],
[
111
],
[
113
],
[
115
],
[
117,
119
],
[
121
],
[
125
],
[
129
],
[
131
],
[
133
],
[
137
],
[
141
],
[
143
],
[
145
],
[
151
],
[
155
],
[
159
],
[
167
],
[
169
],
[
173
],
[
177
],
[
181
],
[
183
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
]
] |
1,492 | static uint32_t qpi_mem_readl(void *opaque, target_phys_addr_t addr)
{
CPUState *env;
env = cpu_single_env;
if (!env)
return 0;
return env->eflags & (IF_MASK | IOPL_MASK);
}
| false | qemu | 4a1418e07bdcfaa3177739e04707ecaec75d89e1 | static uint32_t qpi_mem_readl(void *opaque, target_phys_addr_t addr)
{
CPUState *env;
env = cpu_single_env;
if (!env)
return 0;
return env->eflags & (IF_MASK | IOPL_MASK);
}
| {
"code": [],
"line_no": []
} | static uint32_t FUNC_0(void *opaque, target_phys_addr_t addr)
{
CPUState *env;
env = cpu_single_env;
if (!env)
return 0;
return env->eflags & (IF_MASK | IOPL_MASK);
}
| [
"static uint32_t FUNC_0(void *opaque, target_phys_addr_t addr)\n{",
"CPUState *env;",
"env = cpu_single_env;",
"if (!env)\nreturn 0;",
"return env->eflags & (IF_MASK | IOPL_MASK);",
"}"
] | [
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11,
13
],
[
15
],
[
17
]
] |
1,493 | static void test_visitor_out_number(TestOutputVisitorData *data,
const void *unused)
{
double value = 3.14;
QObject *obj;
visit_type_number(data->ov, NULL, &value, &error_abort);
obj = visitor_get(data);
g_assert(qobject_type(obj) == QTYPE_QFLOAT);
g_assert(qfloat_get_double(qobject_to_qfloat(obj)) == value);
}
| false | qemu | 8978b34af3250354e0b67340a7e920f909beda13 | static void test_visitor_out_number(TestOutputVisitorData *data,
const void *unused)
{
double value = 3.14;
QObject *obj;
visit_type_number(data->ov, NULL, &value, &error_abort);
obj = visitor_get(data);
g_assert(qobject_type(obj) == QTYPE_QFLOAT);
g_assert(qfloat_get_double(qobject_to_qfloat(obj)) == value);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(TestOutputVisitorData *VAR_0,
const void *VAR_1)
{
double VAR_2 = 3.14;
QObject *obj;
visit_type_number(VAR_0->ov, NULL, &VAR_2, &error_abort);
obj = visitor_get(VAR_0);
g_assert(qobject_type(obj) == QTYPE_QFLOAT);
g_assert(qfloat_get_double(qobject_to_qfloat(obj)) == VAR_2);
}
| [
"static void FUNC_0(TestOutputVisitorData *VAR_0,\nconst void *VAR_1)\n{",
"double VAR_2 = 3.14;",
"QObject *obj;",
"visit_type_number(VAR_0->ov, NULL, &VAR_2, &error_abort);",
"obj = visitor_get(VAR_0);",
"g_assert(qobject_type(obj) == QTYPE_QFLOAT);",
"g_assert(qfloat_get_double(qobject_to_qfloat(obj)) == VAR_2);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
]
] |
1,494 | static int find_pte32(CPUPPCState *env, struct mmu_ctx_hash32 *ctx,
target_ulong eaddr, int h, int rwx, int target_page_bits)
{
hwaddr pteg_off;
target_ulong pte0, pte1;
int i, good = -1;
int ret, r;
ret = -1; /* No entry found */
pteg_off = get_pteg_offset32(env, ctx->hash[h]);
for (i = 0; i < HPTES_PER_GROUP; i++) {
pte0 = ppc_hash32_load_hpte0(env, pteg_off + i*HASH_PTE_SIZE_32);
pte1 = ppc_hash32_load_hpte1(env, pteg_off + i*HASH_PTE_SIZE_32);
r = pte_check_hash32(ctx, pte0, pte1, h, rwx);
LOG_MMU("Load pte from %08" HWADDR_PRIx " => " TARGET_FMT_lx " "
TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n",
pteg_off + (i * 8), pte0, pte1, (int)(pte0 >> 31), h,
(int)((pte0 >> 6) & 1), ctx->ptem);
switch (r) {
case -3:
/* PTE inconsistency */
return -1;
case -2:
/* Access violation */
ret = -2;
good = i;
break;
case -1:
default:
/* No PTE match */
break;
case 0:
/* access granted */
/* XXX: we should go on looping to check all PTEs consistency
* but if we can speed-up the whole thing as the
* result would be undefined if PTEs are not consistent.
*/
ret = 0;
good = i;
goto done;
}
}
if (good != -1) {
done:
LOG_MMU("found PTE at addr %08" HWADDR_PRIx " prot=%01x ret=%d\n",
ctx->raddr, ctx->prot, ret);
/* Update page flags */
pte1 = ctx->raddr;
if (ppc_hash32_pte_update_flags(ctx, &pte1, ret, rwx) == 1) {
ppc_hash32_store_hpte1(env, pteg_off + good * HASH_PTE_SIZE_32,
pte1);
}
}
/* We have a TLB that saves 4K pages, so let's
* split a huge page to 4k chunks */
if (target_page_bits != TARGET_PAGE_BITS) {
ctx->raddr |= (eaddr & ((1 << target_page_bits) - 1))
& TARGET_PAGE_MASK;
}
return ret;
}
| false | qemu | f95d7cc7fecbc0e320e83c864ce2d99fee3d9236 | static int find_pte32(CPUPPCState *env, struct mmu_ctx_hash32 *ctx,
target_ulong eaddr, int h, int rwx, int target_page_bits)
{
hwaddr pteg_off;
target_ulong pte0, pte1;
int i, good = -1;
int ret, r;
ret = -1;
pteg_off = get_pteg_offset32(env, ctx->hash[h]);
for (i = 0; i < HPTES_PER_GROUP; i++) {
pte0 = ppc_hash32_load_hpte0(env, pteg_off + i*HASH_PTE_SIZE_32);
pte1 = ppc_hash32_load_hpte1(env, pteg_off + i*HASH_PTE_SIZE_32);
r = pte_check_hash32(ctx, pte0, pte1, h, rwx);
LOG_MMU("Load pte from %08" HWADDR_PRIx " => " TARGET_FMT_lx " "
TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n",
pteg_off + (i * 8), pte0, pte1, (int)(pte0 >> 31), h,
(int)((pte0 >> 6) & 1), ctx->ptem);
switch (r) {
case -3:
return -1;
case -2:
ret = -2;
good = i;
break;
case -1:
default:
break;
case 0:
ret = 0;
good = i;
goto done;
}
}
if (good != -1) {
done:
LOG_MMU("found PTE at addr %08" HWADDR_PRIx " prot=%01x ret=%d\n",
ctx->raddr, ctx->prot, ret);
pte1 = ctx->raddr;
if (ppc_hash32_pte_update_flags(ctx, &pte1, ret, rwx) == 1) {
ppc_hash32_store_hpte1(env, pteg_off + good * HASH_PTE_SIZE_32,
pte1);
}
}
if (target_page_bits != TARGET_PAGE_BITS) {
ctx->raddr |= (eaddr & ((1 << target_page_bits) - 1))
& TARGET_PAGE_MASK;
}
return ret;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(CPUPPCState *VAR_0, struct mmu_ctx_hash32 *VAR_1,
target_ulong VAR_2, int VAR_3, int VAR_4, int VAR_5)
{
hwaddr pteg_off;
target_ulong pte0, pte1;
int VAR_6, VAR_7 = -1;
int VAR_8, VAR_9;
VAR_8 = -1;
pteg_off = get_pteg_offset32(VAR_0, VAR_1->hash[VAR_3]);
for (VAR_6 = 0; VAR_6 < HPTES_PER_GROUP; VAR_6++) {
pte0 = ppc_hash32_load_hpte0(VAR_0, pteg_off + VAR_6*HASH_PTE_SIZE_32);
pte1 = ppc_hash32_load_hpte1(VAR_0, pteg_off + VAR_6*HASH_PTE_SIZE_32);
VAR_9 = pte_check_hash32(VAR_1, pte0, pte1, VAR_3, VAR_4);
LOG_MMU("Load pte from %08" HWADDR_PRIx " => " TARGET_FMT_lx " "
TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n",
pteg_off + (VAR_6 * 8), pte0, pte1, (int)(pte0 >> 31), VAR_3,
(int)((pte0 >> 6) & 1), VAR_1->ptem);
switch (VAR_9) {
case -3:
return -1;
case -2:
VAR_8 = -2;
VAR_7 = VAR_6;
break;
case -1:
default:
break;
case 0:
VAR_8 = 0;
VAR_7 = VAR_6;
goto done;
}
}
if (VAR_7 != -1) {
done:
LOG_MMU("found PTE at addr %08" HWADDR_PRIx " prot=%01x VAR_8=%d\n",
VAR_1->raddr, VAR_1->prot, VAR_8);
pte1 = VAR_1->raddr;
if (ppc_hash32_pte_update_flags(VAR_1, &pte1, VAR_8, VAR_4) == 1) {
ppc_hash32_store_hpte1(VAR_0, pteg_off + VAR_7 * HASH_PTE_SIZE_32,
pte1);
}
}
if (VAR_5 != TARGET_PAGE_BITS) {
VAR_1->raddr |= (VAR_2 & ((1 << VAR_5) - 1))
& TARGET_PAGE_MASK;
}
return VAR_8;
}
| [
"static int FUNC_0(CPUPPCState *VAR_0, struct mmu_ctx_hash32 *VAR_1,\ntarget_ulong VAR_2, int VAR_3, int VAR_4, int VAR_5)\n{",
"hwaddr pteg_off;",
"target_ulong pte0, pte1;",
"int VAR_6, VAR_7 = -1;",
"int VAR_8, VAR_9;",
"VAR_8 = -1;",
"pteg_off = get_pteg_offset32(VAR_0, VAR_1->hash[VAR_3]);",
"for (VAR_6 = 0; VAR_6 < HPTES_PER_GROUP; VAR_6++) {",
"pte0 = ppc_hash32_load_hpte0(VAR_0, pteg_off + VAR_6*HASH_PTE_SIZE_32);",
"pte1 = ppc_hash32_load_hpte1(VAR_0, pteg_off + VAR_6*HASH_PTE_SIZE_32);",
"VAR_9 = pte_check_hash32(VAR_1, pte0, pte1, VAR_3, VAR_4);",
"LOG_MMU(\"Load pte from %08\" HWADDR_PRIx \" => \" TARGET_FMT_lx \" \"\nTARGET_FMT_lx \" %d %d %d \" TARGET_FMT_lx \"\\n\",\npteg_off + (VAR_6 * 8), pte0, pte1, (int)(pte0 >> 31), VAR_3,\n(int)((pte0 >> 6) & 1), VAR_1->ptem);",
"switch (VAR_9) {",
"case -3:\nreturn -1;",
"case -2:\nVAR_8 = -2;",
"VAR_7 = VAR_6;",
"break;",
"case -1:\ndefault:\nbreak;",
"case 0:\nVAR_8 = 0;",
"VAR_7 = VAR_6;",
"goto done;",
"}",
"}",
"if (VAR_7 != -1) {",
"done:\nLOG_MMU(\"found PTE at addr %08\" HWADDR_PRIx \" prot=%01x VAR_8=%d\\n\",\nVAR_1->raddr, VAR_1->prot, VAR_8);",
"pte1 = VAR_1->raddr;",
"if (ppc_hash32_pte_update_flags(VAR_1, &pte1, VAR_8, VAR_4) == 1) {",
"ppc_hash32_store_hpte1(VAR_0, pteg_off + VAR_7 * HASH_PTE_SIZE_32,\npte1);",
"}",
"}",
"if (VAR_5 != TARGET_PAGE_BITS) {",
"VAR_1->raddr |= (VAR_2 & ((1 << VAR_5) - 1))\n& TARGET_PAGE_MASK;",
"}",
"return VAR_8;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29,
31,
33,
35
],
[
37
],
[
39,
43
],
[
45,
49
],
[
51
],
[
53
],
[
55,
57,
61
],
[
63,
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87,
89,
91
],
[
95
],
[
97
],
[
99,
101
],
[
103
],
[
105
],
[
113
],
[
115,
117
],
[
119
],
[
121
],
[
123
]
] |
1,495 | int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
AVPicture dummy_pict;
int ret;
if (!desc)
return AVERROR(EINVAL);
if ((ret = av_image_check_size(width, height, 0, NULL)) < 0)
return ret;
if (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
// do not include palette for these pseudo-paletted formats
return width * height;
return avpicture_fill(&dummy_pict, NULL, pix_fmt, width, height);
}
| false | FFmpeg | e2ad0b66fa273c5c823978e8f601f2c0d9ee42f8 | int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
AVPicture dummy_pict;
int ret;
if (!desc)
return AVERROR(EINVAL);
if ((ret = av_image_check_size(width, height, 0, NULL)) < 0)
return ret;
if (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
return width * height;
return avpicture_fill(&dummy_pict, NULL, pix_fmt, width, height);
}
| {
"code": [],
"line_no": []
} | int FUNC_0(enum AVPixelFormat VAR_0, int VAR_1, int VAR_2)
{
const AVPixFmtDescriptor *VAR_3 = av_pix_fmt_desc_get(VAR_0);
AVPicture dummy_pict;
int VAR_4;
if (!VAR_3)
return AVERROR(EINVAL);
if ((VAR_4 = av_image_check_size(VAR_1, VAR_2, 0, NULL)) < 0)
return VAR_4;
if (VAR_3->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
return VAR_1 * VAR_2;
return avpicture_fill(&dummy_pict, NULL, VAR_0, VAR_1, VAR_2);
}
| [
"int FUNC_0(enum AVPixelFormat VAR_0, int VAR_1, int VAR_2)\n{",
"const AVPixFmtDescriptor *VAR_3 = av_pix_fmt_desc_get(VAR_0);",
"AVPicture dummy_pict;",
"int VAR_4;",
"if (!VAR_3)\nreturn AVERROR(EINVAL);",
"if ((VAR_4 = av_image_check_size(VAR_1, VAR_2, 0, NULL)) < 0)\nreturn VAR_4;",
"if (VAR_3->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)\nreturn VAR_1 * VAR_2;",
"return avpicture_fill(&dummy_pict, NULL, VAR_0, VAR_1, VAR_2);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13,
15
],
[
17,
19
],
[
21,
25
],
[
27
],
[
29
]
] |
1,496 | uint32_t HELPER(testblock)(CPUS390XState *env, uint64_t real_addr)
{
uintptr_t ra = GETPC();
CPUState *cs = CPU(s390_env_get_cpu(env));
int i;
real_addr = wrap_address(env, real_addr) & TARGET_PAGE_MASK;
/* Check low-address protection */
if ((env->cregs[0] & CR0_LOWPROT) && real_addr < 0x2000) {
cpu_restore_state(cs, ra);
program_interrupt(env, PGM_PROTECTION, 4);
return 1;
}
for (i = 0; i < TARGET_PAGE_SIZE; i += 8) {
cpu_stq_real_ra(env, real_addr + i, 0, ra);
}
return 0;
}
| false | qemu | 2bcf018340cbf233f7145e643fc1bb367f23fd90 | uint32_t HELPER(testblock)(CPUS390XState *env, uint64_t real_addr)
{
uintptr_t ra = GETPC();
CPUState *cs = CPU(s390_env_get_cpu(env));
int i;
real_addr = wrap_address(env, real_addr) & TARGET_PAGE_MASK;
if ((env->cregs[0] & CR0_LOWPROT) && real_addr < 0x2000) {
cpu_restore_state(cs, ra);
program_interrupt(env, PGM_PROTECTION, 4);
return 1;
}
for (i = 0; i < TARGET_PAGE_SIZE; i += 8) {
cpu_stq_real_ra(env, real_addr + i, 0, ra);
}
return 0;
}
| {
"code": [],
"line_no": []
} | uint32_t FUNC_0(testblock)(CPUS390XState *env, uint64_t real_addr)
{
uintptr_t ra = GETPC();
CPUState *cs = CPU(s390_env_get_cpu(env));
int VAR_0;
real_addr = wrap_address(env, real_addr) & TARGET_PAGE_MASK;
if ((env->cregs[0] & CR0_LOWPROT) && real_addr < 0x2000) {
cpu_restore_state(cs, ra);
program_interrupt(env, PGM_PROTECTION, 4);
return 1;
}
for (VAR_0 = 0; VAR_0 < TARGET_PAGE_SIZE; VAR_0 += 8) {
cpu_stq_real_ra(env, real_addr + VAR_0, 0, ra);
}
return 0;
}
| [
"uint32_t FUNC_0(testblock)(CPUS390XState *env, uint64_t real_addr)\n{",
"uintptr_t ra = GETPC();",
"CPUState *cs = CPU(s390_env_get_cpu(env));",
"int VAR_0;",
"real_addr = wrap_address(env, real_addr) & TARGET_PAGE_MASK;",
"if ((env->cregs[0] & CR0_LOWPROT) && real_addr < 0x2000) {",
"cpu_restore_state(cs, ra);",
"program_interrupt(env, PGM_PROTECTION, 4);",
"return 1;",
"}",
"for (VAR_0 = 0; VAR_0 < TARGET_PAGE_SIZE; VAR_0 += 8) {",
"cpu_stq_real_ra(env, real_addr + VAR_0, 0, ra);",
"}",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
39
],
[
41
]
] |
1,498 | static void block_dirty_bitmap_add_prepare(BlkActionState *common,
Error **errp)
{
Error *local_err = NULL;
BlockDirtyBitmapAdd *action;
BlockDirtyBitmapState *state = DO_UPCAST(BlockDirtyBitmapState,
common, common);
if (action_check_completion_mode(common, errp) < 0) {
return;
}
action = common->action->u.block_dirty_bitmap_add;
/* AIO context taken and released within qmp_block_dirty_bitmap_add */
qmp_block_dirty_bitmap_add(action->node, action->name,
action->has_granularity, action->granularity,
&local_err);
if (!local_err) {
state->prepared = true;
} else {
error_propagate(errp, local_err);
}
}
| false | qemu | 32bafa8fdd098d52fbf1102d5a5e48d29398c0aa | static void block_dirty_bitmap_add_prepare(BlkActionState *common,
Error **errp)
{
Error *local_err = NULL;
BlockDirtyBitmapAdd *action;
BlockDirtyBitmapState *state = DO_UPCAST(BlockDirtyBitmapState,
common, common);
if (action_check_completion_mode(common, errp) < 0) {
return;
}
action = common->action->u.block_dirty_bitmap_add;
qmp_block_dirty_bitmap_add(action->node, action->name,
action->has_granularity, action->granularity,
&local_err);
if (!local_err) {
state->prepared = true;
} else {
error_propagate(errp, local_err);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(BlkActionState *VAR_0,
Error **VAR_1)
{
Error *local_err = NULL;
BlockDirtyBitmapAdd *action;
BlockDirtyBitmapState *state = DO_UPCAST(BlockDirtyBitmapState,
VAR_0, VAR_0);
if (action_check_completion_mode(VAR_0, VAR_1) < 0) {
return;
}
action = VAR_0->action->u.block_dirty_bitmap_add;
qmp_block_dirty_bitmap_add(action->node, action->name,
action->has_granularity, action->granularity,
&local_err);
if (!local_err) {
state->prepared = true;
} else {
error_propagate(VAR_1, local_err);
}
}
| [
"static void FUNC_0(BlkActionState *VAR_0,\nError **VAR_1)\n{",
"Error *local_err = NULL;",
"BlockDirtyBitmapAdd *action;",
"BlockDirtyBitmapState *state = DO_UPCAST(BlockDirtyBitmapState,\nVAR_0, VAR_0);",
"if (action_check_completion_mode(VAR_0, VAR_1) < 0) {",
"return;",
"}",
"action = VAR_0->action->u.block_dirty_bitmap_add;",
"qmp_block_dirty_bitmap_add(action->node, action->name,\naction->has_granularity, action->granularity,\n&local_err);",
"if (!local_err) {",
"state->prepared = true;",
"} else {",
"error_propagate(VAR_1, local_err);",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11,
13
],
[
17
],
[
19
],
[
21
],
[
25
],
[
29,
31,
33
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
]
] |
1,499 | int32_t scsi_req_enqueue(SCSIRequest *req, uint8_t *buf)
{
int32_t rc;
assert(!req->enqueued);
scsi_req_ref(req);
req->enqueued = true;
QTAILQ_INSERT_TAIL(&req->dev->requests, req, next);
scsi_req_ref(req);
rc = req->ops->send_command(req, buf);
scsi_req_unref(req);
return rc;
}
| false | qemu | c39ce112b60ffafbaf700853e32bea74cbb2c148 | int32_t scsi_req_enqueue(SCSIRequest *req, uint8_t *buf)
{
int32_t rc;
assert(!req->enqueued);
scsi_req_ref(req);
req->enqueued = true;
QTAILQ_INSERT_TAIL(&req->dev->requests, req, next);
scsi_req_ref(req);
rc = req->ops->send_command(req, buf);
scsi_req_unref(req);
return rc;
}
| {
"code": [],
"line_no": []
} | int32_t FUNC_0(SCSIRequest *req, uint8_t *buf)
{
int32_t rc;
assert(!req->enqueued);
scsi_req_ref(req);
req->enqueued = true;
QTAILQ_INSERT_TAIL(&req->dev->requests, req, next);
scsi_req_ref(req);
rc = req->ops->send_command(req, buf);
scsi_req_unref(req);
return rc;
}
| [
"int32_t FUNC_0(SCSIRequest *req, uint8_t *buf)\n{",
"int32_t rc;",
"assert(!req->enqueued);",
"scsi_req_ref(req);",
"req->enqueued = true;",
"QTAILQ_INSERT_TAIL(&req->dev->requests, req, next);",
"scsi_req_ref(req);",
"rc = req->ops->send_command(req, buf);",
"scsi_req_unref(req);",
"return rc;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
]
] |
1,501 | static int sd_parse_uri(BDRVSheepdogState *s, const char *filename,
char *vdi, uint32_t *snapid, char *tag)
{
URI *uri;
QueryParams *qp = NULL;
int ret = 0;
uri = uri_parse(filename);
if (!uri) {
return -EINVAL;
}
/* transport */
if (!strcmp(uri->scheme, "sheepdog")) {
s->is_unix = false;
} else if (!strcmp(uri->scheme, "sheepdog+tcp")) {
s->is_unix = false;
} else if (!strcmp(uri->scheme, "sheepdog+unix")) {
s->is_unix = true;
} else {
ret = -EINVAL;
goto out;
}
if (uri->path == NULL || !strcmp(uri->path, "/")) {
ret = -EINVAL;
goto out;
}
pstrcpy(vdi, SD_MAX_VDI_LEN, uri->path + 1);
qp = query_params_parse(uri->query);
if (qp->n > 1 || (s->is_unix && !qp->n) || (!s->is_unix && qp->n)) {
ret = -EINVAL;
goto out;
}
if (s->is_unix) {
/* sheepdog+unix:///vdiname?socket=path */
if (uri->server || uri->port || strcmp(qp->p[0].name, "socket")) {
ret = -EINVAL;
goto out;
}
s->host_spec = g_strdup(qp->p[0].value);
} else {
/* sheepdog[+tcp]://[host:port]/vdiname */
s->host_spec = g_strdup_printf("%s:%d", uri->server ?: SD_DEFAULT_ADDR,
uri->port ?: SD_DEFAULT_PORT);
}
/* snapshot tag */
if (uri->fragment) {
*snapid = strtoul(uri->fragment, NULL, 10);
if (*snapid == 0) {
pstrcpy(tag, SD_MAX_VDI_TAG_LEN, uri->fragment);
}
} else {
*snapid = CURRENT_VDI_ID; /* search current vdi */
}
out:
if (qp) {
query_params_free(qp);
}
uri_free(uri);
return ret;
}
| false | qemu | 89e2a31d337f96ab8d5b7bdfe4bcce0a25181ed1 | static int sd_parse_uri(BDRVSheepdogState *s, const char *filename,
char *vdi, uint32_t *snapid, char *tag)
{
URI *uri;
QueryParams *qp = NULL;
int ret = 0;
uri = uri_parse(filename);
if (!uri) {
return -EINVAL;
}
if (!strcmp(uri->scheme, "sheepdog")) {
s->is_unix = false;
} else if (!strcmp(uri->scheme, "sheepdog+tcp")) {
s->is_unix = false;
} else if (!strcmp(uri->scheme, "sheepdog+unix")) {
s->is_unix = true;
} else {
ret = -EINVAL;
goto out;
}
if (uri->path == NULL || !strcmp(uri->path, "/")) {
ret = -EINVAL;
goto out;
}
pstrcpy(vdi, SD_MAX_VDI_LEN, uri->path + 1);
qp = query_params_parse(uri->query);
if (qp->n > 1 || (s->is_unix && !qp->n) || (!s->is_unix && qp->n)) {
ret = -EINVAL;
goto out;
}
if (s->is_unix) {
if (uri->server || uri->port || strcmp(qp->p[0].name, "socket")) {
ret = -EINVAL;
goto out;
}
s->host_spec = g_strdup(qp->p[0].value);
} else {
s->host_spec = g_strdup_printf("%s:%d", uri->server ?: SD_DEFAULT_ADDR,
uri->port ?: SD_DEFAULT_PORT);
}
if (uri->fragment) {
*snapid = strtoul(uri->fragment, NULL, 10);
if (*snapid == 0) {
pstrcpy(tag, SD_MAX_VDI_TAG_LEN, uri->fragment);
}
} else {
*snapid = CURRENT_VDI_ID;
}
out:
if (qp) {
query_params_free(qp);
}
uri_free(uri);
return ret;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(BDRVSheepdogState *VAR_0, const char *VAR_1,
char *VAR_2, uint32_t *VAR_3, char *VAR_4)
{
URI *uri;
QueryParams *qp = NULL;
int VAR_5 = 0;
uri = uri_parse(VAR_1);
if (!uri) {
return -EINVAL;
}
if (!strcmp(uri->scheme, "sheepdog")) {
VAR_0->is_unix = false;
} else if (!strcmp(uri->scheme, "sheepdog+tcp")) {
VAR_0->is_unix = false;
} else if (!strcmp(uri->scheme, "sheepdog+unix")) {
VAR_0->is_unix = true;
} else {
VAR_5 = -EINVAL;
goto out;
}
if (uri->path == NULL || !strcmp(uri->path, "/")) {
VAR_5 = -EINVAL;
goto out;
}
pstrcpy(VAR_2, SD_MAX_VDI_LEN, uri->path + 1);
qp = query_params_parse(uri->query);
if (qp->n > 1 || (VAR_0->is_unix && !qp->n) || (!VAR_0->is_unix && qp->n)) {
VAR_5 = -EINVAL;
goto out;
}
if (VAR_0->is_unix) {
if (uri->server || uri->port || strcmp(qp->p[0].name, "socket")) {
VAR_5 = -EINVAL;
goto out;
}
VAR_0->host_spec = g_strdup(qp->p[0].value);
} else {
VAR_0->host_spec = g_strdup_printf("%VAR_0:%d", uri->server ?: SD_DEFAULT_ADDR,
uri->port ?: SD_DEFAULT_PORT);
}
if (uri->fragment) {
*VAR_3 = strtoul(uri->fragment, NULL, 10);
if (*VAR_3 == 0) {
pstrcpy(VAR_4, SD_MAX_VDI_TAG_LEN, uri->fragment);
}
} else {
*VAR_3 = CURRENT_VDI_ID;
}
out:
if (qp) {
query_params_free(qp);
}
uri_free(uri);
return VAR_5;
}
| [
"static int FUNC_0(BDRVSheepdogState *VAR_0, const char *VAR_1,\nchar *VAR_2, uint32_t *VAR_3, char *VAR_4)\n{",
"URI *uri;",
"QueryParams *qp = NULL;",
"int VAR_5 = 0;",
"uri = uri_parse(VAR_1);",
"if (!uri) {",
"return -EINVAL;",
"}",
"if (!strcmp(uri->scheme, \"sheepdog\")) {",
"VAR_0->is_unix = false;",
"} else if (!strcmp(uri->scheme, \"sheepdog+tcp\")) {",
"VAR_0->is_unix = false;",
"} else if (!strcmp(uri->scheme, \"sheepdog+unix\")) {",
"VAR_0->is_unix = true;",
"} else {",
"VAR_5 = -EINVAL;",
"goto out;",
"}",
"if (uri->path == NULL || !strcmp(uri->path, \"/\")) {",
"VAR_5 = -EINVAL;",
"goto out;",
"}",
"pstrcpy(VAR_2, SD_MAX_VDI_LEN, uri->path + 1);",
"qp = query_params_parse(uri->query);",
"if (qp->n > 1 || (VAR_0->is_unix && !qp->n) || (!VAR_0->is_unix && qp->n)) {",
"VAR_5 = -EINVAL;",
"goto out;",
"}",
"if (VAR_0->is_unix) {",
"if (uri->server || uri->port || strcmp(qp->p[0].name, \"socket\")) {",
"VAR_5 = -EINVAL;",
"goto out;",
"}",
"VAR_0->host_spec = g_strdup(qp->p[0].value);",
"} else {",
"VAR_0->host_spec = g_strdup_printf(\"%VAR_0:%d\", uri->server ?: SD_DEFAULT_ADDR,\nuri->port ?: SD_DEFAULT_PORT);",
"}",
"if (uri->fragment) {",
"*VAR_3 = strtoul(uri->fragment, NULL, 10);",
"if (*VAR_3 == 0) {",
"pstrcpy(VAR_4, SD_MAX_VDI_TAG_LEN, uri->fragment);",
"}",
"} else {",
"*VAR_3 = CURRENT_VDI_ID;",
"}",
"out:\nif (qp) {",
"query_params_free(qp);",
"}",
"uri_free(uri);",
"return VAR_5;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
73
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
91,
93
],
[
95
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
119,
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
]
] |
1,502 | static void rtas_ibm_query_interrupt_source_number(sPAPREnvironment *spapr,
uint32_t token,
uint32_t nargs,
target_ulong args,
uint32_t nret,
target_ulong rets)
{
uint32_t config_addr = rtas_ld(args, 0);
uint64_t buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2);
unsigned int intr_src_num = -1, ioa_intr_num = rtas_ld(args, 3);
int ndev;
sPAPRPHBState *phb = NULL;
/* Fins sPAPRPHBState */
phb = find_phb(spapr, buid);
if (!phb) {
rtas_st(rets, 0, -3); /* Parameter error */
return;
}
/* Find device descriptor and start IRQ */
ndev = spapr_msicfg_find(phb, config_addr, false);
if (ndev < 0) {
trace_spapr_pci_msi("MSI has not been enabled", -1, config_addr);
rtas_st(rets, 0, -1); /* Hardware error */
return;
}
intr_src_num = phb->msi_table[ndev].irq + ioa_intr_num;
trace_spapr_pci_rtas_ibm_query_interrupt_source_number(ioa_intr_num,
intr_src_num);
rtas_st(rets, 0, 0);
rtas_st(rets, 1, intr_src_num);
rtas_st(rets, 2, 1);/* 0 == level; 1 == edge */
}
| false | qemu | 210b580b106fa798149e28aa13c66b325a43204e | static void rtas_ibm_query_interrupt_source_number(sPAPREnvironment *spapr,
uint32_t token,
uint32_t nargs,
target_ulong args,
uint32_t nret,
target_ulong rets)
{
uint32_t config_addr = rtas_ld(args, 0);
uint64_t buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2);
unsigned int intr_src_num = -1, ioa_intr_num = rtas_ld(args, 3);
int ndev;
sPAPRPHBState *phb = NULL;
phb = find_phb(spapr, buid);
if (!phb) {
rtas_st(rets, 0, -3);
return;
}
ndev = spapr_msicfg_find(phb, config_addr, false);
if (ndev < 0) {
trace_spapr_pci_msi("MSI has not been enabled", -1, config_addr);
rtas_st(rets, 0, -1);
return;
}
intr_src_num = phb->msi_table[ndev].irq + ioa_intr_num;
trace_spapr_pci_rtas_ibm_query_interrupt_source_number(ioa_intr_num,
intr_src_num);
rtas_st(rets, 0, 0);
rtas_st(rets, 1, intr_src_num);
rtas_st(rets, 2, 1);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(sPAPREnvironment *VAR_0,
uint32_t VAR_1,
uint32_t VAR_2,
target_ulong VAR_3,
uint32_t VAR_4,
target_ulong VAR_5)
{
uint32_t config_addr = rtas_ld(VAR_3, 0);
uint64_t buid = ((uint64_t)rtas_ld(VAR_3, 1) << 32) | rtas_ld(VAR_3, 2);
unsigned int VAR_6 = -1, VAR_7 = rtas_ld(VAR_3, 3);
int VAR_8;
sPAPRPHBState *phb = NULL;
phb = find_phb(VAR_0, buid);
if (!phb) {
rtas_st(VAR_5, 0, -3);
return;
}
VAR_8 = spapr_msicfg_find(phb, config_addr, false);
if (VAR_8 < 0) {
trace_spapr_pci_msi("MSI has not been enabled", -1, config_addr);
rtas_st(VAR_5, 0, -1);
return;
}
VAR_6 = phb->msi_table[VAR_8].irq + VAR_7;
trace_spapr_pci_rtas_ibm_query_interrupt_source_number(VAR_7,
VAR_6);
rtas_st(VAR_5, 0, 0);
rtas_st(VAR_5, 1, VAR_6);
rtas_st(VAR_5, 2, 1);
}
| [
"static void FUNC_0(sPAPREnvironment *VAR_0,\nuint32_t VAR_1,\nuint32_t VAR_2,\ntarget_ulong VAR_3,\nuint32_t VAR_4,\ntarget_ulong VAR_5)\n{",
"uint32_t config_addr = rtas_ld(VAR_3, 0);",
"uint64_t buid = ((uint64_t)rtas_ld(VAR_3, 1) << 32) | rtas_ld(VAR_3, 2);",
"unsigned int VAR_6 = -1, VAR_7 = rtas_ld(VAR_3, 3);",
"int VAR_8;",
"sPAPRPHBState *phb = NULL;",
"phb = find_phb(VAR_0, buid);",
"if (!phb) {",
"rtas_st(VAR_5, 0, -3);",
"return;",
"}",
"VAR_8 = spapr_msicfg_find(phb, config_addr, false);",
"if (VAR_8 < 0) {",
"trace_spapr_pci_msi(\"MSI has not been enabled\", -1, config_addr);",
"rtas_st(VAR_5, 0, -1);",
"return;",
"}",
"VAR_6 = phb->msi_table[VAR_8].irq + VAR_7;",
"trace_spapr_pci_rtas_ibm_query_interrupt_source_number(VAR_7,\nVAR_6);",
"rtas_st(VAR_5, 0, 0);",
"rtas_st(VAR_5, 1, VAR_6);",
"rtas_st(VAR_5, 2, 1);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7,
9,
11,
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57
],
[
59,
61
],
[
65
],
[
67
],
[
69
],
[
71
]
] |
1,503 | static void mpic_irq_raise(openpic_t *mpp, int n_CPU, IRQ_src_t *src)
{
int n_ci = IDR_CI0 - n_CPU;
if(test_bit(&src->ide, n_ci)) {
qemu_irq_raise(mpp->dst[n_CPU].irqs[OPENPIC_OUTPUT_CINT]);
}
else {
qemu_irq_raise(mpp->dst[n_CPU].irqs[OPENPIC_OUTPUT_INT]);
}
}
| false | qemu | 5861a33898bbddfd1a80c2e202cb9352e3b1ba62 | static void mpic_irq_raise(openpic_t *mpp, int n_CPU, IRQ_src_t *src)
{
int n_ci = IDR_CI0 - n_CPU;
if(test_bit(&src->ide, n_ci)) {
qemu_irq_raise(mpp->dst[n_CPU].irqs[OPENPIC_OUTPUT_CINT]);
}
else {
qemu_irq_raise(mpp->dst[n_CPU].irqs[OPENPIC_OUTPUT_INT]);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(openpic_t *VAR_0, int VAR_1, IRQ_src_t *VAR_2)
{
int VAR_3 = IDR_CI0 - VAR_1;
if(test_bit(&VAR_2->ide, VAR_3)) {
qemu_irq_raise(VAR_0->dst[VAR_1].irqs[OPENPIC_OUTPUT_CINT]);
}
else {
qemu_irq_raise(VAR_0->dst[VAR_1].irqs[OPENPIC_OUTPUT_INT]);
}
}
| [
"static void FUNC_0(openpic_t *VAR_0, int VAR_1, IRQ_src_t *VAR_2)\n{",
"int VAR_3 = IDR_CI0 - VAR_1;",
"if(test_bit(&VAR_2->ide, VAR_3)) {",
"qemu_irq_raise(VAR_0->dst[VAR_1].irqs[OPENPIC_OUTPUT_CINT]);",
"}",
"else {",
"qemu_irq_raise(VAR_0->dst[VAR_1].irqs[OPENPIC_OUTPUT_INT]);",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
]
] |
1,504 | static void tc6393xb_gpio_handler_update(TC6393xbState *s)
{
uint32_t level, diff;
int bit;
level = s->gpio_level & s->gpio_dir;
for (diff = s->prev_level ^ level; diff; diff ^= 1 << bit) {
bit = ffs(diff) - 1;
qemu_set_irq(s->handler[bit], (level >> bit) & 1);
}
s->prev_level = level;
}
| false | qemu | 786a4ea82ec9c87e3a895cf41081029b285a5fe5 | static void tc6393xb_gpio_handler_update(TC6393xbState *s)
{
uint32_t level, diff;
int bit;
level = s->gpio_level & s->gpio_dir;
for (diff = s->prev_level ^ level; diff; diff ^= 1 << bit) {
bit = ffs(diff) - 1;
qemu_set_irq(s->handler[bit], (level >> bit) & 1);
}
s->prev_level = level;
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(TC6393xbState *VAR_0)
{
uint32_t level, diff;
int VAR_1;
level = VAR_0->gpio_level & VAR_0->gpio_dir;
for (diff = VAR_0->prev_level ^ level; diff; diff ^= 1 << VAR_1) {
VAR_1 = ffs(diff) - 1;
qemu_set_irq(VAR_0->handler[VAR_1], (level >> VAR_1) & 1);
}
VAR_0->prev_level = level;
}
| [
"static void FUNC_0(TC6393xbState *VAR_0)\n{",
"uint32_t level, diff;",
"int VAR_1;",
"level = VAR_0->gpio_level & VAR_0->gpio_dir;",
"for (diff = VAR_0->prev_level ^ level; diff; diff ^= 1 << VAR_1) {",
"VAR_1 = ffs(diff) - 1;",
"qemu_set_irq(VAR_0->handler[VAR_1], (level >> VAR_1) & 1);",
"}",
"VAR_0->prev_level = level;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27
]
] |
1,505 | static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
{
/* We don't use SPAPR_MACHINE() in order to exit gracefully if the user
* tries to add a sPAPR CPU core to a non-pseries machine.
*/
sPAPRMachineState *spapr =
(sPAPRMachineState *) object_dynamic_cast(qdev_get_machine(),
TYPE_SPAPR_MACHINE);
sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(dev));
sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(dev));
CPUCore *cc = CPU_CORE(OBJECT(dev));
size_t size;
Error *local_err = NULL;
void *obj;
int i, j;
if (!spapr) {
error_setg(errp, TYPE_SPAPR_CPU_CORE " needs a pseries machine");
return;
}
size = object_type_get_instance_size(scc->cpu_type);
sc->threads = g_malloc0(size * cc->nr_threads);
for (i = 0; i < cc->nr_threads; i++) {
char id[32];
CPUState *cs;
PowerPCCPU *cpu;
obj = sc->threads + i * size;
object_initialize(obj, size, scc->cpu_type);
cs = CPU(obj);
cpu = POWERPC_CPU(cs);
cs->cpu_index = cc->core_id + i;
cpu->vcpu_id = (cc->core_id * spapr->vsmt / smp_threads) + i;
if (kvm_enabled() && !kvm_vcpu_id_is_valid(cpu->vcpu_id)) {
error_setg(&local_err, "Can't create CPU with id %d in KVM",
cpu->vcpu_id);
error_append_hint(&local_err, "Adjust the number of cpus to %d "
"or try to raise the number of threads per core\n",
cpu->vcpu_id * smp_threads / spapr->vsmt);
goto err;
}
/* Set NUMA node for the threads belonged to core */
cpu->node_id = sc->node_id;
snprintf(id, sizeof(id), "thread[%d]", i);
object_property_add_child(OBJECT(sc), id, obj, &local_err);
if (local_err) {
goto err;
}
object_unref(obj);
}
for (j = 0; j < cc->nr_threads; j++) {
obj = sc->threads + j * size;
spapr_cpu_core_realize_child(obj, spapr, &local_err);
if (local_err) {
goto err;
}
}
return;
err:
while (--i >= 0) {
obj = sc->threads + i * size;
object_unparent(obj);
}
g_free(sc->threads);
error_propagate(errp, local_err);
}
| false | qemu | 94ad93bd976841c26af75322301f5aad925114d6 | static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
{
sPAPRMachineState *spapr =
(sPAPRMachineState *) object_dynamic_cast(qdev_get_machine(),
TYPE_SPAPR_MACHINE);
sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(dev));
sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(dev));
CPUCore *cc = CPU_CORE(OBJECT(dev));
size_t size;
Error *local_err = NULL;
void *obj;
int i, j;
if (!spapr) {
error_setg(errp, TYPE_SPAPR_CPU_CORE " needs a pseries machine");
return;
}
size = object_type_get_instance_size(scc->cpu_type);
sc->threads = g_malloc0(size * cc->nr_threads);
for (i = 0; i < cc->nr_threads; i++) {
char id[32];
CPUState *cs;
PowerPCCPU *cpu;
obj = sc->threads + i * size;
object_initialize(obj, size, scc->cpu_type);
cs = CPU(obj);
cpu = POWERPC_CPU(cs);
cs->cpu_index = cc->core_id + i;
cpu->vcpu_id = (cc->core_id * spapr->vsmt / smp_threads) + i;
if (kvm_enabled() && !kvm_vcpu_id_is_valid(cpu->vcpu_id)) {
error_setg(&local_err, "Can't create CPU with id %d in KVM",
cpu->vcpu_id);
error_append_hint(&local_err, "Adjust the number of cpus to %d "
"or try to raise the number of threads per core\n",
cpu->vcpu_id * smp_threads / spapr->vsmt);
goto err;
}
cpu->node_id = sc->node_id;
snprintf(id, sizeof(id), "thread[%d]", i);
object_property_add_child(OBJECT(sc), id, obj, &local_err);
if (local_err) {
goto err;
}
object_unref(obj);
}
for (j = 0; j < cc->nr_threads; j++) {
obj = sc->threads + j * size;
spapr_cpu_core_realize_child(obj, spapr, &local_err);
if (local_err) {
goto err;
}
}
return;
err:
while (--i >= 0) {
obj = sc->threads + i * size;
object_unparent(obj);
}
g_free(sc->threads);
error_propagate(errp, local_err);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)
{
sPAPRMachineState *spapr =
(sPAPRMachineState *) object_dynamic_cast(qdev_get_machine(),
TYPE_SPAPR_MACHINE);
sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(VAR_0));
sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(VAR_0));
CPUCore *cc = CPU_CORE(OBJECT(VAR_0));
size_t size;
Error *local_err = NULL;
void *VAR_2;
int VAR_3, VAR_4;
if (!spapr) {
error_setg(VAR_1, TYPE_SPAPR_CPU_CORE " needs a pseries machine");
return;
}
size = object_type_get_instance_size(scc->cpu_type);
sc->threads = g_malloc0(size * cc->nr_threads);
for (VAR_3 = 0; VAR_3 < cc->nr_threads; VAR_3++) {
char id[32];
CPUState *cs;
PowerPCCPU *cpu;
VAR_2 = sc->threads + VAR_3 * size;
object_initialize(VAR_2, size, scc->cpu_type);
cs = CPU(VAR_2);
cpu = POWERPC_CPU(cs);
cs->cpu_index = cc->core_id + VAR_3;
cpu->vcpu_id = (cc->core_id * spapr->vsmt / smp_threads) + VAR_3;
if (kvm_enabled() && !kvm_vcpu_id_is_valid(cpu->vcpu_id)) {
error_setg(&local_err, "Can't create CPU with id %d in KVM",
cpu->vcpu_id);
error_append_hint(&local_err, "Adjust the number of cpus to %d "
"or try to raise the number of threads per core\n",
cpu->vcpu_id * smp_threads / spapr->vsmt);
goto err;
}
cpu->node_id = sc->node_id;
snprintf(id, sizeof(id), "thread[%d]", VAR_3);
object_property_add_child(OBJECT(sc), id, VAR_2, &local_err);
if (local_err) {
goto err;
}
object_unref(VAR_2);
}
for (VAR_4 = 0; VAR_4 < cc->nr_threads; VAR_4++) {
VAR_2 = sc->threads + VAR_4 * size;
spapr_cpu_core_realize_child(VAR_2, spapr, &local_err);
if (local_err) {
goto err;
}
}
return;
err:
while (--VAR_3 >= 0) {
VAR_2 = sc->threads + VAR_3 * size;
object_unparent(VAR_2);
}
g_free(sc->threads);
error_propagate(VAR_1, local_err);
}
| [
"static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{",
"sPAPRMachineState *spapr =\n(sPAPRMachineState *) object_dynamic_cast(qdev_get_machine(),\nTYPE_SPAPR_MACHINE);",
"sPAPRCPUCore *sc = SPAPR_CPU_CORE(OBJECT(VAR_0));",
"sPAPRCPUCoreClass *scc = SPAPR_CPU_CORE_GET_CLASS(OBJECT(VAR_0));",
"CPUCore *cc = CPU_CORE(OBJECT(VAR_0));",
"size_t size;",
"Error *local_err = NULL;",
"void *VAR_2;",
"int VAR_3, VAR_4;",
"if (!spapr) {",
"error_setg(VAR_1, TYPE_SPAPR_CPU_CORE \" needs a pseries machine\");",
"return;",
"}",
"size = object_type_get_instance_size(scc->cpu_type);",
"sc->threads = g_malloc0(size * cc->nr_threads);",
"for (VAR_3 = 0; VAR_3 < cc->nr_threads; VAR_3++) {",
"char id[32];",
"CPUState *cs;",
"PowerPCCPU *cpu;",
"VAR_2 = sc->threads + VAR_3 * size;",
"object_initialize(VAR_2, size, scc->cpu_type);",
"cs = CPU(VAR_2);",
"cpu = POWERPC_CPU(cs);",
"cs->cpu_index = cc->core_id + VAR_3;",
"cpu->vcpu_id = (cc->core_id * spapr->vsmt / smp_threads) + VAR_3;",
"if (kvm_enabled() && !kvm_vcpu_id_is_valid(cpu->vcpu_id)) {",
"error_setg(&local_err, \"Can't create CPU with id %d in KVM\",\ncpu->vcpu_id);",
"error_append_hint(&local_err, \"Adjust the number of cpus to %d \"\n\"or try to raise the number of threads per core\\n\",\ncpu->vcpu_id * smp_threads / spapr->vsmt);",
"goto err;",
"}",
"cpu->node_id = sc->node_id;",
"snprintf(id, sizeof(id), \"thread[%d]\", VAR_3);",
"object_property_add_child(OBJECT(sc), id, VAR_2, &local_err);",
"if (local_err) {",
"goto err;",
"}",
"object_unref(VAR_2);",
"}",
"for (VAR_4 = 0; VAR_4 < cc->nr_threads; VAR_4++) {",
"VAR_2 = sc->threads + VAR_4 * size;",
"spapr_cpu_core_realize_child(VAR_2, spapr, &local_err);",
"if (local_err) {",
"goto err;",
"}",
"}",
"return;",
"err:\nwhile (--VAR_3 >= 0) {",
"VAR_2 = sc->threads + VAR_3 * size;",
"object_unparent(VAR_2);",
"}",
"g_free(sc->threads);",
"error_propagate(VAR_1, local_err);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
11,
13,
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
57
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73,
75
],
[
77,
79,
81
],
[
83
],
[
85
],
[
93
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
113
],
[
115
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
133,
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
]
] |
1,506 | static int unpack_block_qpis(Vp3DecodeContext *s, GetBitContext *gb)
{
int qpi, i, j, bit, run_length, blocks_decoded, num_blocks_at_qpi;
int num_blocks = s->total_num_coded_frags;
for (qpi = 0; qpi < s->nqps-1 && num_blocks > 0; qpi++) {
i = blocks_decoded = num_blocks_at_qpi = 0;
bit = get_bits1(gb);
do {
run_length = get_vlc2(gb, s->superblock_run_length_vlc.table, 6, 2) + 1;
if (run_length == 34)
run_length += get_bits(gb, 12);
blocks_decoded += run_length;
if (!bit)
num_blocks_at_qpi += run_length;
for (j = 0; j < run_length; i++) {
if (i >= s->total_num_coded_frags)
return -1;
if (s->all_fragments[s->coded_fragment_list[0][i]].qpi == qpi) {
s->all_fragments[s->coded_fragment_list[0][i]].qpi += bit;
j++;
}
}
if (run_length == MAXIMUM_LONG_BIT_RUN)
bit = get_bits1(gb);
else
bit ^= 1;
} while (blocks_decoded < num_blocks);
num_blocks -= num_blocks_at_qpi;
}
return 0;
}
| true | FFmpeg | 6086731299e4d249ddc459e406b2ebb0cb71f6f4 | static int unpack_block_qpis(Vp3DecodeContext *s, GetBitContext *gb)
{
int qpi, i, j, bit, run_length, blocks_decoded, num_blocks_at_qpi;
int num_blocks = s->total_num_coded_frags;
for (qpi = 0; qpi < s->nqps-1 && num_blocks > 0; qpi++) {
i = blocks_decoded = num_blocks_at_qpi = 0;
bit = get_bits1(gb);
do {
run_length = get_vlc2(gb, s->superblock_run_length_vlc.table, 6, 2) + 1;
if (run_length == 34)
run_length += get_bits(gb, 12);
blocks_decoded += run_length;
if (!bit)
num_blocks_at_qpi += run_length;
for (j = 0; j < run_length; i++) {
if (i >= s->total_num_coded_frags)
return -1;
if (s->all_fragments[s->coded_fragment_list[0][i]].qpi == qpi) {
s->all_fragments[s->coded_fragment_list[0][i]].qpi += bit;
j++;
}
}
if (run_length == MAXIMUM_LONG_BIT_RUN)
bit = get_bits1(gb);
else
bit ^= 1;
} while (blocks_decoded < num_blocks);
num_blocks -= num_blocks_at_qpi;
}
return 0;
}
| {
"code": [
" } while (blocks_decoded < num_blocks);"
],
"line_no": [
67
]
} | static int FUNC_0(Vp3DecodeContext *VAR_0, GetBitContext *VAR_1)
{
int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;
int VAR_9 = VAR_0->total_num_coded_frags;
for (VAR_2 = 0; VAR_2 < VAR_0->nqps-1 && VAR_9 > 0; VAR_2++) {
VAR_3 = VAR_7 = VAR_8 = 0;
VAR_5 = get_bits1(VAR_1);
do {
VAR_6 = get_vlc2(VAR_1, VAR_0->superblock_run_length_vlc.table, 6, 2) + 1;
if (VAR_6 == 34)
VAR_6 += get_bits(VAR_1, 12);
VAR_7 += VAR_6;
if (!VAR_5)
VAR_8 += VAR_6;
for (VAR_4 = 0; VAR_4 < VAR_6; VAR_3++) {
if (VAR_3 >= VAR_0->total_num_coded_frags)
return -1;
if (VAR_0->all_fragments[VAR_0->coded_fragment_list[0][VAR_3]].VAR_2 == VAR_2) {
VAR_0->all_fragments[VAR_0->coded_fragment_list[0][VAR_3]].VAR_2 += VAR_5;
VAR_4++;
}
}
if (VAR_6 == MAXIMUM_LONG_BIT_RUN)
VAR_5 = get_bits1(VAR_1);
else
VAR_5 ^= 1;
} while (VAR_7 < VAR_9);
VAR_9 -= VAR_8;
}
return 0;
}
| [
"static int FUNC_0(Vp3DecodeContext *VAR_0, GetBitContext *VAR_1)\n{",
"int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;",
"int VAR_9 = VAR_0->total_num_coded_frags;",
"for (VAR_2 = 0; VAR_2 < VAR_0->nqps-1 && VAR_9 > 0; VAR_2++) {",
"VAR_3 = VAR_7 = VAR_8 = 0;",
"VAR_5 = get_bits1(VAR_1);",
"do {",
"VAR_6 = get_vlc2(VAR_1, VAR_0->superblock_run_length_vlc.table, 6, 2) + 1;",
"if (VAR_6 == 34)\nVAR_6 += get_bits(VAR_1, 12);",
"VAR_7 += VAR_6;",
"if (!VAR_5)\nVAR_8 += VAR_6;",
"for (VAR_4 = 0; VAR_4 < VAR_6; VAR_3++) {",
"if (VAR_3 >= VAR_0->total_num_coded_frags)\nreturn -1;",
"if (VAR_0->all_fragments[VAR_0->coded_fragment_list[0][VAR_3]].VAR_2 == VAR_2) {",
"VAR_0->all_fragments[VAR_0->coded_fragment_list[0][VAR_3]].VAR_2 += VAR_5;",
"VAR_4++;",
"}",
"}",
"if (VAR_6 == MAXIMUM_LONG_BIT_RUN)\nVAR_5 = get_bits1(VAR_1);",
"else\nVAR_5 ^= 1;",
"} while (VAR_7 < VAR_9);",
"VAR_9 -= VAR_8;",
"}",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
17
],
[
21
],
[
23
],
[
25,
27
],
[
29
],
[
33,
35
],
[
39
],
[
41,
43
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
59,
61
],
[
63,
65
],
[
67
],
[
71
],
[
73
],
[
77
],
[
79
]
] |
1,510 | static int coroutine_fn sd_co_flush_to_disk(BlockDriverState *bs)
{
BDRVSheepdogState *s = bs->opaque;
SheepdogAIOCB *acb;
AIOReq *aio_req;
if (s->cache_flags != SD_FLAG_CMD_CACHE) {
return 0;
}
acb = sd_aio_setup(bs, NULL, 0, 0);
acb->aiocb_type = AIOCB_FLUSH_CACHE;
acb->aio_done_func = sd_finish_aiocb;
aio_req = alloc_aio_req(s, acb, vid_to_vdi_oid(s->inode.vdi_id),
0, 0, 0, 0, 0);
QLIST_INSERT_HEAD(&s->inflight_aio_head, aio_req, aio_siblings);
add_aio_request(s, aio_req, NULL, 0, false, acb->aiocb_type);
qemu_coroutine_yield();
return acb->ret;
}
| true | qemu | b544c1aba8681c2fe5d6715fbd37cf6caf1bc7bb | static int coroutine_fn sd_co_flush_to_disk(BlockDriverState *bs)
{
BDRVSheepdogState *s = bs->opaque;
SheepdogAIOCB *acb;
AIOReq *aio_req;
if (s->cache_flags != SD_FLAG_CMD_CACHE) {
return 0;
}
acb = sd_aio_setup(bs, NULL, 0, 0);
acb->aiocb_type = AIOCB_FLUSH_CACHE;
acb->aio_done_func = sd_finish_aiocb;
aio_req = alloc_aio_req(s, acb, vid_to_vdi_oid(s->inode.vdi_id),
0, 0, 0, 0, 0);
QLIST_INSERT_HEAD(&s->inflight_aio_head, aio_req, aio_siblings);
add_aio_request(s, aio_req, NULL, 0, false, acb->aiocb_type);
qemu_coroutine_yield();
return acb->ret;
}
| {
"code": [
" 0, 0, 0, 0, 0);",
" add_aio_request(s, aio_req, NULL, 0, false, acb->aiocb_type);"
],
"line_no": [
31,
35
]
} | static int VAR_0 sd_co_flush_to_disk(BlockDriverState *bs)
{
BDRVSheepdogState *s = bs->opaque;
SheepdogAIOCB *acb;
AIOReq *aio_req;
if (s->cache_flags != SD_FLAG_CMD_CACHE) {
return 0;
}
acb = sd_aio_setup(bs, NULL, 0, 0);
acb->aiocb_type = AIOCB_FLUSH_CACHE;
acb->aio_done_func = sd_finish_aiocb;
aio_req = alloc_aio_req(s, acb, vid_to_vdi_oid(s->inode.vdi_id),
0, 0, 0, 0, 0);
QLIST_INSERT_HEAD(&s->inflight_aio_head, aio_req, aio_siblings);
add_aio_request(s, aio_req, NULL, 0, false, acb->aiocb_type);
qemu_coroutine_yield();
return acb->ret;
}
| [
"static int VAR_0 sd_co_flush_to_disk(BlockDriverState *bs)\n{",
"BDRVSheepdogState *s = bs->opaque;",
"SheepdogAIOCB *acb;",
"AIOReq *aio_req;",
"if (s->cache_flags != SD_FLAG_CMD_CACHE) {",
"return 0;",
"}",
"acb = sd_aio_setup(bs, NULL, 0, 0);",
"acb->aiocb_type = AIOCB_FLUSH_CACHE;",
"acb->aio_done_func = sd_finish_aiocb;",
"aio_req = alloc_aio_req(s, acb, vid_to_vdi_oid(s->inode.vdi_id),\n0, 0, 0, 0, 0);",
"QLIST_INSERT_HEAD(&s->inflight_aio_head, aio_req, aio_siblings);",
"add_aio_request(s, aio_req, NULL, 0, false, acb->aiocb_type);",
"qemu_coroutine_yield();",
"return acb->ret;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
29,
31
],
[
33
],
[
35
],
[
39
],
[
41
],
[
43
]
] |
1,511 | void qemu_notify_event(void)
{
CPUState *env = cpu_single_env;
qemu_event_increment ();
if (env) {
cpu_exit(env);
}
if (next_cpu && env != next_cpu) {
cpu_exit(next_cpu);
}
exit_request = 1;
}
| true | qemu | 12d4536f7d911b6d87a766ad7300482ea663cea2 | void qemu_notify_event(void)
{
CPUState *env = cpu_single_env;
qemu_event_increment ();
if (env) {
cpu_exit(env);
}
if (next_cpu && env != next_cpu) {
cpu_exit(next_cpu);
}
exit_request = 1;
}
| {
"code": [
"void qemu_notify_event(void)",
" CPUState *env = cpu_single_env;",
" qemu_event_increment ();",
" if (env) {",
" cpu_exit(env);",
" if (next_cpu && env != next_cpu) {",
" cpu_exit(next_cpu);",
" exit_request = 1;"
],
"line_no": [
1,
5,
9,
11,
13,
17,
19,
23
]
} | void FUNC_0(void)
{
CPUState *env = cpu_single_env;
qemu_event_increment ();
if (env) {
cpu_exit(env);
}
if (next_cpu && env != next_cpu) {
cpu_exit(next_cpu);
}
exit_request = 1;
}
| [
"void FUNC_0(void)\n{",
"CPUState *env = cpu_single_env;",
"qemu_event_increment ();",
"if (env) {",
"cpu_exit(env);",
"}",
"if (next_cpu && env != next_cpu) {",
"cpu_exit(next_cpu);",
"}",
"exit_request = 1;",
"}"
] | [
1,
1,
1,
1,
1,
0,
1,
1,
0,
1,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
]
] |
1,512 | static void tcg_out_qemu_ld(TCGContext* s, TCGReg data_reg, TCGReg addr_reg,
TCGMemOpIdx oi)
{
TCGMemOp opc = get_memop(oi);
#ifdef CONFIG_SOFTMMU
unsigned mem_index = get_mmuidx(oi);
tcg_insn_unit *label_ptr;
TCGReg base_reg;
base_reg = tcg_out_tlb_read(s, addr_reg, opc, mem_index, 1);
label_ptr = s->code_ptr + 1;
tcg_out_insn(s, RI, BRC, S390_CC_NE, 0);
tcg_out_qemu_ld_direct(s, opc, data_reg, base_reg, TCG_REG_R2, 0);
add_qemu_ldst_label(s, 1, oi, data_reg, addr_reg, s->code_ptr, label_ptr);
#else
TCGReg index_reg;
tcg_target_long disp;
tcg_prepare_user_ldst(s, &addr_reg, &index_reg, &disp);
tcg_out_qemu_ld_direct(s, opc, data_reg, addr_reg, index_reg, disp);
#endif
}
| true | qemu | cd3b29b745b0ff393b2d37317837bc726b8dacc8 | static void tcg_out_qemu_ld(TCGContext* s, TCGReg data_reg, TCGReg addr_reg,
TCGMemOpIdx oi)
{
TCGMemOp opc = get_memop(oi);
#ifdef CONFIG_SOFTMMU
unsigned mem_index = get_mmuidx(oi);
tcg_insn_unit *label_ptr;
TCGReg base_reg;
base_reg = tcg_out_tlb_read(s, addr_reg, opc, mem_index, 1);
label_ptr = s->code_ptr + 1;
tcg_out_insn(s, RI, BRC, S390_CC_NE, 0);
tcg_out_qemu_ld_direct(s, opc, data_reg, base_reg, TCG_REG_R2, 0);
add_qemu_ldst_label(s, 1, oi, data_reg, addr_reg, s->code_ptr, label_ptr);
#else
TCGReg index_reg;
tcg_target_long disp;
tcg_prepare_user_ldst(s, &addr_reg, &index_reg, &disp);
tcg_out_qemu_ld_direct(s, opc, data_reg, addr_reg, index_reg, disp);
#endif
}
| {
"code": [
" label_ptr = s->code_ptr + 1;",
" tcg_out_insn(s, RI, BRC, S390_CC_NE, 0);",
" label_ptr = s->code_ptr + 1;",
" tcg_out_insn(s, RI, BRC, S390_CC_NE, 0);"
],
"line_no": [
23,
25,
23,
25
]
} | static void FUNC_0(TCGContext* VAR_0, TCGReg VAR_1, TCGReg VAR_2,
TCGMemOpIdx VAR_3)
{
TCGMemOp opc = get_memop(VAR_3);
#ifdef CONFIG_SOFTMMU
unsigned mem_index = get_mmuidx(VAR_3);
tcg_insn_unit *label_ptr;
TCGReg base_reg;
base_reg = tcg_out_tlb_read(VAR_0, VAR_2, opc, mem_index, 1);
label_ptr = VAR_0->code_ptr + 1;
tcg_out_insn(VAR_0, RI, BRC, S390_CC_NE, 0);
tcg_out_qemu_ld_direct(VAR_0, opc, VAR_1, base_reg, TCG_REG_R2, 0);
add_qemu_ldst_label(VAR_0, 1, VAR_3, VAR_1, VAR_2, VAR_0->code_ptr, label_ptr);
#else
TCGReg index_reg;
tcg_target_long disp;
tcg_prepare_user_ldst(VAR_0, &VAR_2, &index_reg, &disp);
tcg_out_qemu_ld_direct(VAR_0, opc, VAR_1, VAR_2, index_reg, disp);
#endif
}
| [
"static void FUNC_0(TCGContext* VAR_0, TCGReg VAR_1, TCGReg VAR_2,\nTCGMemOpIdx VAR_3)\n{",
"TCGMemOp opc = get_memop(VAR_3);",
"#ifdef CONFIG_SOFTMMU\nunsigned mem_index = get_mmuidx(VAR_3);",
"tcg_insn_unit *label_ptr;",
"TCGReg base_reg;",
"base_reg = tcg_out_tlb_read(VAR_0, VAR_2, opc, mem_index, 1);",
"label_ptr = VAR_0->code_ptr + 1;",
"tcg_out_insn(VAR_0, RI, BRC, S390_CC_NE, 0);",
"tcg_out_qemu_ld_direct(VAR_0, opc, VAR_1, base_reg, TCG_REG_R2, 0);",
"add_qemu_ldst_label(VAR_0, 1, VAR_3, VAR_1, VAR_2, VAR_0->code_ptr, label_ptr);",
"#else\nTCGReg index_reg;",
"tcg_target_long disp;",
"tcg_prepare_user_ldst(VAR_0, &VAR_2, &index_reg, &disp);",
"tcg_out_qemu_ld_direct(VAR_0, opc, VAR_1, VAR_2, index_reg, disp);",
"#endif\n}"
] | [
0,
0,
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9,
11
],
[
13
],
[
15
],
[
19
],
[
23
],
[
25
],
[
29
],
[
33
],
[
35,
37
],
[
39
],
[
43
],
[
45
],
[
47,
49
]
] |
1,513 | char *qdist_pr_plain(const struct qdist *dist, size_t n)
{
struct qdist binned;
char *ret;
if (dist->n == 0) {
return NULL;
}
qdist_bin__internal(&binned, dist, n);
ret = qdist_pr_internal(&binned);
qdist_destroy(&binned);
return ret;
}
| true | qemu | 11b7b07f8a15879134a54e73fade98d5e11e04f8 | char *qdist_pr_plain(const struct qdist *dist, size_t n)
{
struct qdist binned;
char *ret;
if (dist->n == 0) {
return NULL;
}
qdist_bin__internal(&binned, dist, n);
ret = qdist_pr_internal(&binned);
qdist_destroy(&binned);
return ret;
}
| {
"code": [
" return NULL;",
" return NULL;"
],
"line_no": [
13,
13
]
} | char *FUNC_0(const struct qdist *VAR_0, size_t VAR_1)
{
struct qdist VAR_2;
char *VAR_3;
if (VAR_0->VAR_1 == 0) {
return NULL;
}
qdist_bin__internal(&VAR_2, VAR_0, VAR_1);
VAR_3 = qdist_pr_internal(&VAR_2);
qdist_destroy(&VAR_2);
return VAR_3;
}
| [
"char *FUNC_0(const struct qdist *VAR_0, size_t VAR_1)\n{",
"struct qdist VAR_2;",
"char *VAR_3;",
"if (VAR_0->VAR_1 == 0) {",
"return NULL;",
"}",
"qdist_bin__internal(&VAR_2, VAR_0, VAR_1);",
"VAR_3 = qdist_pr_internal(&VAR_2);",
"qdist_destroy(&VAR_2);",
"return VAR_3;",
"}"
] | [
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
]
] |
1,514 | static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size,
void *data)
{
DVVideoContext *s = c->priv_data;
s->sys = dv_codec_profile(c);
if (!s->sys)
return -1;
if(buf_size < s->sys->frame_size)
return -1;
c->pix_fmt = s->sys->pix_fmt;
s->picture = *((AVFrame *)data);
s->picture.key_frame = 1;
s->picture.pict_type = FF_I_TYPE;
s->buf = buf;
c->execute(c, dv_encode_mt, (void**)&s->dv_anchor[0], NULL,
s->sys->difseg_size * 27);
emms_c();
return s->sys->frame_size;
}
| true | FFmpeg | aa06658248a49f6ebf381894b9426cdfb377cd32 | static int dvvideo_encode_frame(AVCodecContext *c, uint8_t *buf, int buf_size,
void *data)
{
DVVideoContext *s = c->priv_data;
s->sys = dv_codec_profile(c);
if (!s->sys)
return -1;
if(buf_size < s->sys->frame_size)
return -1;
c->pix_fmt = s->sys->pix_fmt;
s->picture = *((AVFrame *)data);
s->picture.key_frame = 1;
s->picture.pict_type = FF_I_TYPE;
s->buf = buf;
c->execute(c, dv_encode_mt, (void**)&s->dv_anchor[0], NULL,
s->sys->difseg_size * 27);
emms_c();
return s->sys->frame_size;
}
| {
"code": [
" c->execute(c, dv_encode_mt, (void**)&s->dv_anchor[0], NULL,",
" DVVideoContext *s = c->priv_data;"
],
"line_no": [
35,
7
]
} | static int FUNC_0(AVCodecContext *VAR_0, uint8_t *VAR_1, int VAR_2,
void *VAR_3)
{
DVVideoContext *s = VAR_0->priv_data;
s->sys = dv_codec_profile(VAR_0);
if (!s->sys)
return -1;
if(VAR_2 < s->sys->frame_size)
return -1;
VAR_0->pix_fmt = s->sys->pix_fmt;
s->picture = *((AVFrame *)VAR_3);
s->picture.key_frame = 1;
s->picture.pict_type = FF_I_TYPE;
s->VAR_1 = VAR_1;
VAR_0->execute(VAR_0, dv_encode_mt, (void**)&s->dv_anchor[0], NULL,
s->sys->difseg_size * 27);
emms_c();
return s->sys->frame_size;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0, uint8_t *VAR_1, int VAR_2,\nvoid *VAR_3)\n{",
"DVVideoContext *s = VAR_0->priv_data;",
"s->sys = dv_codec_profile(VAR_0);",
"if (!s->sys)\nreturn -1;",
"if(VAR_2 < s->sys->frame_size)\nreturn -1;",
"VAR_0->pix_fmt = s->sys->pix_fmt;",
"s->picture = *((AVFrame *)VAR_3);",
"s->picture.key_frame = 1;",
"s->picture.pict_type = FF_I_TYPE;",
"s->VAR_1 = VAR_1;",
"VAR_0->execute(VAR_0, dv_encode_mt, (void**)&s->dv_anchor[0], NULL,\ns->sys->difseg_size * 27);",
"emms_c();",
"return s->sys->frame_size;",
"}"
] | [
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
11
],
[
13,
15
],
[
17,
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
35,
37
],
[
41
],
[
43
],
[
45
]
] |
1,515 | static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
{
AVStream *st = c->fc->streams[c->fc->nb_streams-1];
int tag, len;
get_be32(pb); /* version + flags */
len = mp4_read_descr(c, pb, &tag);
if (tag == MP4ESDescrTag) {
get_be16(pb); /* ID */
get_byte(pb); /* priority */
} else
get_be16(pb); /* ID */
len = mp4_read_descr(c, pb, &tag);
if (tag == MP4DecConfigDescrTag) {
int object_type_id = get_byte(pb);
get_byte(pb); /* stream type */
get_be24(pb); /* buffer size db */
get_be32(pb); /* max bitrate */
get_be32(pb); /* avg bitrate */
st->codec->codec_id= codec_get_id(ff_mp4_obj_type, object_type_id);
dprintf(c->fc, "esds object type id %d\n", object_type_id);
len = mp4_read_descr(c, pb, &tag);
if (tag == MP4DecSpecificDescrTag) {
dprintf(c->fc, "Specific MPEG4 header len=%d\n", len);
st->codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata)
return AVERROR(ENOMEM);
get_buffer(pb, st->codec->extradata, len);
st->codec->extradata_size = len;
/* from mplayer */
if ((*st->codec->extradata >> 3) == 29) {
st->codec->codec_id = CODEC_ID_MP3ON4;
}
}
}
return 0;
} | true | FFmpeg | 852859ff7cd29a926a9a7e811d77192b61a6956e | static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
{
AVStream *st = c->fc->streams[c->fc->nb_streams-1];
int tag, len;
get_be32(pb);
len = mp4_read_descr(c, pb, &tag);
if (tag == MP4ESDescrTag) {
get_be16(pb);
get_byte(pb);
} else
get_be16(pb);
len = mp4_read_descr(c, pb, &tag);
if (tag == MP4DecConfigDescrTag) {
int object_type_id = get_byte(pb);
get_byte(pb);
get_be24(pb);
get_be32(pb);
get_be32(pb);
st->codec->codec_id= codec_get_id(ff_mp4_obj_type, object_type_id);
dprintf(c->fc, "esds object type id %d\n", object_type_id);
len = mp4_read_descr(c, pb, &tag);
if (tag == MP4DecSpecificDescrTag) {
dprintf(c->fc, "Specific MPEG4 header len=%d\n", len);
st->codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata)
return AVERROR(ENOMEM);
get_buffer(pb, st->codec->extradata, len);
st->codec->extradata_size = len;
if ((*st->codec->extradata >> 3) == 29) {
st->codec->codec_id = CODEC_ID_MP3ON4;
}
}
}
return 0;
} | {
"code": [],
"line_no": []
} | static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOV_atom_t VAR_2)
{
AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];
int VAR_3, VAR_4;
get_be32(VAR_1);
VAR_4 = mp4_read_descr(VAR_0, VAR_1, &VAR_3);
if (VAR_3 == MP4ESDescrTag) {
get_be16(VAR_1);
get_byte(VAR_1);
} else
get_be16(VAR_1);
VAR_4 = mp4_read_descr(VAR_0, VAR_1, &VAR_3);
if (VAR_3 == MP4DecConfigDescrTag) {
int VAR_5 = get_byte(VAR_1);
get_byte(VAR_1);
get_be24(VAR_1);
get_be32(VAR_1);
get_be32(VAR_1);
st->codec->codec_id= codec_get_id(ff_mp4_obj_type, VAR_5);
dprintf(VAR_0->fc, "esds object type id %d\n", VAR_5);
VAR_4 = mp4_read_descr(VAR_0, VAR_1, &VAR_3);
if (VAR_3 == MP4DecSpecificDescrTag) {
dprintf(VAR_0->fc, "Specific MPEG4 header VAR_4=%d\n", VAR_4);
st->codec->extradata = av_mallocz(VAR_4 + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata)
return AVERROR(ENOMEM);
get_buffer(VAR_1, st->codec->extradata, VAR_4);
st->codec->extradata_size = VAR_4;
if ((*st->codec->extradata >> 3) == 29) {
st->codec->codec_id = CODEC_ID_MP3ON4;
}
}
}
return 0;
} | [
"static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOV_atom_t VAR_2)\n{",
"AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];",
"int VAR_3, VAR_4;",
"get_be32(VAR_1);",
"VAR_4 = mp4_read_descr(VAR_0, VAR_1, &VAR_3);",
"if (VAR_3 == MP4ESDescrTag) {",
"get_be16(VAR_1);",
"get_byte(VAR_1);",
"} else",
"get_be16(VAR_1);",
"VAR_4 = mp4_read_descr(VAR_0, VAR_1, &VAR_3);",
"if (VAR_3 == MP4DecConfigDescrTag) {",
"int VAR_5 = get_byte(VAR_1);",
"get_byte(VAR_1);",
"get_be24(VAR_1);",
"get_be32(VAR_1);",
"get_be32(VAR_1);",
"st->codec->codec_id= codec_get_id(ff_mp4_obj_type, VAR_5);",
"dprintf(VAR_0->fc, \"esds object type id %d\\n\", VAR_5);",
"VAR_4 = mp4_read_descr(VAR_0, VAR_1, &VAR_3);",
"if (VAR_3 == MP4DecSpecificDescrTag) {",
"dprintf(VAR_0->fc, \"Specific MPEG4 header VAR_4=%d\\n\", VAR_4);",
"st->codec->extradata = av_mallocz(VAR_4 + FF_INPUT_BUFFER_PADDING_SIZE);",
"if (!st->codec->extradata)\nreturn AVERROR(ENOMEM);",
"get_buffer(VAR_1, st->codec->extradata, VAR_4);",
"st->codec->extradata_size = VAR_4;",
"if ((*st->codec->extradata >> 3) == 29) {",
"st->codec->codec_id = CODEC_ID_MP3ON4;",
"}",
"}",
"}",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57,
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
]
] |
1,516 | static void audio_run_in (AudioState *s)
{
HWVoiceIn *hw = NULL;
while ((hw = audio_pcm_hw_find_any_enabled_in (hw))) {
SWVoiceIn *sw;
int captured, min;
captured = hw->pcm_ops->run_in (hw);
min = audio_pcm_hw_find_min_in (hw);
hw->total_samples_captured += captured - min;
hw->ts_helper += captured;
for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) {
sw->total_hw_samples_acquired -= min;
if (sw->active) {
int avail;
avail = audio_get_avail (sw);
if (avail > 0) {
sw->callback.fn (sw->callback.opaque, avail);
}
}
}
}
}
| true | qemu | 3d4d16f4dc101e16f643acc44dfffdbaf2a8f01c | static void audio_run_in (AudioState *s)
{
HWVoiceIn *hw = NULL;
while ((hw = audio_pcm_hw_find_any_enabled_in (hw))) {
SWVoiceIn *sw;
int captured, min;
captured = hw->pcm_ops->run_in (hw);
min = audio_pcm_hw_find_min_in (hw);
hw->total_samples_captured += captured - min;
hw->ts_helper += captured;
for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) {
sw->total_hw_samples_acquired -= min;
if (sw->active) {
int avail;
avail = audio_get_avail (sw);
if (avail > 0) {
sw->callback.fn (sw->callback.opaque, avail);
}
}
}
}
}
| {
"code": [
" int captured, min;",
" captured = hw->pcm_ops->run_in (hw);"
],
"line_no": [
13,
17
]
} | static void FUNC_0 (AudioState *VAR_0)
{
HWVoiceIn *hw = NULL;
while ((hw = audio_pcm_hw_find_any_enabled_in (hw))) {
SWVoiceIn *sw;
int VAR_1, VAR_2;
VAR_1 = hw->pcm_ops->run_in (hw);
VAR_2 = audio_pcm_hw_find_min_in (hw);
hw->total_samples_captured += VAR_1 - VAR_2;
hw->ts_helper += VAR_1;
for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) {
sw->total_hw_samples_acquired -= VAR_2;
if (sw->active) {
int avail;
avail = audio_get_avail (sw);
if (avail > 0) {
sw->callback.fn (sw->callback.opaque, avail);
}
}
}
}
}
| [
"static void FUNC_0 (AudioState *VAR_0)\n{",
"HWVoiceIn *hw = NULL;",
"while ((hw = audio_pcm_hw_find_any_enabled_in (hw))) {",
"SWVoiceIn *sw;",
"int VAR_1, VAR_2;",
"VAR_1 = hw->pcm_ops->run_in (hw);",
"VAR_2 = audio_pcm_hw_find_min_in (hw);",
"hw->total_samples_captured += VAR_1 - VAR_2;",
"hw->ts_helper += VAR_1;",
"for (sw = hw->sw_head.lh_first; sw; sw = sw->entries.le_next) {",
"sw->total_hw_samples_acquired -= VAR_2;",
"if (sw->active) {",
"int avail;",
"avail = audio_get_avail (sw);",
"if (avail > 0) {",
"sw->callback.fn (sw->callback.opaque, avail);",
"}",
"}",
"}",
"}",
"}"
] | [
0,
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
17
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
35
],
[
37
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
]
] |
1,517 | static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
{
AvsFormat *avs = s->priv_data;
int sub_type = 0, size = 0;
AvsBlockType type = AVS_NONE;
int palette_size = 0;
uint8_t palette[4 + 3 * 256];
int ret;
if (avs->remaining_audio_size > 0)
if (avs_read_audio_packet(s, pkt) > 0)
return 0;
while (1) {
if (avs->remaining_frame_size <= 0) {
if (!avio_rl16(s->pb)) /* found EOF */
return AVERROR(EIO);
avs->remaining_frame_size = avio_rl16(s->pb) - 4;
}
while (avs->remaining_frame_size > 0) {
sub_type = avio_r8(s->pb);
type = avio_r8(s->pb);
size = avio_rl16(s->pb);
if (size < 4)
avs->remaining_frame_size -= size;
switch (type) {
case AVS_PALETTE:
ret = avio_read(s->pb, palette, size - 4);
if (ret < size - 4)
return AVERROR(EIO);
palette_size = size;
break;
case AVS_VIDEO:
if (!avs->st_video) {
avs->st_video = av_new_stream(s, AVS_VIDEO);
if (avs->st_video == NULL)
return AVERROR(ENOMEM);
avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO;
avs->st_video->codec->codec_id = CODEC_ID_AVS;
avs->st_video->codec->width = avs->width;
avs->st_video->codec->height = avs->height;
avs->st_video->codec->bits_per_coded_sample=avs->bits_per_sample;
avs->st_video->nb_frames = avs->nb_frames;
avs->st_video->codec->time_base = (AVRational) {
1, avs->fps};
}
return avs_read_video_packet(s, pkt, type, sub_type, size,
palette, palette_size);
case AVS_AUDIO:
if (!avs->st_audio) {
avs->st_audio = av_new_stream(s, AVS_AUDIO);
if (avs->st_audio == NULL)
return AVERROR(ENOMEM);
avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
}
avs->remaining_audio_size = size - 4;
size = avs_read_audio_packet(s, pkt);
if (size != 0)
return size;
break;
default:
avio_skip(s->pb, size - 4);
}
}
}
} | true | FFmpeg | 5d44c061cf511d97be5fac8d76be2f3915c6e798 | static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
{
AvsFormat *avs = s->priv_data;
int sub_type = 0, size = 0;
AvsBlockType type = AVS_NONE;
int palette_size = 0;
uint8_t palette[4 + 3 * 256];
int ret;
if (avs->remaining_audio_size > 0)
if (avs_read_audio_packet(s, pkt) > 0)
return 0;
while (1) {
if (avs->remaining_frame_size <= 0) {
if (!avio_rl16(s->pb))
return AVERROR(EIO);
avs->remaining_frame_size = avio_rl16(s->pb) - 4;
}
while (avs->remaining_frame_size > 0) {
sub_type = avio_r8(s->pb);
type = avio_r8(s->pb);
size = avio_rl16(s->pb);
if (size < 4)
avs->remaining_frame_size -= size;
switch (type) {
case AVS_PALETTE:
ret = avio_read(s->pb, palette, size - 4);
if (ret < size - 4)
return AVERROR(EIO);
palette_size = size;
break;
case AVS_VIDEO:
if (!avs->st_video) {
avs->st_video = av_new_stream(s, AVS_VIDEO);
if (avs->st_video == NULL)
return AVERROR(ENOMEM);
avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO;
avs->st_video->codec->codec_id = CODEC_ID_AVS;
avs->st_video->codec->width = avs->width;
avs->st_video->codec->height = avs->height;
avs->st_video->codec->bits_per_coded_sample=avs->bits_per_sample;
avs->st_video->nb_frames = avs->nb_frames;
avs->st_video->codec->time_base = (AVRational) {
1, avs->fps};
}
return avs_read_video_packet(s, pkt, type, sub_type, size,
palette, palette_size);
case AVS_AUDIO:
if (!avs->st_audio) {
avs->st_audio = av_new_stream(s, AVS_AUDIO);
if (avs->st_audio == NULL)
return AVERROR(ENOMEM);
avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
}
avs->remaining_audio_size = size - 4;
size = avs_read_audio_packet(s, pkt);
if (size != 0)
return size;
break;
default:
avio_skip(s->pb, size - 4);
}
}
}
} | {
"code": [],
"line_no": []
} | static int FUNC_0(AVFormatContext * VAR_0, AVPacket * VAR_1)
{
AvsFormat *avs = VAR_0->priv_data;
int VAR_2 = 0, VAR_3 = 0;
AvsBlockType type = AVS_NONE;
int VAR_4 = 0;
uint8_t palette[4 + 3 * 256];
int VAR_5;
if (avs->remaining_audio_size > 0)
if (avs_read_audio_packet(VAR_0, VAR_1) > 0)
return 0;
while (1) {
if (avs->remaining_frame_size <= 0) {
if (!avio_rl16(VAR_0->pb))
return AVERROR(EIO);
avs->remaining_frame_size = avio_rl16(VAR_0->pb) - 4;
}
while (avs->remaining_frame_size > 0) {
VAR_2 = avio_r8(VAR_0->pb);
type = avio_r8(VAR_0->pb);
VAR_3 = avio_rl16(VAR_0->pb);
if (VAR_3 < 4)
avs->remaining_frame_size -= VAR_3;
switch (type) {
case AVS_PALETTE:
VAR_5 = avio_read(VAR_0->pb, palette, VAR_3 - 4);
if (VAR_5 < VAR_3 - 4)
return AVERROR(EIO);
VAR_4 = VAR_3;
break;
case AVS_VIDEO:
if (!avs->st_video) {
avs->st_video = av_new_stream(VAR_0, AVS_VIDEO);
if (avs->st_video == NULL)
return AVERROR(ENOMEM);
avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO;
avs->st_video->codec->codec_id = CODEC_ID_AVS;
avs->st_video->codec->width = avs->width;
avs->st_video->codec->height = avs->height;
avs->st_video->codec->bits_per_coded_sample=avs->bits_per_sample;
avs->st_video->nb_frames = avs->nb_frames;
avs->st_video->codec->time_base = (AVRational) {
1, avs->fps};
}
return avs_read_video_packet(VAR_0, VAR_1, type, VAR_2, VAR_3,
palette, VAR_4);
case AVS_AUDIO:
if (!avs->st_audio) {
avs->st_audio = av_new_stream(VAR_0, AVS_AUDIO);
if (avs->st_audio == NULL)
return AVERROR(ENOMEM);
avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
}
avs->remaining_audio_size = VAR_3 - 4;
VAR_3 = avs_read_audio_packet(VAR_0, VAR_1);
if (VAR_3 != 0)
return VAR_3;
break;
default:
avio_skip(VAR_0->pb, VAR_3 - 4);
}
}
}
} | [
"static int FUNC_0(AVFormatContext * VAR_0, AVPacket * VAR_1)\n{",
"AvsFormat *avs = VAR_0->priv_data;",
"int VAR_2 = 0, VAR_3 = 0;",
"AvsBlockType type = AVS_NONE;",
"int VAR_4 = 0;",
"uint8_t palette[4 + 3 * 256];",
"int VAR_5;",
"if (avs->remaining_audio_size > 0)\nif (avs_read_audio_packet(VAR_0, VAR_1) > 0)\nreturn 0;",
"while (1) {",
"if (avs->remaining_frame_size <= 0) {",
"if (!avio_rl16(VAR_0->pb))\nreturn AVERROR(EIO);",
"avs->remaining_frame_size = avio_rl16(VAR_0->pb) - 4;",
"}",
"while (avs->remaining_frame_size > 0) {",
"VAR_2 = avio_r8(VAR_0->pb);",
"type = avio_r8(VAR_0->pb);",
"VAR_3 = avio_rl16(VAR_0->pb);",
"if (VAR_3 < 4)\navs->remaining_frame_size -= VAR_3;",
"switch (type) {",
"case AVS_PALETTE:\nVAR_5 = avio_read(VAR_0->pb, palette, VAR_3 - 4);",
"if (VAR_5 < VAR_3 - 4)\nreturn AVERROR(EIO);",
"VAR_4 = VAR_3;",
"break;",
"case AVS_VIDEO:\nif (!avs->st_video) {",
"avs->st_video = av_new_stream(VAR_0, AVS_VIDEO);",
"if (avs->st_video == NULL)\nreturn AVERROR(ENOMEM);",
"avs->st_video->codec->codec_type = AVMEDIA_TYPE_VIDEO;",
"avs->st_video->codec->codec_id = CODEC_ID_AVS;",
"avs->st_video->codec->width = avs->width;",
"avs->st_video->codec->height = avs->height;",
"avs->st_video->codec->bits_per_coded_sample=avs->bits_per_sample;",
"avs->st_video->nb_frames = avs->nb_frames;",
"avs->st_video->codec->time_base = (AVRational) {",
"1, avs->fps};",
"}",
"return avs_read_video_packet(VAR_0, VAR_1, type, VAR_2, VAR_3,\npalette, VAR_4);",
"case AVS_AUDIO:\nif (!avs->st_audio) {",
"avs->st_audio = av_new_stream(VAR_0, AVS_AUDIO);",
"if (avs->st_audio == NULL)\nreturn AVERROR(ENOMEM);",
"avs->st_audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;",
"}",
"avs->remaining_audio_size = VAR_3 - 4;",
"VAR_3 = avs_read_audio_packet(VAR_0, VAR_1);",
"if (VAR_3 != 0)\nreturn VAR_3;",
"break;",
"default:\navio_skip(VAR_0->pb, VAR_3 - 4);",
"}",
"}",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19,
21,
23
],
[
27
],
[
29
],
[
31,
33
],
[
35
],
[
37
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49,
52
],
[
56
],
[
58,
62
],
[
64,
66
],
[
68
],
[
70
],
[
74,
76
],
[
78
],
[
80,
82
],
[
84
],
[
86
],
[
88
],
[
90
],
[
92
],
[
94
],
[
96
],
[
98
],
[
100
],
[
102,
104
],
[
108,
110
],
[
112
],
[
114,
116
],
[
118
],
[
120
],
[
122
],
[
124
],
[
126,
128
],
[
130
],
[
134,
136
],
[
138
],
[
140
],
[
142
],
[
144
]
] |
1,518 | void HELPER(simcall)(CPUXtensaState *env)
{
uint32_t *regs = env->regs;
switch (regs[2]) {
case TARGET_SYS_exit:
qemu_log("exit(%d) simcall\n", regs[3]);
exit(regs[3]);
break;
case TARGET_SYS_read:
case TARGET_SYS_write:
{
bool is_write = regs[2] == TARGET_SYS_write;
uint32_t fd = regs[3];
uint32_t vaddr = regs[4];
uint32_t len = regs[5];
while (len > 0) {
target_phys_addr_t paddr =
cpu_get_phys_page_debug(env, vaddr);
uint32_t page_left =
TARGET_PAGE_SIZE - (vaddr & (TARGET_PAGE_SIZE - 1));
uint32_t io_sz = page_left < len ? page_left : len;
target_phys_addr_t sz = io_sz;
void *buf = cpu_physical_memory_map(paddr, &sz, is_write);
if (buf) {
vaddr += io_sz;
len -= io_sz;
regs[2] = is_write ?
write(fd, buf, io_sz) :
read(fd, buf, io_sz);
regs[3] = errno;
cpu_physical_memory_unmap(buf, sz, is_write, sz);
if (regs[2] == -1) {
break;
}
} else {
regs[3] = EINVAL;
break;
}
}
}
break;
case TARGET_SYS_open:
{
char name[1024];
int rc;
int i;
for (i = 0; i < ARRAY_SIZE(name); ++i) {
rc = cpu_memory_rw_debug(
env, regs[3] + i, (uint8_t *)name + i, 1, 0);
if (rc != 0 || name[i] == 0) {
break;
}
}
if (rc == 0 && i < ARRAY_SIZE(name)) {
regs[2] = open(name, regs[4], regs[5]);
regs[3] = errno;
} else {
regs[3] = EINVAL;
}
}
break;
case TARGET_SYS_close:
if (regs[3] < 3) {
regs[2] = regs[3] = 0;
} else {
regs[2] = close(regs[3]);
regs[3] = errno;
}
break;
case TARGET_SYS_lseek:
regs[2] = lseek(regs[3], (off_t)(int32_t)regs[4], regs[5]);
regs[3] = errno;
break;
case TARGET_SYS_select_one:
{
uint32_t fd = regs[3];
uint32_t rq = regs[4];
uint32_t target_tv = regs[5];
uint32_t target_tvv[2];
struct timeval tv = {0};
fd_set fdset;
FD_ZERO(&fdset);
FD_SET(fd, &fdset);
if (target_tv) {
cpu_memory_rw_debug(env, target_tv,
(uint8_t *)target_tvv, sizeof(target_tvv), 0);
tv.tv_sec = (int32_t)tswap32(target_tvv[0]);
tv.tv_usec = (int32_t)tswap32(target_tvv[1]);
}
regs[2] = select(fd + 1,
rq == SELECT_ONE_READ ? &fdset : NULL,
rq == SELECT_ONE_WRITE ? &fdset : NULL,
rq == SELECT_ONE_EXCEPT ? &fdset : NULL,
target_tv ? &tv : NULL);
regs[3] = errno;
}
break;
case TARGET_SYS_argc:
regs[2] = 1;
regs[3] = 0;
break;
case TARGET_SYS_argv_sz:
regs[2] = 128;
regs[3] = 0;
break;
case TARGET_SYS_argv:
{
struct Argv {
uint32_t argptr[2];
char text[120];
} argv = {
{0, 0},
"test"
};
argv.argptr[0] = tswap32(regs[3] + offsetof(struct Argv, text));
cpu_memory_rw_debug(
env, regs[3], (uint8_t *)&argv, sizeof(argv), 1);
}
break;
case TARGET_SYS_memset:
{
uint32_t base = regs[3];
uint32_t sz = regs[5];
while (sz) {
target_phys_addr_t len = sz;
void *buf = cpu_physical_memory_map(base, &len, 1);
if (buf && len) {
memset(buf, regs[4], len);
cpu_physical_memory_unmap(buf, len, 1, len);
} else {
len = 1;
}
base += len;
sz -= len;
}
regs[2] = regs[3];
regs[3] = 0;
}
break;
default:
qemu_log("%s(%d): not implemented\n", __func__, regs[2]);
break;
}
} | true | qemu | e7eee62a90c671d22d50964b7de05e3f4fd96f5f | void HELPER(simcall)(CPUXtensaState *env)
{
uint32_t *regs = env->regs;
switch (regs[2]) {
case TARGET_SYS_exit:
qemu_log("exit(%d) simcall\n", regs[3]);
exit(regs[3]);
break;
case TARGET_SYS_read:
case TARGET_SYS_write:
{
bool is_write = regs[2] == TARGET_SYS_write;
uint32_t fd = regs[3];
uint32_t vaddr = regs[4];
uint32_t len = regs[5];
while (len > 0) {
target_phys_addr_t paddr =
cpu_get_phys_page_debug(env, vaddr);
uint32_t page_left =
TARGET_PAGE_SIZE - (vaddr & (TARGET_PAGE_SIZE - 1));
uint32_t io_sz = page_left < len ? page_left : len;
target_phys_addr_t sz = io_sz;
void *buf = cpu_physical_memory_map(paddr, &sz, is_write);
if (buf) {
vaddr += io_sz;
len -= io_sz;
regs[2] = is_write ?
write(fd, buf, io_sz) :
read(fd, buf, io_sz);
regs[3] = errno;
cpu_physical_memory_unmap(buf, sz, is_write, sz);
if (regs[2] == -1) {
break;
}
} else {
regs[3] = EINVAL;
break;
}
}
}
break;
case TARGET_SYS_open:
{
char name[1024];
int rc;
int i;
for (i = 0; i < ARRAY_SIZE(name); ++i) {
rc = cpu_memory_rw_debug(
env, regs[3] + i, (uint8_t *)name + i, 1, 0);
if (rc != 0 || name[i] == 0) {
break;
}
}
if (rc == 0 && i < ARRAY_SIZE(name)) {
regs[2] = open(name, regs[4], regs[5]);
regs[3] = errno;
} else {
regs[3] = EINVAL;
}
}
break;
case TARGET_SYS_close:
if (regs[3] < 3) {
regs[2] = regs[3] = 0;
} else {
regs[2] = close(regs[3]);
regs[3] = errno;
}
break;
case TARGET_SYS_lseek:
regs[2] = lseek(regs[3], (off_t)(int32_t)regs[4], regs[5]);
regs[3] = errno;
break;
case TARGET_SYS_select_one:
{
uint32_t fd = regs[3];
uint32_t rq = regs[4];
uint32_t target_tv = regs[5];
uint32_t target_tvv[2];
struct timeval tv = {0};
fd_set fdset;
FD_ZERO(&fdset);
FD_SET(fd, &fdset);
if (target_tv) {
cpu_memory_rw_debug(env, target_tv,
(uint8_t *)target_tvv, sizeof(target_tvv), 0);
tv.tv_sec = (int32_t)tswap32(target_tvv[0]);
tv.tv_usec = (int32_t)tswap32(target_tvv[1]);
}
regs[2] = select(fd + 1,
rq == SELECT_ONE_READ ? &fdset : NULL,
rq == SELECT_ONE_WRITE ? &fdset : NULL,
rq == SELECT_ONE_EXCEPT ? &fdset : NULL,
target_tv ? &tv : NULL);
regs[3] = errno;
}
break;
case TARGET_SYS_argc:
regs[2] = 1;
regs[3] = 0;
break;
case TARGET_SYS_argv_sz:
regs[2] = 128;
regs[3] = 0;
break;
case TARGET_SYS_argv:
{
struct Argv {
uint32_t argptr[2];
char text[120];
} argv = {
{0, 0},
"test"
};
argv.argptr[0] = tswap32(regs[3] + offsetof(struct Argv, text));
cpu_memory_rw_debug(
env, regs[3], (uint8_t *)&argv, sizeof(argv), 1);
}
break;
case TARGET_SYS_memset:
{
uint32_t base = regs[3];
uint32_t sz = regs[5];
while (sz) {
target_phys_addr_t len = sz;
void *buf = cpu_physical_memory_map(base, &len, 1);
if (buf && len) {
memset(buf, regs[4], len);
cpu_physical_memory_unmap(buf, len, 1, len);
} else {
len = 1;
}
base += len;
sz -= len;
}
regs[2] = regs[3];
regs[3] = 0;
}
break;
default:
qemu_log("%s(%d): not implemented\n", __func__, regs[2]);
break;
}
} | {
"code": [],
"line_no": []
} | void FUNC_0(simcall)(CPUXtensaState *env)
{
uint32_t *regs = env->regs;
switch (regs[2]) {
case TARGET_SYS_exit:
qemu_log("exit(%d) simcall\n", regs[3]);
exit(regs[3]);
break;
case TARGET_SYS_read:
case TARGET_SYS_write:
{
bool is_write = regs[2] == TARGET_SYS_write;
uint32_t fd = regs[3];
uint32_t vaddr = regs[4];
uint32_t len = regs[5];
while (len > 0) {
target_phys_addr_t paddr =
cpu_get_phys_page_debug(env, vaddr);
uint32_t page_left =
TARGET_PAGE_SIZE - (vaddr & (TARGET_PAGE_SIZE - 1));
uint32_t io_sz = page_left < len ? page_left : len;
target_phys_addr_t sz = io_sz;
void *VAR_6 = cpu_physical_memory_map(paddr, &sz, is_write);
if (VAR_6) {
vaddr += io_sz;
len -= io_sz;
regs[2] = is_write ?
write(fd, VAR_6, io_sz) :
read(fd, VAR_6, io_sz);
regs[3] = errno;
cpu_physical_memory_unmap(VAR_6, sz, is_write, sz);
if (regs[2] == -1) {
break;
}
} else {
regs[3] = EINVAL;
break;
}
}
}
break;
case TARGET_SYS_open:
{
char VAR_1[1024];
int VAR_2;
int VAR_3;
for (VAR_3 = 0; VAR_3 < ARRAY_SIZE(VAR_1); ++VAR_3) {
VAR_2 = cpu_memory_rw_debug(
env, regs[3] + VAR_3, (uint8_t *)VAR_1 + VAR_3, 1, 0);
if (VAR_2 != 0 || VAR_1[VAR_3] == 0) {
break;
}
}
if (VAR_2 == 0 && VAR_3 < ARRAY_SIZE(VAR_1)) {
regs[2] = open(VAR_1, regs[4], regs[5]);
regs[3] = errno;
} else {
regs[3] = EINVAL;
}
}
break;
case TARGET_SYS_close:
if (regs[3] < 3) {
regs[2] = regs[3] = 0;
} else {
regs[2] = close(regs[3]);
regs[3] = errno;
}
break;
case TARGET_SYS_lseek:
regs[2] = lseek(regs[3], (off_t)(int32_t)regs[4], regs[5]);
regs[3] = errno;
break;
case TARGET_SYS_select_one:
{
uint32_t fd = regs[3];
uint32_t rq = regs[4];
uint32_t target_tv = regs[5];
uint32_t target_tvv[2];
struct timeval VAR_4 = {0};
fd_set fdset;
FD_ZERO(&fdset);
FD_SET(fd, &fdset);
if (target_tv) {
cpu_memory_rw_debug(env, target_tv,
(uint8_t *)target_tvv, sizeof(target_tvv), 0);
VAR_4.tv_sec = (int32_t)tswap32(target_tvv[0]);
VAR_4.tv_usec = (int32_t)tswap32(target_tvv[1]);
}
regs[2] = select(fd + 1,
rq == SELECT_ONE_READ ? &fdset : NULL,
rq == SELECT_ONE_WRITE ? &fdset : NULL,
rq == SELECT_ONE_EXCEPT ? &fdset : NULL,
target_tv ? &VAR_4 : NULL);
regs[3] = errno;
}
break;
case TARGET_SYS_argc:
regs[2] = 1;
regs[3] = 0;
break;
case TARGET_SYS_argv_sz:
regs[2] = 128;
regs[3] = 0;
break;
case TARGET_SYS_argv:
{
struct Argv {
uint32_t argptr[2];
char text[120];
} VAR_5 = {
{0, 0},
"test"
};
VAR_5.argptr[0] = tswap32(regs[3] + offsetof(struct Argv, text));
cpu_memory_rw_debug(
env, regs[3], (uint8_t *)&VAR_5, sizeof(VAR_5), 1);
}
break;
case TARGET_SYS_memset:
{
uint32_t base = regs[3];
uint32_t sz = regs[5];
while (sz) {
target_phys_addr_t len = sz;
void *VAR_6 = cpu_physical_memory_map(base, &len, 1);
if (VAR_6 && len) {
memset(VAR_6, regs[4], len);
cpu_physical_memory_unmap(VAR_6, len, 1, len);
} else {
len = 1;
}
base += len;
sz -= len;
}
regs[2] = regs[3];
regs[3] = 0;
}
break;
default:
qemu_log("%s(%d): not implemented\n", __func__, regs[2]);
break;
}
} | [
"void FUNC_0(simcall)(CPUXtensaState *env)\n{",
"uint32_t *regs = env->regs;",
"switch (regs[2]) {",
"case TARGET_SYS_exit:\nqemu_log(\"exit(%d) simcall\\n\", regs[3]);",
"exit(regs[3]);",
"break;",
"case TARGET_SYS_read:\ncase TARGET_SYS_write:\n{",
"bool is_write = regs[2] == TARGET_SYS_write;",
"uint32_t fd = regs[3];",
"uint32_t vaddr = regs[4];",
"uint32_t len = regs[5];",
"while (len > 0) {",
"target_phys_addr_t paddr =\ncpu_get_phys_page_debug(env, vaddr);",
"uint32_t page_left =\nTARGET_PAGE_SIZE - (vaddr & (TARGET_PAGE_SIZE - 1));",
"uint32_t io_sz = page_left < len ? page_left : len;",
"target_phys_addr_t sz = io_sz;",
"void *VAR_6 = cpu_physical_memory_map(paddr, &sz, is_write);",
"if (VAR_6) {",
"vaddr += io_sz;",
"len -= io_sz;",
"regs[2] = is_write ?\nwrite(fd, VAR_6, io_sz) :\nread(fd, VAR_6, io_sz);",
"regs[3] = errno;",
"cpu_physical_memory_unmap(VAR_6, sz, is_write, sz);",
"if (regs[2] == -1) {",
"break;",
"}",
"} else {",
"regs[3] = EINVAL;",
"break;",
"}",
"}",
"}",
"break;",
"case TARGET_SYS_open:\n{",
"char VAR_1[1024];",
"int VAR_2;",
"int VAR_3;",
"for (VAR_3 = 0; VAR_3 < ARRAY_SIZE(VAR_1); ++VAR_3) {",
"VAR_2 = cpu_memory_rw_debug(\nenv, regs[3] + VAR_3, (uint8_t *)VAR_1 + VAR_3, 1, 0);",
"if (VAR_2 != 0 || VAR_1[VAR_3] == 0) {",
"break;",
"}",
"}",
"if (VAR_2 == 0 && VAR_3 < ARRAY_SIZE(VAR_1)) {",
"regs[2] = open(VAR_1, regs[4], regs[5]);",
"regs[3] = errno;",
"} else {",
"regs[3] = EINVAL;",
"}",
"}",
"break;",
"case TARGET_SYS_close:\nif (regs[3] < 3) {",
"regs[2] = regs[3] = 0;",
"} else {",
"regs[2] = close(regs[3]);",
"regs[3] = errno;",
"}",
"break;",
"case TARGET_SYS_lseek:\nregs[2] = lseek(regs[3], (off_t)(int32_t)regs[4], regs[5]);",
"regs[3] = errno;",
"break;",
"case TARGET_SYS_select_one:\n{",
"uint32_t fd = regs[3];",
"uint32_t rq = regs[4];",
"uint32_t target_tv = regs[5];",
"uint32_t target_tvv[2];",
"struct timeval VAR_4 = {0};",
"fd_set fdset;",
"FD_ZERO(&fdset);",
"FD_SET(fd, &fdset);",
"if (target_tv) {",
"cpu_memory_rw_debug(env, target_tv,\n(uint8_t *)target_tvv, sizeof(target_tvv), 0);",
"VAR_4.tv_sec = (int32_t)tswap32(target_tvv[0]);",
"VAR_4.tv_usec = (int32_t)tswap32(target_tvv[1]);",
"}",
"regs[2] = select(fd + 1,\nrq == SELECT_ONE_READ ? &fdset : NULL,\nrq == SELECT_ONE_WRITE ? &fdset : NULL,\nrq == SELECT_ONE_EXCEPT ? &fdset : NULL,\ntarget_tv ? &VAR_4 : NULL);",
"regs[3] = errno;",
"}",
"break;",
"case TARGET_SYS_argc:\nregs[2] = 1;",
"regs[3] = 0;",
"break;",
"case TARGET_SYS_argv_sz:\nregs[2] = 128;",
"regs[3] = 0;",
"break;",
"case TARGET_SYS_argv:\n{",
"struct Argv {",
"uint32_t argptr[2];",
"char text[120];",
"} VAR_5 = {",
"{0, 0},",
"\"test\"\n};",
"VAR_5.argptr[0] = tswap32(regs[3] + offsetof(struct Argv, text));",
"cpu_memory_rw_debug(\nenv, regs[3], (uint8_t *)&VAR_5, sizeof(VAR_5), 1);",
"}",
"break;",
"case TARGET_SYS_memset:\n{",
"uint32_t base = regs[3];",
"uint32_t sz = regs[5];",
"while (sz) {",
"target_phys_addr_t len = sz;",
"void *VAR_6 = cpu_physical_memory_map(base, &len, 1);",
"if (VAR_6 && len) {",
"memset(VAR_6, regs[4], len);",
"cpu_physical_memory_unmap(VAR_6, len, 1, len);",
"} else {",
"len = 1;",
"}",
"base += len;",
"sz -= len;",
"}",
"regs[2] = regs[3];",
"regs[3] = 0;",
"}",
"break;",
"default:\nqemu_log(\"%s(%d): not implemented\\n\", __func__, regs[2]);",
"break;",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11,
13
],
[
15
],
[
17
],
[
21,
23,
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
37
],
[
39,
41
],
[
43,
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61,
63,
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
80
],
[
82
],
[
84
],
[
86
],
[
88
],
[
90
],
[
94,
96
],
[
98
],
[
100
],
[
102
],
[
106
],
[
108,
110
],
[
112
],
[
114
],
[
116
],
[
118
],
[
122
],
[
124
],
[
126
],
[
128
],
[
131
],
[
133
],
[
135
],
[
137
],
[
141,
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
159,
161
],
[
163
],
[
165
],
[
169,
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
183
],
[
185
],
[
189
],
[
191
],
[
195
],
[
197,
199
],
[
201
],
[
203
],
[
205
],
[
207,
209,
211,
213,
215
],
[
217
],
[
219
],
[
221
],
[
225,
227
],
[
229
],
[
231
],
[
235,
237
],
[
239
],
[
241
],
[
245,
247
],
[
249
],
[
251
],
[
253
],
[
255
],
[
257
],
[
259,
261
],
[
265
],
[
267,
269
],
[
271
],
[
273
],
[
277,
279
],
[
281
],
[
283
],
[
287
],
[
289
],
[
291
],
[
295
],
[
297
],
[
299
],
[
301
],
[
303
],
[
305
],
[
307
],
[
309
],
[
311
],
[
313
],
[
315
],
[
317
],
[
319
],
[
323,
325
],
[
329
],
[
331
],
[
333
]
] |
1,520 | static void decode_lpc(int32_t *coeffs, int mode, int length)
{
int i;
if (length < 2)
return;
if (mode == 1) {
unsigned a1 = *coeffs++;
for (i = 0; i < length - 1 >> 1; i++) {
*coeffs += a1;
coeffs[1] += *coeffs;
a1 = coeffs[1];
coeffs += 2;
}
if (length - 1 & 1)
*coeffs += a1;
} else if (mode == 2) {
unsigned a1 = coeffs[1];
unsigned a2 = a1 + *coeffs;
coeffs[1] = a2;
if (length > 2) {
coeffs += 2;
for (i = 0; i < length - 2 >> 1; i++) {
unsigned a3 = *coeffs + a1;
unsigned a4 = a3 + a2;
*coeffs = a4;
a1 = coeffs[1] + a3;
a2 = a1 + a4;
coeffs[1] = a2;
coeffs += 2;
}
if (length & 1)
*coeffs += a1 + a2;
}
} else if (mode == 3) {
unsigned a1 = coeffs[1];
unsigned a2 = a1 + *coeffs;
coeffs[1] = a2;
if (length > 2) {
unsigned a3 = coeffs[2];
unsigned a4 = a3 + a1;
unsigned a5 = a4 + a2;
coeffs[2] = a5;
coeffs += 3;
for (i = 0; i < length - 3; i++) {
a3 += *coeffs;
a4 += a3;
a5 += a4;
*coeffs = a5;
coeffs++;
}
}
}
}
| true | FFmpeg | 5d31f03a0264cac24434c8108daef4ccba6d28f9 | static void decode_lpc(int32_t *coeffs, int mode, int length)
{
int i;
if (length < 2)
return;
if (mode == 1) {
unsigned a1 = *coeffs++;
for (i = 0; i < length - 1 >> 1; i++) {
*coeffs += a1;
coeffs[1] += *coeffs;
a1 = coeffs[1];
coeffs += 2;
}
if (length - 1 & 1)
*coeffs += a1;
} else if (mode == 2) {
unsigned a1 = coeffs[1];
unsigned a2 = a1 + *coeffs;
coeffs[1] = a2;
if (length > 2) {
coeffs += 2;
for (i = 0; i < length - 2 >> 1; i++) {
unsigned a3 = *coeffs + a1;
unsigned a4 = a3 + a2;
*coeffs = a4;
a1 = coeffs[1] + a3;
a2 = a1 + a4;
coeffs[1] = a2;
coeffs += 2;
}
if (length & 1)
*coeffs += a1 + a2;
}
} else if (mode == 3) {
unsigned a1 = coeffs[1];
unsigned a2 = a1 + *coeffs;
coeffs[1] = a2;
if (length > 2) {
unsigned a3 = coeffs[2];
unsigned a4 = a3 + a1;
unsigned a5 = a4 + a2;
coeffs[2] = a5;
coeffs += 3;
for (i = 0; i < length - 3; i++) {
a3 += *coeffs;
a4 += a3;
a5 += a4;
*coeffs = a5;
coeffs++;
}
}
}
}
| {
"code": [
" coeffs[1] += *coeffs;"
],
"line_no": [
23
]
} | static void FUNC_0(int32_t *VAR_0, int VAR_1, int VAR_2)
{
int VAR_3;
if (VAR_2 < 2)
return;
if (VAR_1 == 1) {
unsigned VAR_8 = *VAR_0++;
for (VAR_3 = 0; VAR_3 < VAR_2 - 1 >> 1; VAR_3++) {
*VAR_0 += VAR_8;
VAR_0[1] += *VAR_0;
VAR_8 = VAR_0[1];
VAR_0 += 2;
}
if (VAR_2 - 1 & 1)
*VAR_0 += VAR_8;
} else if (VAR_1 == 2) {
unsigned VAR_8 = VAR_0[1];
unsigned VAR_8 = VAR_8 + *VAR_0;
VAR_0[1] = VAR_8;
if (VAR_2 > 2) {
VAR_0 += 2;
for (VAR_3 = 0; VAR_3 < VAR_2 - 2 >> 1; VAR_3++) {
unsigned VAR_8 = *VAR_0 + VAR_8;
unsigned VAR_8 = VAR_8 + VAR_8;
*VAR_0 = VAR_8;
VAR_8 = VAR_0[1] + VAR_8;
VAR_8 = VAR_8 + VAR_8;
VAR_0[1] = VAR_8;
VAR_0 += 2;
}
if (VAR_2 & 1)
*VAR_0 += VAR_8 + VAR_8;
}
} else if (VAR_1 == 3) {
unsigned VAR_8 = VAR_0[1];
unsigned VAR_8 = VAR_8 + *VAR_0;
VAR_0[1] = VAR_8;
if (VAR_2 > 2) {
unsigned VAR_8 = VAR_0[2];
unsigned VAR_8 = VAR_8 + VAR_8;
unsigned VAR_8 = VAR_8 + VAR_8;
VAR_0[2] = VAR_8;
VAR_0 += 3;
for (VAR_3 = 0; VAR_3 < VAR_2 - 3; VAR_3++) {
VAR_8 += *VAR_0;
VAR_8 += VAR_8;
VAR_8 += VAR_8;
*VAR_0 = VAR_8;
VAR_0++;
}
}
}
}
| [
"static void FUNC_0(int32_t *VAR_0, int VAR_1, int VAR_2)\n{",
"int VAR_3;",
"if (VAR_2 < 2)\nreturn;",
"if (VAR_1 == 1) {",
"unsigned VAR_8 = *VAR_0++;",
"for (VAR_3 = 0; VAR_3 < VAR_2 - 1 >> 1; VAR_3++) {",
"*VAR_0 += VAR_8;",
"VAR_0[1] += *VAR_0;",
"VAR_8 = VAR_0[1];",
"VAR_0 += 2;",
"}",
"if (VAR_2 - 1 & 1)\n*VAR_0 += VAR_8;",
"} else if (VAR_1 == 2) {",
"unsigned VAR_8 = VAR_0[1];",
"unsigned VAR_8 = VAR_8 + *VAR_0;",
"VAR_0[1] = VAR_8;",
"if (VAR_2 > 2) {",
"VAR_0 += 2;",
"for (VAR_3 = 0; VAR_3 < VAR_2 - 2 >> 1; VAR_3++) {",
"unsigned VAR_8 = *VAR_0 + VAR_8;",
"unsigned VAR_8 = VAR_8 + VAR_8;",
"*VAR_0 = VAR_8;",
"VAR_8 = VAR_0[1] + VAR_8;",
"VAR_8 = VAR_8 + VAR_8;",
"VAR_0[1] = VAR_8;",
"VAR_0 += 2;",
"}",
"if (VAR_2 & 1)\n*VAR_0 += VAR_8 + VAR_8;",
"}",
"} else if (VAR_1 == 3) {",
"unsigned VAR_8 = VAR_0[1];",
"unsigned VAR_8 = VAR_8 + *VAR_0;",
"VAR_0[1] = VAR_8;",
"if (VAR_2 > 2) {",
"unsigned VAR_8 = VAR_0[2];",
"unsigned VAR_8 = VAR_8 + VAR_8;",
"unsigned VAR_8 = VAR_8 + VAR_8;",
"VAR_0[2] = VAR_8;",
"VAR_0 += 3;",
"for (VAR_3 = 0; VAR_3 < VAR_2 - 3; VAR_3++) {",
"VAR_8 += *VAR_0;",
"VAR_8 += VAR_8;",
"VAR_8 += VAR_8;",
"*VAR_0 = VAR_8;",
"VAR_0++;",
"}",
"}",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9,
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31,
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65,
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
]
] |
1,521 | static void term_init(void)
{
#ifndef __MINGW32__
struct termios tty;
tcgetattr (0, &tty);
oldtty = tty;
tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
|INLCR|IGNCR|ICRNL|IXON);
tty.c_oflag |= OPOST;
tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
tty.c_cflag &= ~(CSIZE|PARENB);
tty.c_cflag |= CS8;
tty.c_cc[VMIN] = 1;
tty.c_cc[VTIME] = 0;
tcsetattr (0, TCSANOW, &tty);
signal(SIGQUIT, sigterm_handler); /* Quit (POSIX). */
#endif
signal(SIGINT , sigterm_handler); /* Interrupt (ANSI). */
signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */
/*
register a function to be called at normal program termination
*/
atexit(term_exit);
#ifdef CONFIG_BEOS_NETSERVER
fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK);
#endif
}
| false | FFmpeg | e16e49ac90f6da9e019fdf23084cbb256d14bd9c | static void term_init(void)
{
#ifndef __MINGW32__
struct termios tty;
tcgetattr (0, &tty);
oldtty = tty;
tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
|INLCR|IGNCR|ICRNL|IXON);
tty.c_oflag |= OPOST;
tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
tty.c_cflag &= ~(CSIZE|PARENB);
tty.c_cflag |= CS8;
tty.c_cc[VMIN] = 1;
tty.c_cc[VTIME] = 0;
tcsetattr (0, TCSANOW, &tty);
signal(SIGQUIT, sigterm_handler);
#endif
signal(SIGINT , sigterm_handler);
signal(SIGTERM, sigterm_handler);
atexit(term_exit);
#ifdef CONFIG_BEOS_NETSERVER
fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK);
#endif
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(void)
{
#ifndef __MINGW32__
struct termios VAR_0;
tcgetattr (0, &VAR_0);
oldtty = VAR_0;
VAR_0.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
|INLCR|IGNCR|ICRNL|IXON);
VAR_0.c_oflag |= OPOST;
VAR_0.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
VAR_0.c_cflag &= ~(CSIZE|PARENB);
VAR_0.c_cflag |= CS8;
VAR_0.c_cc[VMIN] = 1;
VAR_0.c_cc[VTIME] = 0;
tcsetattr (0, TCSANOW, &VAR_0);
signal(SIGQUIT, sigterm_handler);
#endif
signal(SIGINT , sigterm_handler);
signal(SIGTERM, sigterm_handler);
atexit(term_exit);
#ifdef CONFIG_BEOS_NETSERVER
fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK);
#endif
}
| [
"static void FUNC_0(void)\n{",
"#ifndef __MINGW32__\nstruct termios VAR_0;",
"tcgetattr (0, &VAR_0);",
"oldtty = VAR_0;",
"VAR_0.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP\n|INLCR|IGNCR|ICRNL|IXON);",
"VAR_0.c_oflag |= OPOST;",
"VAR_0.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);",
"VAR_0.c_cflag &= ~(CSIZE|PARENB);",
"VAR_0.c_cflag |= CS8;",
"VAR_0.c_cc[VMIN] = 1;",
"VAR_0.c_cc[VTIME] = 0;",
"tcsetattr (0, TCSANOW, &VAR_0);",
"signal(SIGQUIT, sigterm_handler);",
"#endif\nsignal(SIGINT , sigterm_handler);",
"signal(SIGTERM, sigterm_handler);",
"atexit(term_exit);",
"#ifdef CONFIG_BEOS_NETSERVER\nfcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK);",
"#endif\n}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5,
7
],
[
11
],
[
13
],
[
17,
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
],
[
39,
43
],
[
45
],
[
53
],
[
55,
57
],
[
59,
61
]
] |
1,522 | static int xan_decode_frame_type0(AVCodecContext *avctx)
{
XanContext *s = avctx->priv_data;
uint8_t *ybuf, *prev_buf, *src = s->scratch_buffer;
unsigned chroma_off, corr_off;
int cur, last;
int i, j;
int ret;
chroma_off = bytestream2_get_le32(&s->gb);
corr_off = bytestream2_get_le32(&s->gb);
if ((ret = xan_decode_chroma(avctx, chroma_off)) != 0)
return ret;
if (corr_off >= bytestream2_size(&s->gb)) {
av_log(avctx, AV_LOG_WARNING, "Ignoring invalid correction block position\n");
corr_off = 0;
}
bytestream2_seek(&s->gb, 12, SEEK_SET);
ret = xan_unpack_luma(s, src, s->buffer_size >> 1);
if (ret) {
av_log(avctx, AV_LOG_ERROR, "Luma decoding failed\n");
return ret;
}
ybuf = s->y_buffer;
last = *src++;
ybuf[0] = last << 1;
for (j = 1; j < avctx->width - 1; j += 2) {
cur = (last + *src++) & 0x1F;
ybuf[j] = last + cur;
ybuf[j+1] = cur << 1;
last = cur;
}
ybuf[j] = last << 1;
prev_buf = ybuf;
ybuf += avctx->width;
for (i = 1; i < avctx->height; i++) {
last = ((prev_buf[0] >> 1) + *src++) & 0x1F;
ybuf[0] = last << 1;
for (j = 1; j < avctx->width - 1; j += 2) {
cur = ((prev_buf[j + 1] >> 1) + *src++) & 0x1F;
ybuf[j] = last + cur;
ybuf[j+1] = cur << 1;
last = cur;
}
if(j < avctx->width)
ybuf[j] = last << 1;
prev_buf = ybuf;
ybuf += avctx->width;
}
if (corr_off) {
int dec_size;
bytestream2_seek(&s->gb, 8 + corr_off, SEEK_SET);
dec_size = xan_unpack(s, s->scratch_buffer, s->buffer_size);
if (dec_size < 0)
dec_size = 0;
else
dec_size = FFMIN(dec_size, s->buffer_size/2 - 1);
for (i = 0; i < dec_size; i++)
s->y_buffer[i*2+1] = (s->y_buffer[i*2+1] + (s->scratch_buffer[i] << 1)) & 0x3F;
}
src = s->y_buffer;
ybuf = s->pic.data[0];
for (j = 0; j < avctx->height; j++) {
for (i = 0; i < avctx->width; i++)
ybuf[i] = (src[i] << 2) | (src[i] >> 3);
src += avctx->width;
ybuf += s->pic.linesize[0];
}
return 0;
}
| false | FFmpeg | 77693c541a541661357a0edd5bbaae69c64b2039 | static int xan_decode_frame_type0(AVCodecContext *avctx)
{
XanContext *s = avctx->priv_data;
uint8_t *ybuf, *prev_buf, *src = s->scratch_buffer;
unsigned chroma_off, corr_off;
int cur, last;
int i, j;
int ret;
chroma_off = bytestream2_get_le32(&s->gb);
corr_off = bytestream2_get_le32(&s->gb);
if ((ret = xan_decode_chroma(avctx, chroma_off)) != 0)
return ret;
if (corr_off >= bytestream2_size(&s->gb)) {
av_log(avctx, AV_LOG_WARNING, "Ignoring invalid correction block position\n");
corr_off = 0;
}
bytestream2_seek(&s->gb, 12, SEEK_SET);
ret = xan_unpack_luma(s, src, s->buffer_size >> 1);
if (ret) {
av_log(avctx, AV_LOG_ERROR, "Luma decoding failed\n");
return ret;
}
ybuf = s->y_buffer;
last = *src++;
ybuf[0] = last << 1;
for (j = 1; j < avctx->width - 1; j += 2) {
cur = (last + *src++) & 0x1F;
ybuf[j] = last + cur;
ybuf[j+1] = cur << 1;
last = cur;
}
ybuf[j] = last << 1;
prev_buf = ybuf;
ybuf += avctx->width;
for (i = 1; i < avctx->height; i++) {
last = ((prev_buf[0] >> 1) + *src++) & 0x1F;
ybuf[0] = last << 1;
for (j = 1; j < avctx->width - 1; j += 2) {
cur = ((prev_buf[j + 1] >> 1) + *src++) & 0x1F;
ybuf[j] = last + cur;
ybuf[j+1] = cur << 1;
last = cur;
}
if(j < avctx->width)
ybuf[j] = last << 1;
prev_buf = ybuf;
ybuf += avctx->width;
}
if (corr_off) {
int dec_size;
bytestream2_seek(&s->gb, 8 + corr_off, SEEK_SET);
dec_size = xan_unpack(s, s->scratch_buffer, s->buffer_size);
if (dec_size < 0)
dec_size = 0;
else
dec_size = FFMIN(dec_size, s->buffer_size/2 - 1);
for (i = 0; i < dec_size; i++)
s->y_buffer[i*2+1] = (s->y_buffer[i*2+1] + (s->scratch_buffer[i] << 1)) & 0x3F;
}
src = s->y_buffer;
ybuf = s->pic.data[0];
for (j = 0; j < avctx->height; j++) {
for (i = 0; i < avctx->width; i++)
ybuf[i] = (src[i] << 2) | (src[i] >> 3);
src += avctx->width;
ybuf += s->pic.linesize[0];
}
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0)
{
XanContext *s = VAR_0->priv_data;
uint8_t *ybuf, *prev_buf, *src = s->scratch_buffer;
unsigned VAR_1, VAR_2;
int VAR_3, VAR_4;
int VAR_5, VAR_6;
int VAR_7;
VAR_1 = bytestream2_get_le32(&s->gb);
VAR_2 = bytestream2_get_le32(&s->gb);
if ((VAR_7 = xan_decode_chroma(VAR_0, VAR_1)) != 0)
return VAR_7;
if (VAR_2 >= bytestream2_size(&s->gb)) {
av_log(VAR_0, AV_LOG_WARNING, "Ignoring invalid correction block position\n");
VAR_2 = 0;
}
bytestream2_seek(&s->gb, 12, SEEK_SET);
VAR_7 = xan_unpack_luma(s, src, s->buffer_size >> 1);
if (VAR_7) {
av_log(VAR_0, AV_LOG_ERROR, "Luma decoding failed\n");
return VAR_7;
}
ybuf = s->y_buffer;
VAR_4 = *src++;
ybuf[0] = VAR_4 << 1;
for (VAR_6 = 1; VAR_6 < VAR_0->width - 1; VAR_6 += 2) {
VAR_3 = (VAR_4 + *src++) & 0x1F;
ybuf[VAR_6] = VAR_4 + VAR_3;
ybuf[VAR_6+1] = VAR_3 << 1;
VAR_4 = VAR_3;
}
ybuf[VAR_6] = VAR_4 << 1;
prev_buf = ybuf;
ybuf += VAR_0->width;
for (VAR_5 = 1; VAR_5 < VAR_0->height; VAR_5++) {
VAR_4 = ((prev_buf[0] >> 1) + *src++) & 0x1F;
ybuf[0] = VAR_4 << 1;
for (VAR_6 = 1; VAR_6 < VAR_0->width - 1; VAR_6 += 2) {
VAR_3 = ((prev_buf[VAR_6 + 1] >> 1) + *src++) & 0x1F;
ybuf[VAR_6] = VAR_4 + VAR_3;
ybuf[VAR_6+1] = VAR_3 << 1;
VAR_4 = VAR_3;
}
if(VAR_6 < VAR_0->width)
ybuf[VAR_6] = VAR_4 << 1;
prev_buf = ybuf;
ybuf += VAR_0->width;
}
if (VAR_2) {
int VAR_8;
bytestream2_seek(&s->gb, 8 + VAR_2, SEEK_SET);
VAR_8 = xan_unpack(s, s->scratch_buffer, s->buffer_size);
if (VAR_8 < 0)
VAR_8 = 0;
else
VAR_8 = FFMIN(VAR_8, s->buffer_size/2 - 1);
for (VAR_5 = 0; VAR_5 < VAR_8; VAR_5++)
s->y_buffer[VAR_5*2+1] = (s->y_buffer[VAR_5*2+1] + (s->scratch_buffer[VAR_5] << 1)) & 0x3F;
}
src = s->y_buffer;
ybuf = s->pic.data[0];
for (VAR_6 = 0; VAR_6 < VAR_0->height; VAR_6++) {
for (VAR_5 = 0; VAR_5 < VAR_0->width; VAR_5++)
ybuf[VAR_5] = (src[VAR_5] << 2) | (src[VAR_5] >> 3);
src += VAR_0->width;
ybuf += s->pic.linesize[0];
}
return 0;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0)\n{",
"XanContext *s = VAR_0->priv_data;",
"uint8_t *ybuf, *prev_buf, *src = s->scratch_buffer;",
"unsigned VAR_1, VAR_2;",
"int VAR_3, VAR_4;",
"int VAR_5, VAR_6;",
"int VAR_7;",
"VAR_1 = bytestream2_get_le32(&s->gb);",
"VAR_2 = bytestream2_get_le32(&s->gb);",
"if ((VAR_7 = xan_decode_chroma(VAR_0, VAR_1)) != 0)\nreturn VAR_7;",
"if (VAR_2 >= bytestream2_size(&s->gb)) {",
"av_log(VAR_0, AV_LOG_WARNING, \"Ignoring invalid correction block position\\n\");",
"VAR_2 = 0;",
"}",
"bytestream2_seek(&s->gb, 12, SEEK_SET);",
"VAR_7 = xan_unpack_luma(s, src, s->buffer_size >> 1);",
"if (VAR_7) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Luma decoding failed\\n\");",
"return VAR_7;",
"}",
"ybuf = s->y_buffer;",
"VAR_4 = *src++;",
"ybuf[0] = VAR_4 << 1;",
"for (VAR_6 = 1; VAR_6 < VAR_0->width - 1; VAR_6 += 2) {",
"VAR_3 = (VAR_4 + *src++) & 0x1F;",
"ybuf[VAR_6] = VAR_4 + VAR_3;",
"ybuf[VAR_6+1] = VAR_3 << 1;",
"VAR_4 = VAR_3;",
"}",
"ybuf[VAR_6] = VAR_4 << 1;",
"prev_buf = ybuf;",
"ybuf += VAR_0->width;",
"for (VAR_5 = 1; VAR_5 < VAR_0->height; VAR_5++) {",
"VAR_4 = ((prev_buf[0] >> 1) + *src++) & 0x1F;",
"ybuf[0] = VAR_4 << 1;",
"for (VAR_6 = 1; VAR_6 < VAR_0->width - 1; VAR_6 += 2) {",
"VAR_3 = ((prev_buf[VAR_6 + 1] >> 1) + *src++) & 0x1F;",
"ybuf[VAR_6] = VAR_4 + VAR_3;",
"ybuf[VAR_6+1] = VAR_3 << 1;",
"VAR_4 = VAR_3;",
"}",
"if(VAR_6 < VAR_0->width)\nybuf[VAR_6] = VAR_4 << 1;",
"prev_buf = ybuf;",
"ybuf += VAR_0->width;",
"}",
"if (VAR_2) {",
"int VAR_8;",
"bytestream2_seek(&s->gb, 8 + VAR_2, SEEK_SET);",
"VAR_8 = xan_unpack(s, s->scratch_buffer, s->buffer_size);",
"if (VAR_8 < 0)\nVAR_8 = 0;",
"else\nVAR_8 = FFMIN(VAR_8, s->buffer_size/2 - 1);",
"for (VAR_5 = 0; VAR_5 < VAR_8; VAR_5++)",
"s->y_buffer[VAR_5*2+1] = (s->y_buffer[VAR_5*2+1] + (s->scratch_buffer[VAR_5] << 1)) & 0x3F;",
"}",
"src = s->y_buffer;",
"ybuf = s->pic.data[0];",
"for (VAR_6 = 0; VAR_6 < VAR_0->height; VAR_6++) {",
"for (VAR_5 = 0; VAR_5 < VAR_0->width; VAR_5++)",
"ybuf[VAR_5] = (src[VAR_5] << 2) | (src[VAR_5] >> 3);",
"src += VAR_0->width;",
"ybuf += s->pic.linesize[0];",
"}",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
21
],
[
25,
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97,
99
],
[
101
],
[
103
],
[
105
],
[
109
],
[
111
],
[
115
],
[
117
],
[
119,
121
],
[
123,
125
],
[
129
],
[
131
],
[
133
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
155
],
[
157
]
] |
1,523 | static int bethsoftvid_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
BethsoftvidContext * vid = avctx->priv_data;
char block_type;
uint8_t * dst;
uint8_t * frame_end;
int remaining = avctx->width; // number of bytes remaining on a line
const int wrap_to_next_line = vid->frame.linesize[0] - avctx->width;
int code;
int yoffset;
if (avctx->reget_buffer(avctx, &vid->frame)) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return -1;
}
bytestream2_init(&vid->g, avpkt->data, avpkt->size);
dst = vid->frame.data[0];
frame_end = vid->frame.data[0] + vid->frame.linesize[0] * avctx->height;
switch(block_type = bytestream2_get_byte(&vid->g)){
case PALETTE_BLOCK: {
int ret;
*data_size = 0;
if ((ret = set_palette(vid)) < 0) {
av_log(avctx, AV_LOG_ERROR, "error reading palette\n");
return ret;
}
return bytestream2_tell(&vid->g);
}
case VIDEO_YOFF_P_FRAME:
yoffset = bytestream2_get_le16(&vid->g);
if(yoffset >= avctx->height)
return -1;
dst += vid->frame.linesize[0] * yoffset;
}
// main code
while((code = bytestream2_get_byte(&vid->g))){
int length = code & 0x7f;
// copy any bytes starting at the current position, and ending at the frame width
while(length > remaining){
if(code < 0x80)
bytestream2_get_buffer(&vid->g, dst, remaining);
else if(block_type == VIDEO_I_FRAME)
memset(dst, bytestream2_peek_byte(&vid->g), remaining);
length -= remaining; // decrement the number of bytes to be copied
dst += remaining + wrap_to_next_line; // skip over extra bytes at end of frame
remaining = avctx->width;
if(dst == frame_end)
goto end;
}
// copy any remaining bytes after / if line overflows
if(code < 0x80)
bytestream2_get_buffer(&vid->g, dst, length);
else if(block_type == VIDEO_I_FRAME)
memset(dst, bytestream2_get_byte(&vid->g), length);
remaining -= length;
dst += length;
}
end:
*data_size = sizeof(AVFrame);
*(AVFrame*)data = vid->frame;
return avpkt->size;
}
| false | FFmpeg | f320fb894c695044ef15239d27844d9ac01c9d16 | static int bethsoftvid_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
BethsoftvidContext * vid = avctx->priv_data;
char block_type;
uint8_t * dst;
uint8_t * frame_end;
int remaining = avctx->width;
const int wrap_to_next_line = vid->frame.linesize[0] - avctx->width;
int code;
int yoffset;
if (avctx->reget_buffer(avctx, &vid->frame)) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return -1;
}
bytestream2_init(&vid->g, avpkt->data, avpkt->size);
dst = vid->frame.data[0];
frame_end = vid->frame.data[0] + vid->frame.linesize[0] * avctx->height;
switch(block_type = bytestream2_get_byte(&vid->g)){
case PALETTE_BLOCK: {
int ret;
*data_size = 0;
if ((ret = set_palette(vid)) < 0) {
av_log(avctx, AV_LOG_ERROR, "error reading palette\n");
return ret;
}
return bytestream2_tell(&vid->g);
}
case VIDEO_YOFF_P_FRAME:
yoffset = bytestream2_get_le16(&vid->g);
if(yoffset >= avctx->height)
return -1;
dst += vid->frame.linesize[0] * yoffset;
}
while((code = bytestream2_get_byte(&vid->g))){
int length = code & 0x7f;
while(length > remaining){
if(code < 0x80)
bytestream2_get_buffer(&vid->g, dst, remaining);
else if(block_type == VIDEO_I_FRAME)
memset(dst, bytestream2_peek_byte(&vid->g), remaining);
length -= remaining;
dst += remaining + wrap_to_next_line;
remaining = avctx->width;
if(dst == frame_end)
goto end;
}
if(code < 0x80)
bytestream2_get_buffer(&vid->g, dst, length);
else if(block_type == VIDEO_I_FRAME)
memset(dst, bytestream2_get_byte(&vid->g), length);
remaining -= length;
dst += length;
}
end:
*data_size = sizeof(AVFrame);
*(AVFrame*)data = vid->frame;
return avpkt->size;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0,
void *VAR_1, int *VAR_2,
AVPacket *VAR_3)
{
BethsoftvidContext * vid = VAR_0->priv_data;
char VAR_4;
uint8_t * dst;
uint8_t * frame_end;
int VAR_5 = VAR_0->width;
const int VAR_6 = vid->frame.linesize[0] - VAR_0->width;
int VAR_7;
int VAR_8;
if (VAR_0->reget_buffer(VAR_0, &vid->frame)) {
av_log(VAR_0, AV_LOG_ERROR, "reget_buffer() failed\n");
return -1;
}
bytestream2_init(&vid->g, VAR_3->VAR_1, VAR_3->size);
dst = vid->frame.VAR_1[0];
frame_end = vid->frame.VAR_1[0] + vid->frame.linesize[0] * VAR_0->height;
switch(VAR_4 = bytestream2_get_byte(&vid->g)){
case PALETTE_BLOCK: {
int VAR_9;
*VAR_2 = 0;
if ((VAR_9 = set_palette(vid)) < 0) {
av_log(VAR_0, AV_LOG_ERROR, "error reading palette\n");
return VAR_9;
}
return bytestream2_tell(&vid->g);
}
case VIDEO_YOFF_P_FRAME:
VAR_8 = bytestream2_get_le16(&vid->g);
if(VAR_8 >= VAR_0->height)
return -1;
dst += vid->frame.linesize[0] * VAR_8;
}
while((VAR_7 = bytestream2_get_byte(&vid->g))){
int VAR_10 = VAR_7 & 0x7f;
while(VAR_10 > VAR_5){
if(VAR_7 < 0x80)
bytestream2_get_buffer(&vid->g, dst, VAR_5);
else if(VAR_4 == VIDEO_I_FRAME)
memset(dst, bytestream2_peek_byte(&vid->g), VAR_5);
VAR_10 -= VAR_5;
dst += VAR_5 + VAR_6;
VAR_5 = VAR_0->width;
if(dst == frame_end)
goto end;
}
if(VAR_7 < 0x80)
bytestream2_get_buffer(&vid->g, dst, VAR_10);
else if(VAR_4 == VIDEO_I_FRAME)
memset(dst, bytestream2_get_byte(&vid->g), VAR_10);
VAR_5 -= VAR_10;
dst += VAR_10;
}
end:
*VAR_2 = sizeof(AVFrame);
*(AVFrame*)VAR_1 = vid->frame;
return VAR_3->size;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{",
"BethsoftvidContext * vid = VAR_0->priv_data;",
"char VAR_4;",
"uint8_t * dst;",
"uint8_t * frame_end;",
"int VAR_5 = VAR_0->width;",
"const int VAR_6 = vid->frame.linesize[0] - VAR_0->width;",
"int VAR_7;",
"int VAR_8;",
"if (VAR_0->reget_buffer(VAR_0, &vid->frame)) {",
"av_log(VAR_0, AV_LOG_ERROR, \"reget_buffer() failed\\n\");",
"return -1;",
"}",
"bytestream2_init(&vid->g, VAR_3->VAR_1, VAR_3->size);",
"dst = vid->frame.VAR_1[0];",
"frame_end = vid->frame.VAR_1[0] + vid->frame.linesize[0] * VAR_0->height;",
"switch(VAR_4 = bytestream2_get_byte(&vid->g)){",
"case PALETTE_BLOCK: {",
"int VAR_9;",
"*VAR_2 = 0;",
"if ((VAR_9 = set_palette(vid)) < 0) {",
"av_log(VAR_0, AV_LOG_ERROR, \"error reading palette\\n\");",
"return VAR_9;",
"}",
"return bytestream2_tell(&vid->g);",
"}",
"case VIDEO_YOFF_P_FRAME:\nVAR_8 = bytestream2_get_le16(&vid->g);",
"if(VAR_8 >= VAR_0->height)\nreturn -1;",
"dst += vid->frame.linesize[0] * VAR_8;",
"}",
"while((VAR_7 = bytestream2_get_byte(&vid->g))){",
"int VAR_10 = VAR_7 & 0x7f;",
"while(VAR_10 > VAR_5){",
"if(VAR_7 < 0x80)\nbytestream2_get_buffer(&vid->g, dst, VAR_5);",
"else if(VAR_4 == VIDEO_I_FRAME)\nmemset(dst, bytestream2_peek_byte(&vid->g), VAR_5);",
"VAR_10 -= VAR_5;",
"dst += VAR_5 + VAR_6;",
"VAR_5 = VAR_0->width;",
"if(dst == frame_end)\ngoto end;",
"}",
"if(VAR_7 < 0x80)\nbytestream2_get_buffer(&vid->g, dst, VAR_10);",
"else if(VAR_4 == VIDEO_I_FRAME)\nmemset(dst, bytestream2_get_byte(&vid->g), VAR_10);",
"VAR_5 -= VAR_10;",
"dst += VAR_10;",
"}",
"end:\n*VAR_2 = sizeof(AVFrame);",
"*(AVFrame*)VAR_1 = vid->frame;",
"return VAR_3->size;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65,
67
],
[
69,
71
],
[
73
],
[
75
],
[
81
],
[
83
],
[
89
],
[
91,
93
],
[
95,
97
],
[
99
],
[
101
],
[
103
],
[
105,
107
],
[
109
],
[
115,
117
],
[
119,
121
],
[
123
],
[
125
],
[
127
],
[
129,
133
],
[
135
],
[
139
],
[
141
]
] |
1,524 | static void decode_delta_d(uint8_t *dst,
const uint8_t *buf, const uint8_t *buf_end,
int w, int flag, int bpp, int dst_size)
{
int planepitch = FFALIGN(w, 16) >> 3;
int pitch = planepitch * bpp;
int planepitch_byte = (w + 7) / 8;
unsigned entries, ofssrc;
GetByteContext gb, ptrs;
PutByteContext pb;
int k;
if (buf_end - buf <= 4 * bpp)
return;
bytestream2_init_writer(&pb, dst, dst_size);
bytestream2_init(&ptrs, buf, bpp * 4);
for (k = 0; k < bpp; k++) {
ofssrc = bytestream2_get_be32(&ptrs);
if (!ofssrc)
continue;
if (ofssrc >= buf_end - buf)
continue;
bytestream2_init(&gb, buf + ofssrc, buf_end - (buf + ofssrc));
entries = bytestream2_get_be32(&gb);
while (entries) {
int32_t opcode = bytestream2_get_be32(&gb);
unsigned offset = bytestream2_get_be32(&gb);
bytestream2_seek_p(&pb, (offset / planepitch_byte) * pitch + (offset % planepitch_byte) + k * planepitch, SEEK_SET);
if (opcode >= 0) {
uint32_t x = bytestream2_get_be32(&gb);
while (opcode && bytestream2_get_bytes_left_p(&pb) > 0) {
bytestream2_put_be32(&pb, x);
bytestream2_skip_p(&pb, pitch - 4);
opcode--;
}
} else {
opcode = -opcode;
while (opcode && bytestream2_get_bytes_left(&gb) > 0) {
bytestream2_put_be32(&pb, bytestream2_get_be32(&gb));
bytestream2_skip_p(&pb, pitch - 4);
opcode--;
}
}
entries--;
}
}
}
| false | FFmpeg | 810a8ba5b67389e808ed2f124e1cd54b8a26e679 | static void decode_delta_d(uint8_t *dst,
const uint8_t *buf, const uint8_t *buf_end,
int w, int flag, int bpp, int dst_size)
{
int planepitch = FFALIGN(w, 16) >> 3;
int pitch = planepitch * bpp;
int planepitch_byte = (w + 7) / 8;
unsigned entries, ofssrc;
GetByteContext gb, ptrs;
PutByteContext pb;
int k;
if (buf_end - buf <= 4 * bpp)
return;
bytestream2_init_writer(&pb, dst, dst_size);
bytestream2_init(&ptrs, buf, bpp * 4);
for (k = 0; k < bpp; k++) {
ofssrc = bytestream2_get_be32(&ptrs);
if (!ofssrc)
continue;
if (ofssrc >= buf_end - buf)
continue;
bytestream2_init(&gb, buf + ofssrc, buf_end - (buf + ofssrc));
entries = bytestream2_get_be32(&gb);
while (entries) {
int32_t opcode = bytestream2_get_be32(&gb);
unsigned offset = bytestream2_get_be32(&gb);
bytestream2_seek_p(&pb, (offset / planepitch_byte) * pitch + (offset % planepitch_byte) + k * planepitch, SEEK_SET);
if (opcode >= 0) {
uint32_t x = bytestream2_get_be32(&gb);
while (opcode && bytestream2_get_bytes_left_p(&pb) > 0) {
bytestream2_put_be32(&pb, x);
bytestream2_skip_p(&pb, pitch - 4);
opcode--;
}
} else {
opcode = -opcode;
while (opcode && bytestream2_get_bytes_left(&gb) > 0) {
bytestream2_put_be32(&pb, bytestream2_get_be32(&gb));
bytestream2_skip_p(&pb, pitch - 4);
opcode--;
}
}
entries--;
}
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(uint8_t *VAR_0,
const uint8_t *VAR_1, const uint8_t *VAR_2,
int VAR_3, int VAR_4, int VAR_5, int VAR_6)
{
int VAR_7 = FFALIGN(VAR_3, 16) >> 3;
int VAR_8 = VAR_7 * VAR_5;
int VAR_9 = (VAR_3 + 7) / 8;
unsigned VAR_10, VAR_11;
GetByteContext gb, ptrs;
PutByteContext pb;
int VAR_12;
if (VAR_2 - VAR_1 <= 4 * VAR_5)
return;
bytestream2_init_writer(&pb, VAR_0, VAR_6);
bytestream2_init(&ptrs, VAR_1, VAR_5 * 4);
for (VAR_12 = 0; VAR_12 < VAR_5; VAR_12++) {
VAR_11 = bytestream2_get_be32(&ptrs);
if (!VAR_11)
continue;
if (VAR_11 >= VAR_2 - VAR_1)
continue;
bytestream2_init(&gb, VAR_1 + VAR_11, VAR_2 - (VAR_1 + VAR_11));
VAR_10 = bytestream2_get_be32(&gb);
while (VAR_10) {
int32_t opcode = bytestream2_get_be32(&gb);
unsigned VAR_13 = bytestream2_get_be32(&gb);
bytestream2_seek_p(&pb, (VAR_13 / VAR_9) * VAR_8 + (VAR_13 % VAR_9) + VAR_12 * VAR_7, SEEK_SET);
if (opcode >= 0) {
uint32_t x = bytestream2_get_be32(&gb);
while (opcode && bytestream2_get_bytes_left_p(&pb) > 0) {
bytestream2_put_be32(&pb, x);
bytestream2_skip_p(&pb, VAR_8 - 4);
opcode--;
}
} else {
opcode = -opcode;
while (opcode && bytestream2_get_bytes_left(&gb) > 0) {
bytestream2_put_be32(&pb, bytestream2_get_be32(&gb));
bytestream2_skip_p(&pb, VAR_8 - 4);
opcode--;
}
}
VAR_10--;
}
}
}
| [
"static void FUNC_0(uint8_t *VAR_0,\nconst uint8_t *VAR_1, const uint8_t *VAR_2,\nint VAR_3, int VAR_4, int VAR_5, int VAR_6)\n{",
"int VAR_7 = FFALIGN(VAR_3, 16) >> 3;",
"int VAR_8 = VAR_7 * VAR_5;",
"int VAR_9 = (VAR_3 + 7) / 8;",
"unsigned VAR_10, VAR_11;",
"GetByteContext gb, ptrs;",
"PutByteContext pb;",
"int VAR_12;",
"if (VAR_2 - VAR_1 <= 4 * VAR_5)\nreturn;",
"bytestream2_init_writer(&pb, VAR_0, VAR_6);",
"bytestream2_init(&ptrs, VAR_1, VAR_5 * 4);",
"for (VAR_12 = 0; VAR_12 < VAR_5; VAR_12++) {",
"VAR_11 = bytestream2_get_be32(&ptrs);",
"if (!VAR_11)\ncontinue;",
"if (VAR_11 >= VAR_2 - VAR_1)\ncontinue;",
"bytestream2_init(&gb, VAR_1 + VAR_11, VAR_2 - (VAR_1 + VAR_11));",
"VAR_10 = bytestream2_get_be32(&gb);",
"while (VAR_10) {",
"int32_t opcode = bytestream2_get_be32(&gb);",
"unsigned VAR_13 = bytestream2_get_be32(&gb);",
"bytestream2_seek_p(&pb, (VAR_13 / VAR_9) * VAR_8 + (VAR_13 % VAR_9) + VAR_12 * VAR_7, SEEK_SET);",
"if (opcode >= 0) {",
"uint32_t x = bytestream2_get_be32(&gb);",
"while (opcode && bytestream2_get_bytes_left_p(&pb) > 0) {",
"bytestream2_put_be32(&pb, x);",
"bytestream2_skip_p(&pb, VAR_8 - 4);",
"opcode--;",
"}",
"} else {",
"opcode = -opcode;",
"while (opcode && bytestream2_get_bytes_left(&gb) > 0) {",
"bytestream2_put_be32(&pb, bytestream2_get_be32(&gb));",
"bytestream2_skip_p(&pb, VAR_8 - 4);",
"opcode--;",
"}",
"}",
"VAR_10--;",
"}",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25,
27
],
[
31
],
[
33
],
[
37
],
[
39
],
[
43,
45
],
[
49,
51
],
[
55
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
]
] |
1,526 | static void avc_luma_hv_qrt_and_aver_dst_8x8_msa(const uint8_t *src_x,
const uint8_t *src_y,
int32_t src_stride,
uint8_t *dst,
int32_t dst_stride)
{
uint32_t loop_cnt;
v16i8 src_hz0, src_hz1, src_hz2, src_hz3;
v16u8 dst0, dst1, dst2, dst3;
v16i8 src_vt0, src_vt1, src_vt2, src_vt3;
v16i8 src_vt4, src_vt5, src_vt6, src_vt7, src_vt8;
v16i8 mask0, mask1, mask2;
v8i16 hz_out0, hz_out1, hz_out2, hz_out3;
v8i16 vert_out0, vert_out1, vert_out2, vert_out3;
v8i16 out0, out1, out2, out3;
LD_SB3(&luma_mask_arr[0], 16, mask0, mask1, mask2);
LD_SB5(src_y, src_stride, src_vt0, src_vt1, src_vt2, src_vt3, src_vt4);
src_y += (5 * src_stride);
src_vt0 = (v16i8) __msa_insve_d((v2i64) src_vt0, 1, (v2i64) src_vt1);
src_vt1 = (v16i8) __msa_insve_d((v2i64) src_vt1, 1, (v2i64) src_vt2);
src_vt2 = (v16i8) __msa_insve_d((v2i64) src_vt2, 1, (v2i64) src_vt3);
src_vt3 = (v16i8) __msa_insve_d((v2i64) src_vt3, 1, (v2i64) src_vt4);
XORI_B4_128_SB(src_vt0, src_vt1, src_vt2, src_vt3);
for (loop_cnt = 2; loop_cnt--;) {
LD_SB4(src_x, src_stride, src_hz0, src_hz1, src_hz2, src_hz3);
XORI_B4_128_SB(src_hz0, src_hz1, src_hz2, src_hz3);
src_x += (4 * src_stride);
LD_UB4(dst, dst_stride, dst0, dst1, dst2, dst3);
hz_out0 = AVC_HORZ_FILTER_SH(src_hz0, mask0, mask1, mask2);
hz_out1 = AVC_HORZ_FILTER_SH(src_hz1, mask0, mask1, mask2);
hz_out2 = AVC_HORZ_FILTER_SH(src_hz2, mask0, mask1, mask2);
hz_out3 = AVC_HORZ_FILTER_SH(src_hz3, mask0, mask1, mask2);
SRARI_H4_SH(hz_out0, hz_out1, hz_out2, hz_out3, 5);
SAT_SH4_SH(hz_out0, hz_out1, hz_out2, hz_out3, 7);
LD_SB4(src_y, src_stride, src_vt5, src_vt6, src_vt7, src_vt8);
src_y += (4 * src_stride);
src_vt4 = (v16i8) __msa_insve_d((v2i64) src_vt4, 1, (v2i64) src_vt5);
src_vt5 = (v16i8) __msa_insve_d((v2i64) src_vt5, 1, (v2i64) src_vt6);
src_vt6 = (v16i8) __msa_insve_d((v2i64) src_vt6, 1, (v2i64) src_vt7);
src_vt7 = (v16i8) __msa_insve_d((v2i64) src_vt7, 1, (v2i64) src_vt8);
XORI_B4_128_SB(src_vt4, src_vt5, src_vt6, src_vt7);
AVC_CALC_DPADD_B_6PIX_2COEFF_SH(src_vt0, src_vt1, src_vt2, src_vt3,
src_vt4, src_vt5, vert_out0, vert_out1);
AVC_CALC_DPADD_B_6PIX_2COEFF_SH(src_vt2, src_vt3, src_vt4, src_vt5,
src_vt6, src_vt7, vert_out2, vert_out3);
SRARI_H4_SH(vert_out0, vert_out1, vert_out2, vert_out3, 5);
SAT_SH4_SH(vert_out0, vert_out1, vert_out2, vert_out3, 7);
out0 = __msa_srari_h((hz_out0 + vert_out0), 1);
out1 = __msa_srari_h((hz_out1 + vert_out1), 1);
out2 = __msa_srari_h((hz_out2 + vert_out2), 1);
out3 = __msa_srari_h((hz_out3 + vert_out3), 1);
SAT_SH4_SH(out0, out1, out2, out3, 7);
ILVR_D2_UB(dst1, dst0, dst3, dst2, dst0, dst1);
CONVERT_UB_AVG_ST8x4_UB(out0, out1, out2, out3, dst0, dst1,
dst, dst_stride);
dst += (4 * dst_stride);
src_vt0 = src_vt4;
src_vt1 = src_vt5;
src_vt2 = src_vt6;
src_vt3 = src_vt7;
src_vt4 = src_vt8;
}
}
| false | FFmpeg | 662234a9a22f1cd0f0ac83b8bb1ffadedca90c0a | static void avc_luma_hv_qrt_and_aver_dst_8x8_msa(const uint8_t *src_x,
const uint8_t *src_y,
int32_t src_stride,
uint8_t *dst,
int32_t dst_stride)
{
uint32_t loop_cnt;
v16i8 src_hz0, src_hz1, src_hz2, src_hz3;
v16u8 dst0, dst1, dst2, dst3;
v16i8 src_vt0, src_vt1, src_vt2, src_vt3;
v16i8 src_vt4, src_vt5, src_vt6, src_vt7, src_vt8;
v16i8 mask0, mask1, mask2;
v8i16 hz_out0, hz_out1, hz_out2, hz_out3;
v8i16 vert_out0, vert_out1, vert_out2, vert_out3;
v8i16 out0, out1, out2, out3;
LD_SB3(&luma_mask_arr[0], 16, mask0, mask1, mask2);
LD_SB5(src_y, src_stride, src_vt0, src_vt1, src_vt2, src_vt3, src_vt4);
src_y += (5 * src_stride);
src_vt0 = (v16i8) __msa_insve_d((v2i64) src_vt0, 1, (v2i64) src_vt1);
src_vt1 = (v16i8) __msa_insve_d((v2i64) src_vt1, 1, (v2i64) src_vt2);
src_vt2 = (v16i8) __msa_insve_d((v2i64) src_vt2, 1, (v2i64) src_vt3);
src_vt3 = (v16i8) __msa_insve_d((v2i64) src_vt3, 1, (v2i64) src_vt4);
XORI_B4_128_SB(src_vt0, src_vt1, src_vt2, src_vt3);
for (loop_cnt = 2; loop_cnt--;) {
LD_SB4(src_x, src_stride, src_hz0, src_hz1, src_hz2, src_hz3);
XORI_B4_128_SB(src_hz0, src_hz1, src_hz2, src_hz3);
src_x += (4 * src_stride);
LD_UB4(dst, dst_stride, dst0, dst1, dst2, dst3);
hz_out0 = AVC_HORZ_FILTER_SH(src_hz0, mask0, mask1, mask2);
hz_out1 = AVC_HORZ_FILTER_SH(src_hz1, mask0, mask1, mask2);
hz_out2 = AVC_HORZ_FILTER_SH(src_hz2, mask0, mask1, mask2);
hz_out3 = AVC_HORZ_FILTER_SH(src_hz3, mask0, mask1, mask2);
SRARI_H4_SH(hz_out0, hz_out1, hz_out2, hz_out3, 5);
SAT_SH4_SH(hz_out0, hz_out1, hz_out2, hz_out3, 7);
LD_SB4(src_y, src_stride, src_vt5, src_vt6, src_vt7, src_vt8);
src_y += (4 * src_stride);
src_vt4 = (v16i8) __msa_insve_d((v2i64) src_vt4, 1, (v2i64) src_vt5);
src_vt5 = (v16i8) __msa_insve_d((v2i64) src_vt5, 1, (v2i64) src_vt6);
src_vt6 = (v16i8) __msa_insve_d((v2i64) src_vt6, 1, (v2i64) src_vt7);
src_vt7 = (v16i8) __msa_insve_d((v2i64) src_vt7, 1, (v2i64) src_vt8);
XORI_B4_128_SB(src_vt4, src_vt5, src_vt6, src_vt7);
AVC_CALC_DPADD_B_6PIX_2COEFF_SH(src_vt0, src_vt1, src_vt2, src_vt3,
src_vt4, src_vt5, vert_out0, vert_out1);
AVC_CALC_DPADD_B_6PIX_2COEFF_SH(src_vt2, src_vt3, src_vt4, src_vt5,
src_vt6, src_vt7, vert_out2, vert_out3);
SRARI_H4_SH(vert_out0, vert_out1, vert_out2, vert_out3, 5);
SAT_SH4_SH(vert_out0, vert_out1, vert_out2, vert_out3, 7);
out0 = __msa_srari_h((hz_out0 + vert_out0), 1);
out1 = __msa_srari_h((hz_out1 + vert_out1), 1);
out2 = __msa_srari_h((hz_out2 + vert_out2), 1);
out3 = __msa_srari_h((hz_out3 + vert_out3), 1);
SAT_SH4_SH(out0, out1, out2, out3, 7);
ILVR_D2_UB(dst1, dst0, dst3, dst2, dst0, dst1);
CONVERT_UB_AVG_ST8x4_UB(out0, out1, out2, out3, dst0, dst1,
dst, dst_stride);
dst += (4 * dst_stride);
src_vt0 = src_vt4;
src_vt1 = src_vt5;
src_vt2 = src_vt6;
src_vt3 = src_vt7;
src_vt4 = src_vt8;
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(const uint8_t *VAR_0,
const uint8_t *VAR_1,
int32_t VAR_2,
uint8_t *VAR_3,
int32_t VAR_4)
{
uint32_t loop_cnt;
v16i8 src_hz0, src_hz1, src_hz2, src_hz3;
v16u8 dst0, dst1, dst2, dst3;
v16i8 src_vt0, src_vt1, src_vt2, src_vt3;
v16i8 src_vt4, src_vt5, src_vt6, src_vt7, src_vt8;
v16i8 mask0, mask1, mask2;
v8i16 hz_out0, hz_out1, hz_out2, hz_out3;
v8i16 vert_out0, vert_out1, vert_out2, vert_out3;
v8i16 out0, out1, out2, out3;
LD_SB3(&luma_mask_arr[0], 16, mask0, mask1, mask2);
LD_SB5(VAR_1, VAR_2, src_vt0, src_vt1, src_vt2, src_vt3, src_vt4);
VAR_1 += (5 * VAR_2);
src_vt0 = (v16i8) __msa_insve_d((v2i64) src_vt0, 1, (v2i64) src_vt1);
src_vt1 = (v16i8) __msa_insve_d((v2i64) src_vt1, 1, (v2i64) src_vt2);
src_vt2 = (v16i8) __msa_insve_d((v2i64) src_vt2, 1, (v2i64) src_vt3);
src_vt3 = (v16i8) __msa_insve_d((v2i64) src_vt3, 1, (v2i64) src_vt4);
XORI_B4_128_SB(src_vt0, src_vt1, src_vt2, src_vt3);
for (loop_cnt = 2; loop_cnt--;) {
LD_SB4(VAR_0, VAR_2, src_hz0, src_hz1, src_hz2, src_hz3);
XORI_B4_128_SB(src_hz0, src_hz1, src_hz2, src_hz3);
VAR_0 += (4 * VAR_2);
LD_UB4(VAR_3, VAR_4, dst0, dst1, dst2, dst3);
hz_out0 = AVC_HORZ_FILTER_SH(src_hz0, mask0, mask1, mask2);
hz_out1 = AVC_HORZ_FILTER_SH(src_hz1, mask0, mask1, mask2);
hz_out2 = AVC_HORZ_FILTER_SH(src_hz2, mask0, mask1, mask2);
hz_out3 = AVC_HORZ_FILTER_SH(src_hz3, mask0, mask1, mask2);
SRARI_H4_SH(hz_out0, hz_out1, hz_out2, hz_out3, 5);
SAT_SH4_SH(hz_out0, hz_out1, hz_out2, hz_out3, 7);
LD_SB4(VAR_1, VAR_2, src_vt5, src_vt6, src_vt7, src_vt8);
VAR_1 += (4 * VAR_2);
src_vt4 = (v16i8) __msa_insve_d((v2i64) src_vt4, 1, (v2i64) src_vt5);
src_vt5 = (v16i8) __msa_insve_d((v2i64) src_vt5, 1, (v2i64) src_vt6);
src_vt6 = (v16i8) __msa_insve_d((v2i64) src_vt6, 1, (v2i64) src_vt7);
src_vt7 = (v16i8) __msa_insve_d((v2i64) src_vt7, 1, (v2i64) src_vt8);
XORI_B4_128_SB(src_vt4, src_vt5, src_vt6, src_vt7);
AVC_CALC_DPADD_B_6PIX_2COEFF_SH(src_vt0, src_vt1, src_vt2, src_vt3,
src_vt4, src_vt5, vert_out0, vert_out1);
AVC_CALC_DPADD_B_6PIX_2COEFF_SH(src_vt2, src_vt3, src_vt4, src_vt5,
src_vt6, src_vt7, vert_out2, vert_out3);
SRARI_H4_SH(vert_out0, vert_out1, vert_out2, vert_out3, 5);
SAT_SH4_SH(vert_out0, vert_out1, vert_out2, vert_out3, 7);
out0 = __msa_srari_h((hz_out0 + vert_out0), 1);
out1 = __msa_srari_h((hz_out1 + vert_out1), 1);
out2 = __msa_srari_h((hz_out2 + vert_out2), 1);
out3 = __msa_srari_h((hz_out3 + vert_out3), 1);
SAT_SH4_SH(out0, out1, out2, out3, 7);
ILVR_D2_UB(dst1, dst0, dst3, dst2, dst0, dst1);
CONVERT_UB_AVG_ST8x4_UB(out0, out1, out2, out3, dst0, dst1,
VAR_3, VAR_4);
VAR_3 += (4 * VAR_4);
src_vt0 = src_vt4;
src_vt1 = src_vt5;
src_vt2 = src_vt6;
src_vt3 = src_vt7;
src_vt4 = src_vt8;
}
}
| [
"static void FUNC_0(const uint8_t *VAR_0,\nconst uint8_t *VAR_1,\nint32_t VAR_2,\nuint8_t *VAR_3,\nint32_t VAR_4)\n{",
"uint32_t loop_cnt;",
"v16i8 src_hz0, src_hz1, src_hz2, src_hz3;",
"v16u8 dst0, dst1, dst2, dst3;",
"v16i8 src_vt0, src_vt1, src_vt2, src_vt3;",
"v16i8 src_vt4, src_vt5, src_vt6, src_vt7, src_vt8;",
"v16i8 mask0, mask1, mask2;",
"v8i16 hz_out0, hz_out1, hz_out2, hz_out3;",
"v8i16 vert_out0, vert_out1, vert_out2, vert_out3;",
"v8i16 out0, out1, out2, out3;",
"LD_SB3(&luma_mask_arr[0], 16, mask0, mask1, mask2);",
"LD_SB5(VAR_1, VAR_2, src_vt0, src_vt1, src_vt2, src_vt3, src_vt4);",
"VAR_1 += (5 * VAR_2);",
"src_vt0 = (v16i8) __msa_insve_d((v2i64) src_vt0, 1, (v2i64) src_vt1);",
"src_vt1 = (v16i8) __msa_insve_d((v2i64) src_vt1, 1, (v2i64) src_vt2);",
"src_vt2 = (v16i8) __msa_insve_d((v2i64) src_vt2, 1, (v2i64) src_vt3);",
"src_vt3 = (v16i8) __msa_insve_d((v2i64) src_vt3, 1, (v2i64) src_vt4);",
"XORI_B4_128_SB(src_vt0, src_vt1, src_vt2, src_vt3);",
"for (loop_cnt = 2; loop_cnt--;) {",
"LD_SB4(VAR_0, VAR_2, src_hz0, src_hz1, src_hz2, src_hz3);",
"XORI_B4_128_SB(src_hz0, src_hz1, src_hz2, src_hz3);",
"VAR_0 += (4 * VAR_2);",
"LD_UB4(VAR_3, VAR_4, dst0, dst1, dst2, dst3);",
"hz_out0 = AVC_HORZ_FILTER_SH(src_hz0, mask0, mask1, mask2);",
"hz_out1 = AVC_HORZ_FILTER_SH(src_hz1, mask0, mask1, mask2);",
"hz_out2 = AVC_HORZ_FILTER_SH(src_hz2, mask0, mask1, mask2);",
"hz_out3 = AVC_HORZ_FILTER_SH(src_hz3, mask0, mask1, mask2);",
"SRARI_H4_SH(hz_out0, hz_out1, hz_out2, hz_out3, 5);",
"SAT_SH4_SH(hz_out0, hz_out1, hz_out2, hz_out3, 7);",
"LD_SB4(VAR_1, VAR_2, src_vt5, src_vt6, src_vt7, src_vt8);",
"VAR_1 += (4 * VAR_2);",
"src_vt4 = (v16i8) __msa_insve_d((v2i64) src_vt4, 1, (v2i64) src_vt5);",
"src_vt5 = (v16i8) __msa_insve_d((v2i64) src_vt5, 1, (v2i64) src_vt6);",
"src_vt6 = (v16i8) __msa_insve_d((v2i64) src_vt6, 1, (v2i64) src_vt7);",
"src_vt7 = (v16i8) __msa_insve_d((v2i64) src_vt7, 1, (v2i64) src_vt8);",
"XORI_B4_128_SB(src_vt4, src_vt5, src_vt6, src_vt7);",
"AVC_CALC_DPADD_B_6PIX_2COEFF_SH(src_vt0, src_vt1, src_vt2, src_vt3,\nsrc_vt4, src_vt5, vert_out0, vert_out1);",
"AVC_CALC_DPADD_B_6PIX_2COEFF_SH(src_vt2, src_vt3, src_vt4, src_vt5,\nsrc_vt6, src_vt7, vert_out2, vert_out3);",
"SRARI_H4_SH(vert_out0, vert_out1, vert_out2, vert_out3, 5);",
"SAT_SH4_SH(vert_out0, vert_out1, vert_out2, vert_out3, 7);",
"out0 = __msa_srari_h((hz_out0 + vert_out0), 1);",
"out1 = __msa_srari_h((hz_out1 + vert_out1), 1);",
"out2 = __msa_srari_h((hz_out2 + vert_out2), 1);",
"out3 = __msa_srari_h((hz_out3 + vert_out3), 1);",
"SAT_SH4_SH(out0, out1, out2, out3, 7);",
"ILVR_D2_UB(dst1, dst0, dst3, dst2, dst0, dst1);",
"CONVERT_UB_AVG_ST8x4_UB(out0, out1, out2, out3, dst0, dst1,\nVAR_3, VAR_4);",
"VAR_3 += (4 * VAR_4);",
"src_vt0 = src_vt4;",
"src_vt1 = src_vt5;",
"src_vt2 = src_vt6;",
"src_vt3 = src_vt7;",
"src_vt4 = src_vt8;",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7,
9,
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
33
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47
],
[
49
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
87
],
[
89
],
[
91
],
[
93
],
[
97
],
[
99,
101
],
[
103,
105
],
[
107
],
[
109
],
[
113
],
[
115
],
[
117
],
[
119
],
[
123
],
[
125
],
[
127,
129
],
[
131
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
]
] |
1,527 | static void hScale8To19_c(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *src,
const int16_t *filter, const int16_t *filterPos,
int filterSize)
{
int i;
int32_t *dst = (int32_t *) _dst;
for (i=0; i<dstW; i++) {
int j;
int srcPos= filterPos[i];
int val=0;
for (j=0; j<filterSize; j++) {
val += ((int)src[srcPos + j])*filter[filterSize*i + j];
}
//filter += hFilterSize;
dst[i] = FFMIN(val>>3, (1<<19)-1); // the cubic equation does overflow ...
//dst[i] = val>>7;
}
}
| true | FFmpeg | 2254b559cbcfc0418135f09add37c0a5866b1981 | static void hScale8To19_c(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *src,
const int16_t *filter, const int16_t *filterPos,
int filterSize)
{
int i;
int32_t *dst = (int32_t *) _dst;
for (i=0; i<dstW; i++) {
int j;
int srcPos= filterPos[i];
int val=0;
for (j=0; j<filterSize; j++) {
val += ((int)src[srcPos + j])*filter[filterSize*i + j];
}
dst[i] = FFMIN(val>>3, (1<<19)-1);
}
}
| {
"code": [
" const int16_t *filter, const int16_t *filterPos,",
" const int16_t *filter, const int16_t *filterPos,"
],
"line_no": [
3,
3
]
} | static void FUNC_0(SwsContext *VAR_0, int16_t *VAR_1, int VAR_2, const uint8_t *VAR_3,
const int16_t *VAR_4, const int16_t *VAR_5,
int VAR_6)
{
int VAR_7;
int32_t *dst = (int32_t *) VAR_1;
for (VAR_7=0; VAR_7<VAR_2; VAR_7++) {
int VAR_8;
int VAR_9= VAR_5[VAR_7];
int VAR_10=0;
for (VAR_8=0; VAR_8<VAR_6; VAR_8++) {
VAR_10 += ((int)VAR_3[VAR_9 + VAR_8])*VAR_4[VAR_6*VAR_7 + VAR_8];
}
dst[VAR_7] = FFMIN(VAR_10>>3, (1<<19)-1);
}
}
| [
"static void FUNC_0(SwsContext *VAR_0, int16_t *VAR_1, int VAR_2, const uint8_t *VAR_3,\nconst int16_t *VAR_4, const int16_t *VAR_5,\nint VAR_6)\n{",
"int VAR_7;",
"int32_t *dst = (int32_t *) VAR_1;",
"for (VAR_7=0; VAR_7<VAR_2; VAR_7++) {",
"int VAR_8;",
"int VAR_9= VAR_5[VAR_7];",
"int VAR_10=0;",
"for (VAR_8=0; VAR_8<VAR_6; VAR_8++) {",
"VAR_10 += ((int)VAR_3[VAR_9 + VAR_8])*VAR_4[VAR_6*VAR_7 + VAR_8];",
"}",
"dst[VAR_7] = FFMIN(VAR_10>>3, (1<<19)-1);",
"}",
"}"
] | [
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
33
],
[
35
]
] |
1,529 | static void cpu_notify_map_clients_locked(void)
{
MapClient *client;
while (!QLIST_EMPTY(&map_client_list)) {
client = QLIST_FIRST(&map_client_list);
client->callback(client->opaque);
cpu_unregister_map_client(client);
}
}
| true | qemu | e95205e1f9cd2c4262b7a7b1c992a94512c86d0e | static void cpu_notify_map_clients_locked(void)
{
MapClient *client;
while (!QLIST_EMPTY(&map_client_list)) {
client = QLIST_FIRST(&map_client_list);
client->callback(client->opaque);
cpu_unregister_map_client(client);
}
}
| {
"code": [
" client->callback(client->opaque);",
" cpu_unregister_map_client(client);"
],
"line_no": [
13,
15
]
} | static void FUNC_0(void)
{
MapClient *client;
while (!QLIST_EMPTY(&map_client_list)) {
client = QLIST_FIRST(&map_client_list);
client->callback(client->opaque);
cpu_unregister_map_client(client);
}
}
| [
"static void FUNC_0(void)\n{",
"MapClient *client;",
"while (!QLIST_EMPTY(&map_client_list)) {",
"client = QLIST_FIRST(&map_client_list);",
"client->callback(client->opaque);",
"cpu_unregister_map_client(client);",
"}",
"}"
] | [
0,
0,
0,
0,
1,
1,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
]
] |
1,530 | int show_bsfs(void *optctx, const char *opt, const char *arg)
{
AVBitStreamFilter *bsf = NULL;
printf("Bitstream filters:\n");
while ((bsf = av_bitstream_filter_next(bsf)))
printf("%s\n", bsf->name);
printf("\n");
return 0;
}
| true | FFmpeg | 5ef19590802f000299e418143fc2301e3f43affe | int show_bsfs(void *optctx, const char *opt, const char *arg)
{
AVBitStreamFilter *bsf = NULL;
printf("Bitstream filters:\n");
while ((bsf = av_bitstream_filter_next(bsf)))
printf("%s\n", bsf->name);
printf("\n");
return 0;
}
| {
"code": [
" AVBitStreamFilter *bsf = NULL;",
" while ((bsf = av_bitstream_filter_next(bsf)))"
],
"line_no": [
5,
11
]
} | int FUNC_0(void *VAR_0, const char *VAR_1, const char *VAR_2)
{
AVBitStreamFilter *bsf = NULL;
printf("Bitstream filters:\n");
while ((bsf = av_bitstream_filter_next(bsf)))
printf("%s\n", bsf->name);
printf("\n");
return 0;
}
| [
"int FUNC_0(void *VAR_0, const char *VAR_1, const char *VAR_2)\n{",
"AVBitStreamFilter *bsf = NULL;",
"printf(\"Bitstream filters:\\n\");",
"while ((bsf = av_bitstream_filter_next(bsf)))\nprintf(\"%s\\n\", bsf->name);",
"printf(\"\\n\");",
"return 0;",
"}"
] | [
0,
1,
0,
1,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11,
13
],
[
15
],
[
17
],
[
19
]
] |
1,531 | static inline int decode_vui_parameters(H264Context *h, SPS *sps){
MpegEncContext * const s = &h->s;
int aspect_ratio_info_present_flag;
unsigned int aspect_ratio_idc;
aspect_ratio_info_present_flag= get_bits1(&s->gb);
if( aspect_ratio_info_present_flag ) {
aspect_ratio_idc= get_bits(&s->gb, 8);
if( aspect_ratio_idc == EXTENDED_SAR ) {
sps->sar.num= get_bits(&s->gb, 16);
sps->sar.den= get_bits(&s->gb, 16);
}else if(aspect_ratio_idc < FF_ARRAY_ELEMS(pixel_aspect)){
sps->sar= pixel_aspect[aspect_ratio_idc];
}else{
av_log(h->s.avctx, AV_LOG_ERROR, "illegal aspect ratio\n");
return -1;
}
}else{
sps->sar.num=
sps->sar.den= 0;
}
// s->avctx->aspect_ratio= sar_width*s->width / (float)(s->height*sar_height);
if(get_bits1(&s->gb)){ /* overscan_info_present_flag */
get_bits1(&s->gb); /* overscan_appropriate_flag */
}
sps->video_signal_type_present_flag = get_bits1(&s->gb);
if(sps->video_signal_type_present_flag){
get_bits(&s->gb, 3); /* video_format */
sps->full_range = get_bits1(&s->gb); /* video_full_range_flag */
sps->colour_description_present_flag = get_bits1(&s->gb);
if(sps->colour_description_present_flag){
sps->color_primaries = get_bits(&s->gb, 8); /* colour_primaries */
sps->color_trc = get_bits(&s->gb, 8); /* transfer_characteristics */
sps->colorspace = get_bits(&s->gb, 8); /* matrix_coefficients */
if (sps->color_primaries >= AVCOL_PRI_NB)
sps->color_primaries = AVCOL_PRI_UNSPECIFIED;
if (sps->color_trc >= AVCOL_TRC_NB)
sps->color_trc = AVCOL_TRC_UNSPECIFIED;
if (sps->colorspace >= AVCOL_SPC_NB)
sps->colorspace = AVCOL_SPC_UNSPECIFIED;
}
}
if(get_bits1(&s->gb)){ /* chroma_location_info_present_flag */
s->avctx->chroma_sample_location = get_ue_golomb(&s->gb)+1; /* chroma_sample_location_type_top_field */
get_ue_golomb(&s->gb); /* chroma_sample_location_type_bottom_field */
}
sps->timing_info_present_flag = get_bits1(&s->gb);
if(sps->timing_info_present_flag){
sps->num_units_in_tick = get_bits_long(&s->gb, 32);
sps->time_scale = get_bits_long(&s->gb, 32);
if(!sps->num_units_in_tick || !sps->time_scale){
av_log(h->s.avctx, AV_LOG_ERROR, "time_scale/num_units_in_tick invalid or unsupported (%d/%d)\n", sps->time_scale, sps->num_units_in_tick);
return -1;
}
sps->fixed_frame_rate_flag = get_bits1(&s->gb);
}
sps->nal_hrd_parameters_present_flag = get_bits1(&s->gb);
if(sps->nal_hrd_parameters_present_flag)
if(decode_hrd_parameters(h, sps) < 0)
return -1;
sps->vcl_hrd_parameters_present_flag = get_bits1(&s->gb);
if(sps->vcl_hrd_parameters_present_flag)
if(decode_hrd_parameters(h, sps) < 0)
return -1;
if(sps->nal_hrd_parameters_present_flag || sps->vcl_hrd_parameters_present_flag)
get_bits1(&s->gb); /* low_delay_hrd_flag */
sps->pic_struct_present_flag = get_bits1(&s->gb);
sps->bitstream_restriction_flag = get_bits1(&s->gb);
if(sps->bitstream_restriction_flag){
get_bits1(&s->gb); /* motion_vectors_over_pic_boundaries_flag */
get_ue_golomb(&s->gb); /* max_bytes_per_pic_denom */
get_ue_golomb(&s->gb); /* max_bits_per_mb_denom */
get_ue_golomb(&s->gb); /* log2_max_mv_length_horizontal */
get_ue_golomb(&s->gb); /* log2_max_mv_length_vertical */
sps->num_reorder_frames= get_ue_golomb(&s->gb);
get_ue_golomb(&s->gb); /*max_dec_frame_buffering*/
if (get_bits_left(&s->gb) < 0) {
av_log(h->s.avctx, AV_LOG_ERROR, "Overread VUI by %d bits\n", -get_bits_left(&s->gb));
sps->num_reorder_frames=0;
sps->bitstream_restriction_flag= 0;
}
if(sps->num_reorder_frames > 16U /*max_dec_frame_buffering || max_dec_frame_buffering > 16*/){
av_log(h->s.avctx, AV_LOG_ERROR, "illegal num_reorder_frames %d\n", sps->num_reorder_frames);
return -1;
}
}
return 0;
}
| true | FFmpeg | 3aa661ec561d7a20812b84b353b0d7855ac346c8 | static inline int decode_vui_parameters(H264Context *h, SPS *sps){
MpegEncContext * const s = &h->s;
int aspect_ratio_info_present_flag;
unsigned int aspect_ratio_idc;
aspect_ratio_info_present_flag= get_bits1(&s->gb);
if( aspect_ratio_info_present_flag ) {
aspect_ratio_idc= get_bits(&s->gb, 8);
if( aspect_ratio_idc == EXTENDED_SAR ) {
sps->sar.num= get_bits(&s->gb, 16);
sps->sar.den= get_bits(&s->gb, 16);
}else if(aspect_ratio_idc < FF_ARRAY_ELEMS(pixel_aspect)){
sps->sar= pixel_aspect[aspect_ratio_idc];
}else{
av_log(h->s.avctx, AV_LOG_ERROR, "illegal aspect ratio\n");
return -1;
}
}else{
sps->sar.num=
sps->sar.den= 0;
}
if(get_bits1(&s->gb)){
get_bits1(&s->gb);
}
sps->video_signal_type_present_flag = get_bits1(&s->gb);
if(sps->video_signal_type_present_flag){
get_bits(&s->gb, 3);
sps->full_range = get_bits1(&s->gb);
sps->colour_description_present_flag = get_bits1(&s->gb);
if(sps->colour_description_present_flag){
sps->color_primaries = get_bits(&s->gb, 8);
sps->color_trc = get_bits(&s->gb, 8);
sps->colorspace = get_bits(&s->gb, 8);
if (sps->color_primaries >= AVCOL_PRI_NB)
sps->color_primaries = AVCOL_PRI_UNSPECIFIED;
if (sps->color_trc >= AVCOL_TRC_NB)
sps->color_trc = AVCOL_TRC_UNSPECIFIED;
if (sps->colorspace >= AVCOL_SPC_NB)
sps->colorspace = AVCOL_SPC_UNSPECIFIED;
}
}
if(get_bits1(&s->gb)){
s->avctx->chroma_sample_location = get_ue_golomb(&s->gb)+1;
get_ue_golomb(&s->gb);
}
sps->timing_info_present_flag = get_bits1(&s->gb);
if(sps->timing_info_present_flag){
sps->num_units_in_tick = get_bits_long(&s->gb, 32);
sps->time_scale = get_bits_long(&s->gb, 32);
if(!sps->num_units_in_tick || !sps->time_scale){
av_log(h->s.avctx, AV_LOG_ERROR, "time_scale/num_units_in_tick invalid or unsupported (%d/%d)\n", sps->time_scale, sps->num_units_in_tick);
return -1;
}
sps->fixed_frame_rate_flag = get_bits1(&s->gb);
}
sps->nal_hrd_parameters_present_flag = get_bits1(&s->gb);
if(sps->nal_hrd_parameters_present_flag)
if(decode_hrd_parameters(h, sps) < 0)
return -1;
sps->vcl_hrd_parameters_present_flag = get_bits1(&s->gb);
if(sps->vcl_hrd_parameters_present_flag)
if(decode_hrd_parameters(h, sps) < 0)
return -1;
if(sps->nal_hrd_parameters_present_flag || sps->vcl_hrd_parameters_present_flag)
get_bits1(&s->gb);
sps->pic_struct_present_flag = get_bits1(&s->gb);
sps->bitstream_restriction_flag = get_bits1(&s->gb);
if(sps->bitstream_restriction_flag){
get_bits1(&s->gb);
get_ue_golomb(&s->gb);
get_ue_golomb(&s->gb);
get_ue_golomb(&s->gb);
get_ue_golomb(&s->gb);
sps->num_reorder_frames= get_ue_golomb(&s->gb);
get_ue_golomb(&s->gb);
if (get_bits_left(&s->gb) < 0) {
av_log(h->s.avctx, AV_LOG_ERROR, "Overread VUI by %d bits\n", -get_bits_left(&s->gb));
sps->num_reorder_frames=0;
sps->bitstream_restriction_flag= 0;
}
if(sps->num_reorder_frames > 16U ){
av_log(h->s.avctx, AV_LOG_ERROR, "illegal num_reorder_frames %d\n", sps->num_reorder_frames);
return -1;
}
}
return 0;
}
| {
"code": [
" av_log(h->s.avctx, AV_LOG_ERROR, \"Overread VUI by %d bits\\n\", -get_bits_left(&s->gb));"
],
"line_no": [
173
]
} | static inline int FUNC_0(H264Context *VAR_0, SPS *VAR_1){
MpegEncContext * const s = &VAR_0->s;
int VAR_2;
unsigned int VAR_3;
VAR_2= get_bits1(&s->gb);
if( VAR_2 ) {
VAR_3= get_bits(&s->gb, 8);
if( VAR_3 == EXTENDED_SAR ) {
VAR_1->sar.num= get_bits(&s->gb, 16);
VAR_1->sar.den= get_bits(&s->gb, 16);
}else if(VAR_3 < FF_ARRAY_ELEMS(pixel_aspect)){
VAR_1->sar= pixel_aspect[VAR_3];
}else{
av_log(VAR_0->s.avctx, AV_LOG_ERROR, "illegal aspect ratio\n");
return -1;
}
}else{
VAR_1->sar.num=
VAR_1->sar.den= 0;
}
if(get_bits1(&s->gb)){
get_bits1(&s->gb);
}
VAR_1->video_signal_type_present_flag = get_bits1(&s->gb);
if(VAR_1->video_signal_type_present_flag){
get_bits(&s->gb, 3);
VAR_1->full_range = get_bits1(&s->gb);
VAR_1->colour_description_present_flag = get_bits1(&s->gb);
if(VAR_1->colour_description_present_flag){
VAR_1->color_primaries = get_bits(&s->gb, 8);
VAR_1->color_trc = get_bits(&s->gb, 8);
VAR_1->colorspace = get_bits(&s->gb, 8);
if (VAR_1->color_primaries >= AVCOL_PRI_NB)
VAR_1->color_primaries = AVCOL_PRI_UNSPECIFIED;
if (VAR_1->color_trc >= AVCOL_TRC_NB)
VAR_1->color_trc = AVCOL_TRC_UNSPECIFIED;
if (VAR_1->colorspace >= AVCOL_SPC_NB)
VAR_1->colorspace = AVCOL_SPC_UNSPECIFIED;
}
}
if(get_bits1(&s->gb)){
s->avctx->chroma_sample_location = get_ue_golomb(&s->gb)+1;
get_ue_golomb(&s->gb);
}
VAR_1->timing_info_present_flag = get_bits1(&s->gb);
if(VAR_1->timing_info_present_flag){
VAR_1->num_units_in_tick = get_bits_long(&s->gb, 32);
VAR_1->time_scale = get_bits_long(&s->gb, 32);
if(!VAR_1->num_units_in_tick || !VAR_1->time_scale){
av_log(VAR_0->s.avctx, AV_LOG_ERROR, "time_scale/num_units_in_tick invalid or unsupported (%d/%d)\n", VAR_1->time_scale, VAR_1->num_units_in_tick);
return -1;
}
VAR_1->fixed_frame_rate_flag = get_bits1(&s->gb);
}
VAR_1->nal_hrd_parameters_present_flag = get_bits1(&s->gb);
if(VAR_1->nal_hrd_parameters_present_flag)
if(decode_hrd_parameters(VAR_0, VAR_1) < 0)
return -1;
VAR_1->vcl_hrd_parameters_present_flag = get_bits1(&s->gb);
if(VAR_1->vcl_hrd_parameters_present_flag)
if(decode_hrd_parameters(VAR_0, VAR_1) < 0)
return -1;
if(VAR_1->nal_hrd_parameters_present_flag || VAR_1->vcl_hrd_parameters_present_flag)
get_bits1(&s->gb);
VAR_1->pic_struct_present_flag = get_bits1(&s->gb);
VAR_1->bitstream_restriction_flag = get_bits1(&s->gb);
if(VAR_1->bitstream_restriction_flag){
get_bits1(&s->gb);
get_ue_golomb(&s->gb);
get_ue_golomb(&s->gb);
get_ue_golomb(&s->gb);
get_ue_golomb(&s->gb);
VAR_1->num_reorder_frames= get_ue_golomb(&s->gb);
get_ue_golomb(&s->gb);
if (get_bits_left(&s->gb) < 0) {
av_log(VAR_0->s.avctx, AV_LOG_ERROR, "Overread VUI by %d bits\n", -get_bits_left(&s->gb));
VAR_1->num_reorder_frames=0;
VAR_1->bitstream_restriction_flag= 0;
}
if(VAR_1->num_reorder_frames > 16U ){
av_log(VAR_0->s.avctx, AV_LOG_ERROR, "illegal num_reorder_frames %d\n", VAR_1->num_reorder_frames);
return -1;
}
}
return 0;
}
| [
"static inline int FUNC_0(H264Context *VAR_0, SPS *VAR_1){",
"MpegEncContext * const s = &VAR_0->s;",
"int VAR_2;",
"unsigned int VAR_3;",
"VAR_2= get_bits1(&s->gb);",
"if( VAR_2 ) {",
"VAR_3= get_bits(&s->gb, 8);",
"if( VAR_3 == EXTENDED_SAR ) {",
"VAR_1->sar.num= get_bits(&s->gb, 16);",
"VAR_1->sar.den= get_bits(&s->gb, 16);",
"}else if(VAR_3 < FF_ARRAY_ELEMS(pixel_aspect)){",
"VAR_1->sar= pixel_aspect[VAR_3];",
"}else{",
"av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"illegal aspect ratio\\n\");",
"return -1;",
"}",
"}else{",
"VAR_1->sar.num=\nVAR_1->sar.den= 0;",
"}",
"if(get_bits1(&s->gb)){",
"get_bits1(&s->gb);",
"}",
"VAR_1->video_signal_type_present_flag = get_bits1(&s->gb);",
"if(VAR_1->video_signal_type_present_flag){",
"get_bits(&s->gb, 3);",
"VAR_1->full_range = get_bits1(&s->gb);",
"VAR_1->colour_description_present_flag = get_bits1(&s->gb);",
"if(VAR_1->colour_description_present_flag){",
"VAR_1->color_primaries = get_bits(&s->gb, 8);",
"VAR_1->color_trc = get_bits(&s->gb, 8);",
"VAR_1->colorspace = get_bits(&s->gb, 8);",
"if (VAR_1->color_primaries >= AVCOL_PRI_NB)\nVAR_1->color_primaries = AVCOL_PRI_UNSPECIFIED;",
"if (VAR_1->color_trc >= AVCOL_TRC_NB)\nVAR_1->color_trc = AVCOL_TRC_UNSPECIFIED;",
"if (VAR_1->colorspace >= AVCOL_SPC_NB)\nVAR_1->colorspace = AVCOL_SPC_UNSPECIFIED;",
"}",
"}",
"if(get_bits1(&s->gb)){",
"s->avctx->chroma_sample_location = get_ue_golomb(&s->gb)+1;",
"get_ue_golomb(&s->gb);",
"}",
"VAR_1->timing_info_present_flag = get_bits1(&s->gb);",
"if(VAR_1->timing_info_present_flag){",
"VAR_1->num_units_in_tick = get_bits_long(&s->gb, 32);",
"VAR_1->time_scale = get_bits_long(&s->gb, 32);",
"if(!VAR_1->num_units_in_tick || !VAR_1->time_scale){",
"av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"time_scale/num_units_in_tick invalid or unsupported (%d/%d)\\n\", VAR_1->time_scale, VAR_1->num_units_in_tick);",
"return -1;",
"}",
"VAR_1->fixed_frame_rate_flag = get_bits1(&s->gb);",
"}",
"VAR_1->nal_hrd_parameters_present_flag = get_bits1(&s->gb);",
"if(VAR_1->nal_hrd_parameters_present_flag)\nif(decode_hrd_parameters(VAR_0, VAR_1) < 0)\nreturn -1;",
"VAR_1->vcl_hrd_parameters_present_flag = get_bits1(&s->gb);",
"if(VAR_1->vcl_hrd_parameters_present_flag)\nif(decode_hrd_parameters(VAR_0, VAR_1) < 0)\nreturn -1;",
"if(VAR_1->nal_hrd_parameters_present_flag || VAR_1->vcl_hrd_parameters_present_flag)\nget_bits1(&s->gb);",
"VAR_1->pic_struct_present_flag = get_bits1(&s->gb);",
"VAR_1->bitstream_restriction_flag = get_bits1(&s->gb);",
"if(VAR_1->bitstream_restriction_flag){",
"get_bits1(&s->gb);",
"get_ue_golomb(&s->gb);",
"get_ue_golomb(&s->gb);",
"get_ue_golomb(&s->gb);",
"get_ue_golomb(&s->gb);",
"VAR_1->num_reorder_frames= get_ue_golomb(&s->gb);",
"get_ue_golomb(&s->gb);",
"if (get_bits_left(&s->gb) < 0) {",
"av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"Overread VUI by %d bits\\n\", -get_bits_left(&s->gb));",
"VAR_1->num_reorder_frames=0;",
"VAR_1->bitstream_restriction_flag= 0;",
"}",
"if(VAR_1->num_reorder_frames > 16U ){",
"av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"illegal num_reorder_frames %d\\n\", VAR_1->num_reorder_frames);",
"return -1;",
"}",
"}",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1
],
[
3
],
[
5
],
[
7
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39,
41
],
[
43
],
[
49
],
[
51
],
[
53
],
[
57
],
[
59
],
[
61
],
[
63
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77,
79
],
[
81,
83
],
[
85,
87
],
[
89
],
[
91
],
[
95
],
[
97
],
[
99
],
[
101
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
127
],
[
129,
131,
133
],
[
135
],
[
137,
139,
141
],
[
143,
145
],
[
147
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
195
],
[
197
]
] |
1,532 | void migration_set_incoming_channel(MigrationState *s,
QIOChannel *ioc)
{
QEMUFile *f = qemu_fopen_channel_input(ioc);
process_incoming_migration(f);
}
| true | qemu | e122636562218b3d442cd2cd18fbc188dd9ce709 | void migration_set_incoming_channel(MigrationState *s,
QIOChannel *ioc)
{
QEMUFile *f = qemu_fopen_channel_input(ioc);
process_incoming_migration(f);
}
| {
"code": [
" QEMUFile *f = qemu_fopen_channel_input(ioc);",
" process_incoming_migration(f);",
" QIOChannel *ioc)"
],
"line_no": [
7,
11,
3
]
} | void FUNC_0(MigrationState *VAR_0,
QIOChannel *VAR_1)
{
QEMUFile *f = qemu_fopen_channel_input(VAR_1);
process_incoming_migration(f);
}
| [
"void FUNC_0(MigrationState *VAR_0,\nQIOChannel *VAR_1)\n{",
"QEMUFile *f = qemu_fopen_channel_input(VAR_1);",
"process_incoming_migration(f);",
"}"
] | [
1,
1,
1,
0
] | [
[
1,
3,
5
],
[
7
],
[
11
],
[
13
]
] |
1,534 | static int buffered_rate_limit(void *opaque)
{
MigrationState *s = opaque;
int ret;
ret = qemu_file_get_error(s->file);
if (ret) {
return ret;
}
if (s->bytes_xfer > s->xfer_limit) {
return 1;
}
return 0;
}
| true | qemu | 1e973051b96bac5eef46393eec15b68796e7c7d3 | static int buffered_rate_limit(void *opaque)
{
MigrationState *s = opaque;
int ret;
ret = qemu_file_get_error(s->file);
if (ret) {
return ret;
}
if (s->bytes_xfer > s->xfer_limit) {
return 1;
}
return 0;
}
| {
"code": [
" if (s->bytes_xfer > s->xfer_limit) {"
],
"line_no": [
21
]
} | static int FUNC_0(void *VAR_0)
{
MigrationState *s = VAR_0;
int VAR_1;
VAR_1 = qemu_file_get_error(s->file);
if (VAR_1) {
return VAR_1;
}
if (s->bytes_xfer > s->xfer_limit) {
return 1;
}
return 0;
}
| [
"static int FUNC_0(void *VAR_0)\n{",
"MigrationState *s = VAR_0;",
"int VAR_1;",
"VAR_1 = qemu_file_get_error(s->file);",
"if (VAR_1) {",
"return VAR_1;",
"}",
"if (s->bytes_xfer > s->xfer_limit) {",
"return 1;",
"}",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
]
] |
1,535 | static const unsigned char *seq_decode_op2(SeqVideoContext *seq, const unsigned char *src, unsigned char *dst)
{
int i;
for (i = 0; i < 8; i++) {
memcpy(dst, src, 8);
src += 8;
dst += seq->frame.linesize[0];
}
return src;
}
| true | FFmpeg | 5d7e3d71673d64a16b58430a0027afadb6b3a54e | static const unsigned char *seq_decode_op2(SeqVideoContext *seq, const unsigned char *src, unsigned char *dst)
{
int i;
for (i = 0; i < 8; i++) {
memcpy(dst, src, 8);
src += 8;
dst += seq->frame.linesize[0];
}
return src;
}
| {
"code": [
"static const unsigned char *seq_decode_op2(SeqVideoContext *seq, const unsigned char *src, unsigned char *dst)"
],
"line_no": [
1
]
} | static const unsigned char *FUNC_0(SeqVideoContext *VAR_0, const unsigned char *VAR_1, unsigned char *VAR_2)
{
int VAR_3;
for (VAR_3 = 0; VAR_3 < 8; VAR_3++) {
memcpy(VAR_2, VAR_1, 8);
VAR_1 += 8;
VAR_2 += VAR_0->frame.linesize[0];
}
return VAR_1;
}
| [
"static const unsigned char *FUNC_0(SeqVideoContext *VAR_0, const unsigned char *VAR_1, unsigned char *VAR_2)\n{",
"int VAR_3;",
"for (VAR_3 = 0; VAR_3 < 8; VAR_3++) {",
"memcpy(VAR_2, VAR_1, 8);",
"VAR_1 += 8;",
"VAR_2 += VAR_0->frame.linesize[0];",
"}",
"return VAR_1;",
"}"
] | [
1,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
]
] |
1,536 | int opt_default(void *optctx, const char *opt, const char *arg)
{
const AVOption *o;
int consumed = 0;
char opt_stripped[128];
const char *p;
const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class();
const av_unused AVClass *rc_class;
const AVClass *sc, *swr_class;
if (!strcmp(opt, "debug") || !strcmp(opt, "fdebug"))
av_log_set_level(AV_LOG_DEBUG);
if (!(p = strchr(opt, ':')))
p = opt + strlen(opt);
av_strlcpy(opt_stripped, opt, FFMIN(sizeof(opt_stripped), p - opt + 1));
if ((o = av_opt_find(&cc, opt_stripped, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) ||
((opt[0] == 'v' || opt[0] == 'a' || opt[0] == 's') &&
(o = av_opt_find(&cc, opt + 1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ)))) {
av_dict_set(&codec_opts, opt, arg, FLAGS);
consumed = 1;
}
if ((o = av_opt_find(&fc, opt, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {
av_dict_set(&format_opts, opt, arg, FLAGS);
if(consumed)
av_log(NULL, AV_LOG_VERBOSE, "Routing %s to codec and muxer layer\n", opt);
consumed = 1;
}
#if CONFIG_SWSCALE
sc = sws_get_class();
if (!consumed && av_opt_find(&sc, opt, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) {
// XXX we only support sws_flags, not arbitrary sws options
int ret = av_opt_set(sws_opts, opt, arg, 0);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt);
return ret;
}
consumed = 1;
}
#endif
#if CONFIG_SWRESAMPLE
swr_class = swr_get_class();
if (!consumed && av_opt_find(&swr_class, opt, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) {
int ret = av_opt_set(swr_opts, opt, arg, 0);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt);
return ret;
}
consumed = 1;
}
#endif
#if CONFIG_AVRESAMPLE
rc_class = avresample_get_class();
if (av_opt_find(&rc_class, opt, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) {
av_dict_set(&resample_opts, opt, arg, FLAGS);
consumed = 1;
}
#endif
if (consumed)
return 0;
return AVERROR_OPTION_NOT_FOUND;
}
| true | FFmpeg | f3abdf4392a146462dc679846c061b8bf2b5c7a0 | int opt_default(void *optctx, const char *opt, const char *arg)
{
const AVOption *o;
int consumed = 0;
char opt_stripped[128];
const char *p;
const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class();
const av_unused AVClass *rc_class;
const AVClass *sc, *swr_class;
if (!strcmp(opt, "debug") || !strcmp(opt, "fdebug"))
av_log_set_level(AV_LOG_DEBUG);
if (!(p = strchr(opt, ':')))
p = opt + strlen(opt);
av_strlcpy(opt_stripped, opt, FFMIN(sizeof(opt_stripped), p - opt + 1));
if ((o = av_opt_find(&cc, opt_stripped, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) ||
((opt[0] == 'v' || opt[0] == 'a' || opt[0] == 's') &&
(o = av_opt_find(&cc, opt + 1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ)))) {
av_dict_set(&codec_opts, opt, arg, FLAGS);
consumed = 1;
}
if ((o = av_opt_find(&fc, opt, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {
av_dict_set(&format_opts, opt, arg, FLAGS);
if(consumed)
av_log(NULL, AV_LOG_VERBOSE, "Routing %s to codec and muxer layer\n", opt);
consumed = 1;
}
#if CONFIG_SWSCALE
sc = sws_get_class();
if (!consumed && av_opt_find(&sc, opt, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) {
int ret = av_opt_set(sws_opts, opt, arg, 0);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt);
return ret;
}
consumed = 1;
}
#endif
#if CONFIG_SWRESAMPLE
swr_class = swr_get_class();
if (!consumed && av_opt_find(&swr_class, opt, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) {
int ret = av_opt_set(swr_opts, opt, arg, 0);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt);
return ret;
}
consumed = 1;
}
#endif
#if CONFIG_AVRESAMPLE
rc_class = avresample_get_class();
if (av_opt_find(&rc_class, opt, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) {
av_dict_set(&resample_opts, opt, arg, FLAGS);
consumed = 1;
}
#endif
if (consumed)
return 0;
return AVERROR_OPTION_NOT_FOUND;
}
| {
"code": [
" if (av_opt_find(&rc_class, opt, NULL, 0,",
" AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) {"
],
"line_no": [
117,
119
]
} | int FUNC_0(void *VAR_0, const char *VAR_1, const char *VAR_2)
{
const AVOption *VAR_3;
int VAR_4 = 0;
char VAR_5[128];
const char *VAR_6;
const VAR_8 *VAR_7 = avcodec_get_class(), *fc = avformat_get_class();
const av_unused VAR_8 *rc_class;
const VAR_8 *VAR_9, *swr_class;
if (!strcmp(VAR_1, "debug") || !strcmp(VAR_1, "fdebug"))
av_log_set_level(AV_LOG_DEBUG);
if (!(VAR_6 = strchr(VAR_1, ':')))
VAR_6 = VAR_1 + strlen(VAR_1);
av_strlcpy(VAR_5, VAR_1, FFMIN(sizeof(VAR_5), VAR_6 - VAR_1 + 1));
if ((VAR_3 = av_opt_find(&VAR_7, VAR_5, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) ||
((VAR_1[0] == 'v' || VAR_1[0] == 'a' || VAR_1[0] == 's') &&
(VAR_3 = av_opt_find(&VAR_7, VAR_1 + 1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ)))) {
av_dict_set(&codec_opts, VAR_1, VAR_2, FLAGS);
VAR_4 = 1;
}
if ((VAR_3 = av_opt_find(&fc, VAR_1, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {
av_dict_set(&format_opts, VAR_1, VAR_2, FLAGS);
if(VAR_4)
av_log(NULL, AV_LOG_VERBOSE, "Routing %s to codec and muxer layer\n", VAR_1);
VAR_4 = 1;
}
#if CONFIG_SWSCALE
VAR_9 = sws_get_class();
if (!VAR_4 && av_opt_find(&VAR_9, VAR_1, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) {
int ret = av_opt_set(sws_opts, VAR_1, VAR_2, 0);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", VAR_1);
return ret;
}
VAR_4 = 1;
}
#endif
#if CONFIG_SWRESAMPLE
swr_class = swr_get_class();
if (!VAR_4 && av_opt_find(&swr_class, VAR_1, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) {
int ret = av_opt_set(swr_opts, VAR_1, VAR_2, 0);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", VAR_1);
return ret;
}
VAR_4 = 1;
}
#endif
#if CONFIG_AVRESAMPLE
rc_class = avresample_get_class();
if (av_opt_find(&rc_class, VAR_1, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) {
av_dict_set(&resample_opts, VAR_1, VAR_2, FLAGS);
VAR_4 = 1;
}
#endif
if (VAR_4)
return 0;
return AVERROR_OPTION_NOT_FOUND;
}
| [
"int FUNC_0(void *VAR_0, const char *VAR_1, const char *VAR_2)\n{",
"const AVOption *VAR_3;",
"int VAR_4 = 0;",
"char VAR_5[128];",
"const char *VAR_6;",
"const VAR_8 *VAR_7 = avcodec_get_class(), *fc = avformat_get_class();",
"const av_unused VAR_8 *rc_class;",
"const VAR_8 *VAR_9, *swr_class;",
"if (!strcmp(VAR_1, \"debug\") || !strcmp(VAR_1, \"fdebug\"))\nav_log_set_level(AV_LOG_DEBUG);",
"if (!(VAR_6 = strchr(VAR_1, ':')))\nVAR_6 = VAR_1 + strlen(VAR_1);",
"av_strlcpy(VAR_5, VAR_1, FFMIN(sizeof(VAR_5), VAR_6 - VAR_1 + 1));",
"if ((VAR_3 = av_opt_find(&VAR_7, VAR_5, NULL, 0,\nAV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) ||\n((VAR_1[0] == 'v' || VAR_1[0] == 'a' || VAR_1[0] == 's') &&\n(VAR_3 = av_opt_find(&VAR_7, VAR_1 + 1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ)))) {",
"av_dict_set(&codec_opts, VAR_1, VAR_2, FLAGS);",
"VAR_4 = 1;",
"}",
"if ((VAR_3 = av_opt_find(&fc, VAR_1, NULL, 0,\nAV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {",
"av_dict_set(&format_opts, VAR_1, VAR_2, FLAGS);",
"if(VAR_4)\nav_log(NULL, AV_LOG_VERBOSE, \"Routing %s to codec and muxer layer\\n\", VAR_1);",
"VAR_4 = 1;",
"}",
"#if CONFIG_SWSCALE\nVAR_9 = sws_get_class();",
"if (!VAR_4 && av_opt_find(&VAR_9, VAR_1, NULL, 0,\nAV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) {",
"int ret = av_opt_set(sws_opts, VAR_1, VAR_2, 0);",
"if (ret < 0) {",
"av_log(NULL, AV_LOG_ERROR, \"Error setting option %s.\\n\", VAR_1);",
"return ret;",
"}",
"VAR_4 = 1;",
"}",
"#endif\n#if CONFIG_SWRESAMPLE\nswr_class = swr_get_class();",
"if (!VAR_4 && av_opt_find(&swr_class, VAR_1, NULL, 0,\nAV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) {",
"int ret = av_opt_set(swr_opts, VAR_1, VAR_2, 0);",
"if (ret < 0) {",
"av_log(NULL, AV_LOG_ERROR, \"Error setting option %s.\\n\", VAR_1);",
"return ret;",
"}",
"VAR_4 = 1;",
"}",
"#endif\n#if CONFIG_AVRESAMPLE\nrc_class = avresample_get_class();",
"if (av_opt_find(&rc_class, VAR_1, NULL, 0,\nAV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) {",
"av_dict_set(&resample_opts, VAR_1, VAR_2, FLAGS);",
"VAR_4 = 1;",
"}",
"#endif\nif (VAR_4)\nreturn 0;",
"return AVERROR_OPTION_NOT_FOUND;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21,
23
],
[
27,
29
],
[
31
],
[
35,
37,
39,
41
],
[
43
],
[
45
],
[
47
],
[
49,
51
],
[
53
],
[
55,
57
],
[
59
],
[
61
],
[
63,
65
],
[
67,
69
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87,
89,
91
],
[
93,
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111,
113,
115
],
[
117,
119
],
[
121
],
[
123
],
[
125
],
[
127,
131,
133
],
[
135
],
[
137
]
] |
1,537 | static void event_test_emit(test_QAPIEvent event, QDict *d, Error **errp)
{
QObject *obj;
QDict *t;
int64_t s, ms;
/* Verify that we have timestamp, then remove it to compare other fields */
obj = qdict_get(d, "timestamp");
g_assert(obj);
t = qobject_to_qdict(obj);
g_assert(t);
obj = qdict_get(t, "seconds");
g_assert(obj && qobject_type(obj) == QTYPE_QINT);
s = qint_get_int(qobject_to_qint(obj));
obj = qdict_get(t, "microseconds");
g_assert(obj && qobject_type(obj) == QTYPE_QINT);
ms = qint_get_int(qobject_to_qint(obj));
if (s == -1) {
g_assert(ms == -1);
} else {
g_assert(ms >= 0 && ms <= 999999);
}
g_assert(qdict_size(t) == 2);
qdict_del(d, "timestamp");
g_assert(qdict_cmp_simple(d, test_event_data->expect));
}
| true | qemu | 4b32e11a59e34c5cf570c1fd102a78d9351e71f5 | static void event_test_emit(test_QAPIEvent event, QDict *d, Error **errp)
{
QObject *obj;
QDict *t;
int64_t s, ms;
obj = qdict_get(d, "timestamp");
g_assert(obj);
t = qobject_to_qdict(obj);
g_assert(t);
obj = qdict_get(t, "seconds");
g_assert(obj && qobject_type(obj) == QTYPE_QINT);
s = qint_get_int(qobject_to_qint(obj));
obj = qdict_get(t, "microseconds");
g_assert(obj && qobject_type(obj) == QTYPE_QINT);
ms = qint_get_int(qobject_to_qint(obj));
if (s == -1) {
g_assert(ms == -1);
} else {
g_assert(ms >= 0 && ms <= 999999);
}
g_assert(qdict_size(t) == 2);
qdict_del(d, "timestamp");
g_assert(qdict_cmp_simple(d, test_event_data->expect));
}
| {
"code": [
" QObject *obj;",
" obj = qdict_get(d, \"timestamp\");",
" g_assert(obj);",
" t = qobject_to_qdict(obj);",
" obj = qdict_get(t, \"seconds\");",
" g_assert(obj && qobject_type(obj) == QTYPE_QINT);",
" s = qint_get_int(qobject_to_qint(obj));",
" obj = qdict_get(t, \"microseconds\");",
" g_assert(obj && qobject_type(obj) == QTYPE_QINT);",
" ms = qint_get_int(qobject_to_qint(obj));"
],
"line_no": [
5,
15,
17,
19,
23,
25,
27,
29,
25,
33
]
} | static void FUNC_0(test_QAPIEvent VAR_0, QDict *VAR_1, Error **VAR_2)
{
QObject *obj;
QDict *t;
int64_t s, ms;
obj = qdict_get(VAR_1, "timestamp");
g_assert(obj);
t = qobject_to_qdict(obj);
g_assert(t);
obj = qdict_get(t, "seconds");
g_assert(obj && qobject_type(obj) == QTYPE_QINT);
s = qint_get_int(qobject_to_qint(obj));
obj = qdict_get(t, "microseconds");
g_assert(obj && qobject_type(obj) == QTYPE_QINT);
ms = qint_get_int(qobject_to_qint(obj));
if (s == -1) {
g_assert(ms == -1);
} else {
g_assert(ms >= 0 && ms <= 999999);
}
g_assert(qdict_size(t) == 2);
qdict_del(VAR_1, "timestamp");
g_assert(qdict_cmp_simple(VAR_1, test_event_data->expect));
}
| [
"static void FUNC_0(test_QAPIEvent VAR_0, QDict *VAR_1, Error **VAR_2)\n{",
"QObject *obj;",
"QDict *t;",
"int64_t s, ms;",
"obj = qdict_get(VAR_1, \"timestamp\");",
"g_assert(obj);",
"t = qobject_to_qdict(obj);",
"g_assert(t);",
"obj = qdict_get(t, \"seconds\");",
"g_assert(obj && qobject_type(obj) == QTYPE_QINT);",
"s = qint_get_int(qobject_to_qint(obj));",
"obj = qdict_get(t, \"microseconds\");",
"g_assert(obj && qobject_type(obj) == QTYPE_QINT);",
"ms = qint_get_int(qobject_to_qint(obj));",
"if (s == -1) {",
"g_assert(ms == -1);",
"} else {",
"g_assert(ms >= 0 && ms <= 999999);",
"}",
"g_assert(qdict_size(t) == 2);",
"qdict_del(VAR_1, \"timestamp\");",
"g_assert(qdict_cmp_simple(VAR_1, test_event_data->expect));",
"}"
] | [
0,
1,
0,
0,
1,
1,
1,
0,
1,
1,
1,
1,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
49
],
[
53
],
[
57
]
] |
1,538 | void ff_put_h264_qpel8_mc20_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_hz_8w_msa(src - 2, stride, dst, stride, 8);
}
| false | FFmpeg | 6796a1dd8c14843b77925cb83a3ef88706ae1dd0 | void ff_put_h264_qpel8_mc20_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_hz_8w_msa(src - 2, stride, dst, stride, 8);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,
ptrdiff_t VAR_2)
{
avc_luma_hz_8w_msa(VAR_1 - 2, VAR_2, VAR_0, VAR_2, 8);
}
| [
"void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{",
"avc_luma_hz_8w_msa(VAR_1 - 2, VAR_2, VAR_0, VAR_2, 8);",
"}"
] | [
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
]
] |
1,539 | static void ini_print_object_header(const char *name)
{
int i;
PrintElement *el = octx.prefix + octx.level -1;
if (el->nb_elems)
avio_printf(probe_out, "\n");
avio_printf(probe_out, "[");
for (i = 1; i < octx.level; i++) {
el = octx.prefix + i;
avio_printf(probe_out, "%s.", el->name);
if (el->index >= 0)
avio_printf(probe_out, "%"PRId64".", el->index);
}
avio_printf(probe_out, "%s", name);
if (el && el->type == ARRAY)
avio_printf(probe_out, ".%"PRId64"", el->nb_elems);
avio_printf(probe_out, "]\n");
}
| false | FFmpeg | aeb23fc4549a25ef32ff085d2a76227f90caf403 | static void ini_print_object_header(const char *name)
{
int i;
PrintElement *el = octx.prefix + octx.level -1;
if (el->nb_elems)
avio_printf(probe_out, "\n");
avio_printf(probe_out, "[");
for (i = 1; i < octx.level; i++) {
el = octx.prefix + i;
avio_printf(probe_out, "%s.", el->name);
if (el->index >= 0)
avio_printf(probe_out, "%"PRId64".", el->index);
}
avio_printf(probe_out, "%s", name);
if (el && el->type == ARRAY)
avio_printf(probe_out, ".%"PRId64"", el->nb_elems);
avio_printf(probe_out, "]\n");
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(const char *VAR_0)
{
int VAR_1;
PrintElement *el = octx.prefix + octx.level -1;
if (el->nb_elems)
avio_printf(probe_out, "\n");
avio_printf(probe_out, "[");
for (VAR_1 = 1; VAR_1 < octx.level; VAR_1++) {
el = octx.prefix + VAR_1;
avio_printf(probe_out, "%s.", el->VAR_0);
if (el->index >= 0)
avio_printf(probe_out, "%"PRId64".", el->index);
}
avio_printf(probe_out, "%s", VAR_0);
if (el && el->type == ARRAY)
avio_printf(probe_out, ".%"PRId64"", el->nb_elems);
avio_printf(probe_out, "]\n");
}
| [
"static void FUNC_0(const char *VAR_0)\n{",
"int VAR_1;",
"PrintElement *el = octx.prefix + octx.level -1;",
"if (el->nb_elems)\navio_printf(probe_out, \"\\n\");",
"avio_printf(probe_out, \"[\");",
"for (VAR_1 = 1; VAR_1 < octx.level; VAR_1++) {",
"el = octx.prefix + VAR_1;",
"avio_printf(probe_out, \"%s.\", el->VAR_0);",
"if (el->index >= 0)\navio_printf(probe_out, \"%\"PRId64\".\", el->index);",
"}",
"avio_printf(probe_out, \"%s\", VAR_0);",
"if (el && el->type == ARRAY)\navio_printf(probe_out, \".%\"PRId64\"\", el->nb_elems);",
"avio_printf(probe_out, \"]\\n\");",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
11,
13
],
[
17
],
[
21
],
[
23
],
[
25
],
[
27,
29
],
[
31
],
[
35
],
[
37,
39
],
[
41
],
[
43
]
] |
1,541 | int avformat_queue_attached_pictures(AVFormatContext *s)
{
int i;
for (i = 0; i < s->nb_streams; i++)
if (s->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC &&
s->streams[i]->discard < AVDISCARD_ALL) {
AVPacket copy = s->streams[i]->attached_pic;
if (copy.size <= 0)
return AVERROR(EINVAL);
copy.buf = av_buffer_ref(copy.buf);
if (!copy.buf)
return AVERROR(ENOMEM);
add_to_pktbuf(&s->raw_packet_buffer, ©,
&s->raw_packet_buffer_end);
}
return 0;
}
| false | FFmpeg | 0f87b42b44f8da7234e8e43b27d1dc5e4dce7582 | int avformat_queue_attached_pictures(AVFormatContext *s)
{
int i;
for (i = 0; i < s->nb_streams; i++)
if (s->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC &&
s->streams[i]->discard < AVDISCARD_ALL) {
AVPacket copy = s->streams[i]->attached_pic;
if (copy.size <= 0)
return AVERROR(EINVAL);
copy.buf = av_buffer_ref(copy.buf);
if (!copy.buf)
return AVERROR(ENOMEM);
add_to_pktbuf(&s->raw_packet_buffer, ©,
&s->raw_packet_buffer_end);
}
return 0;
}
| {
"code": [],
"line_no": []
} | int FUNC_0(AVFormatContext *VAR_0)
{
int VAR_1;
for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++)
if (VAR_0->streams[VAR_1]->disposition & AV_DISPOSITION_ATTACHED_PIC &&
VAR_0->streams[VAR_1]->discard < AVDISCARD_ALL) {
AVPacket copy = VAR_0->streams[VAR_1]->attached_pic;
if (copy.size <= 0)
return AVERROR(EINVAL);
copy.buf = av_buffer_ref(copy.buf);
if (!copy.buf)
return AVERROR(ENOMEM);
add_to_pktbuf(&VAR_0->raw_packet_buffer, ©,
&VAR_0->raw_packet_buffer_end);
}
return 0;
}
| [
"int FUNC_0(AVFormatContext *VAR_0)\n{",
"int VAR_1;",
"for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++)",
"if (VAR_0->streams[VAR_1]->disposition & AV_DISPOSITION_ATTACHED_PIC &&\nVAR_0->streams[VAR_1]->discard < AVDISCARD_ALL) {",
"AVPacket copy = VAR_0->streams[VAR_1]->attached_pic;",
"if (copy.size <= 0)\nreturn AVERROR(EINVAL);",
"copy.buf = av_buffer_ref(copy.buf);",
"if (!copy.buf)\nreturn AVERROR(ENOMEM);",
"add_to_pktbuf(&VAR_0->raw_packet_buffer, ©,\n&VAR_0->raw_packet_buffer_end);",
"}",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9,
11
],
[
13
],
[
15,
17
],
[
19
],
[
21,
23
],
[
27,
29
],
[
31
],
[
33
],
[
35
]
] |
1,542 | static inline void mix_dualmono_to_mono(AC3DecodeContext *ctx)
{
int i;
float (*output)[256] = ctx->audio_block.block_output;
for (i = 0; i < 256; i++)
output[1][i] += output[2][i];
memset(output[2], 0, sizeof(output[2]));
}
| false | FFmpeg | 486637af8ef29ec215e0e0b7ecd3b5470f0e04e5 | static inline void mix_dualmono_to_mono(AC3DecodeContext *ctx)
{
int i;
float (*output)[256] = ctx->audio_block.block_output;
for (i = 0; i < 256; i++)
output[1][i] += output[2][i];
memset(output[2], 0, sizeof(output[2]));
}
| {
"code": [],
"line_no": []
} | static inline void FUNC_0(AC3DecodeContext *VAR_0)
{
int VAR_1;
float (*VAR_2)[256] = VAR_0->audio_block.block_output;
for (VAR_1 = 0; VAR_1 < 256; VAR_1++)
VAR_2[1][VAR_1] += VAR_2[2][VAR_1];
memset(VAR_2[2], 0, sizeof(VAR_2[2]));
}
| [
"static inline void FUNC_0(AC3DecodeContext *VAR_0)\n{",
"int VAR_1;",
"float (*VAR_2)[256] = VAR_0->audio_block.block_output;",
"for (VAR_1 = 0; VAR_1 < 256; VAR_1++)",
"VAR_2[1][VAR_1] += VAR_2[2][VAR_1];",
"memset(VAR_2[2], 0, sizeof(VAR_2[2]));",
"}"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
11
],
[
13
],
[
15
],
[
17
]
] |
1,543 | static int decode_frame(AVCodecContext *avctx,
void *data, int *got_frame,
AVPacket *avpkt)
{
PNGDecContext *const s = avctx->priv_data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
AVFrame *p = data;
uint8_t *crow_buf_base = NULL;
uint32_t tag, length;
int ret;
/* check signature */
if (buf_size < 8 ||
memcmp(buf, ff_pngsig, 8) != 0 &&
memcmp(buf, ff_mngsig, 8) != 0)
return -1;
bytestream2_init(&s->gb, buf + 8, buf_size - 8);
s->y = s->state = 0;
/* init the zlib */
s->zstream.zalloc = ff_png_zalloc;
s->zstream.zfree = ff_png_zfree;
s->zstream.opaque = NULL;
ret = inflateInit(&s->zstream);
if (ret != Z_OK)
return -1;
for (;;) {
if (bytestream2_get_bytes_left(&s->gb) <= 0)
goto fail;
length = bytestream2_get_be32(&s->gb);
if (length > 0x7fffffff)
goto fail;
tag = bytestream2_get_le32(&s->gb);
av_dlog(avctx, "png: tag=%c%c%c%c length=%u\n",
(tag & 0xff),
((tag >> 8) & 0xff),
((tag >> 16) & 0xff),
((tag >> 24) & 0xff), length);
switch (tag) {
case MKTAG('I', 'H', 'D', 'R'):
if (length != 13)
goto fail;
s->width = bytestream2_get_be32(&s->gb);
s->height = bytestream2_get_be32(&s->gb);
if (av_image_check_size(s->width, s->height, 0, avctx)) {
s->width = s->height = 0;
goto fail;
}
s->bit_depth = bytestream2_get_byte(&s->gb);
s->color_type = bytestream2_get_byte(&s->gb);
s->compression_type = bytestream2_get_byte(&s->gb);
s->filter_type = bytestream2_get_byte(&s->gb);
s->interlace_type = bytestream2_get_byte(&s->gb);
bytestream2_skip(&s->gb, 4); /* crc */
s->state |= PNG_IHDR;
av_dlog(avctx, "width=%d height=%d depth=%d color_type=%d "
"compression_type=%d filter_type=%d interlace_type=%d\n",
s->width, s->height, s->bit_depth, s->color_type,
s->compression_type, s->filter_type, s->interlace_type);
break;
case MKTAG('I', 'D', 'A', 'T'):
if (!(s->state & PNG_IHDR))
goto fail;
if (!(s->state & PNG_IDAT)) {
/* init image info */
avctx->width = s->width;
avctx->height = s->height;
s->channels = ff_png_get_nb_channels(s->color_type);
s->bits_per_pixel = s->bit_depth * s->channels;
s->bpp = (s->bits_per_pixel + 7) >> 3;
s->row_size = (avctx->width * s->bits_per_pixel + 7) >> 3;
if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_RGB) {
avctx->pix_fmt = AV_PIX_FMT_RGB24;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
avctx->pix_fmt = AV_PIX_FMT_RGB32;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_GRAY) {
avctx->pix_fmt = AV_PIX_FMT_GRAY8;
} else if (s->bit_depth == 16 &&
s->color_type == PNG_COLOR_TYPE_GRAY) {
avctx->pix_fmt = AV_PIX_FMT_GRAY16BE;
} else if (s->bit_depth == 16 &&
s->color_type == PNG_COLOR_TYPE_RGB) {
avctx->pix_fmt = AV_PIX_FMT_RGB48BE;
} else if (s->bit_depth == 1 &&
s->color_type == PNG_COLOR_TYPE_GRAY) {
avctx->pix_fmt = AV_PIX_FMT_MONOBLACK;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_PALETTE) {
avctx->pix_fmt = AV_PIX_FMT_PAL8;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
avctx->pix_fmt = AV_PIX_FMT_YA8;
} else if (s->bit_depth == 16 &&
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
avctx->pix_fmt = AV_PIX_FMT_YA16BE;
} else {
goto fail;
}
if (ff_get_buffer(avctx, p, AV_GET_BUFFER_FLAG_REF) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
goto fail;
}
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->interlaced_frame = !!s->interlace_type;
/* compute the compressed row size */
if (!s->interlace_type) {
s->crow_size = s->row_size + 1;
} else {
s->pass = 0;
s->pass_row_size = ff_png_pass_row_size(s->pass,
s->bits_per_pixel,
s->width);
s->crow_size = s->pass_row_size + 1;
}
av_dlog(avctx, "row_size=%d crow_size =%d\n",
s->row_size, s->crow_size);
s->image_buf = p->data[0];
s->image_linesize = p->linesize[0];
/* copy the palette if needed */
if (s->color_type == PNG_COLOR_TYPE_PALETTE)
memcpy(p->data[1], s->palette, 256 * sizeof(uint32_t));
/* empty row is used if differencing to the first row */
s->last_row = av_mallocz(s->row_size);
if (!s->last_row)
goto fail;
if (s->interlace_type ||
s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
s->tmp_row = av_malloc(s->row_size);
if (!s->tmp_row)
goto fail;
}
/* compressed row */
crow_buf_base = av_malloc(s->row_size + 16);
if (!crow_buf_base)
goto fail;
/* we want crow_buf+1 to be 16-byte aligned */
s->crow_buf = crow_buf_base + 15;
s->zstream.avail_out = s->crow_size;
s->zstream.next_out = s->crow_buf;
}
s->state |= PNG_IDAT;
if (png_decode_idat(s, length) < 0)
goto fail;
bytestream2_skip(&s->gb, 4); /* crc */
break;
case MKTAG('P', 'L', 'T', 'E'):
{
int n, i, r, g, b;
if ((length % 3) != 0 || length > 256 * 3)
goto skip_tag;
/* read the palette */
n = length / 3;
for (i = 0; i < n; i++) {
r = bytestream2_get_byte(&s->gb);
g = bytestream2_get_byte(&s->gb);
b = bytestream2_get_byte(&s->gb);
s->palette[i] = (0xff << 24) | (r << 16) | (g << 8) | b;
}
for (; i < 256; i++)
s->palette[i] = (0xff << 24);
s->state |= PNG_PLTE;
bytestream2_skip(&s->gb, 4); /* crc */
}
break;
case MKTAG('t', 'R', 'N', 'S'):
{
int v, i;
/* read the transparency. XXX: Only palette mode supported */
if (s->color_type != PNG_COLOR_TYPE_PALETTE ||
length > 256 ||
!(s->state & PNG_PLTE))
goto skip_tag;
for (i = 0; i < length; i++) {
v = bytestream2_get_byte(&s->gb);
s->palette[i] = (s->palette[i] & 0x00ffffff) | (v << 24);
}
bytestream2_skip(&s->gb, 4); /* crc */
}
break;
case MKTAG('I', 'E', 'N', 'D'):
if (!(s->state & PNG_ALLIMAGE))
goto fail;
bytestream2_skip(&s->gb, 4); /* crc */
goto exit_loop;
default:
/* skip tag */
skip_tag:
bytestream2_skip(&s->gb, length + 4);
break;
}
}
exit_loop:
/* handle p-frames only if a predecessor frame is available */
if (s->prev->data[0]) {
if (!(avpkt->flags & AV_PKT_FLAG_KEY)) {
int i, j;
uint8_t *pd = p->data[0];
uint8_t *pd_last = s->prev->data[0];
for (j = 0; j < s->height; j++) {
for (i = 0; i < s->width * s->bpp; i++)
pd[i] += pd_last[i];
pd += s->image_linesize;
pd_last += s->image_linesize;
}
}
}
av_frame_unref(s->prev);
if ((ret = av_frame_ref(s->prev, p)) < 0)
goto fail;
*got_frame = 1;
ret = bytestream2_tell(&s->gb);
the_end:
inflateEnd(&s->zstream);
av_free(crow_buf_base);
s->crow_buf = NULL;
av_freep(&s->last_row);
av_freep(&s->tmp_row);
return ret;
fail:
ret = -1;
goto the_end;
}
| false | FFmpeg | 1e763454322f7fbc7799f6009bf2e11d7a3b9821 | static int decode_frame(AVCodecContext *avctx,
void *data, int *got_frame,
AVPacket *avpkt)
{
PNGDecContext *const s = avctx->priv_data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
AVFrame *p = data;
uint8_t *crow_buf_base = NULL;
uint32_t tag, length;
int ret;
if (buf_size < 8 ||
memcmp(buf, ff_pngsig, 8) != 0 &&
memcmp(buf, ff_mngsig, 8) != 0)
return -1;
bytestream2_init(&s->gb, buf + 8, buf_size - 8);
s->y = s->state = 0;
s->zstream.zalloc = ff_png_zalloc;
s->zstream.zfree = ff_png_zfree;
s->zstream.opaque = NULL;
ret = inflateInit(&s->zstream);
if (ret != Z_OK)
return -1;
for (;;) {
if (bytestream2_get_bytes_left(&s->gb) <= 0)
goto fail;
length = bytestream2_get_be32(&s->gb);
if (length > 0x7fffffff)
goto fail;
tag = bytestream2_get_le32(&s->gb);
av_dlog(avctx, "png: tag=%c%c%c%c length=%u\n",
(tag & 0xff),
((tag >> 8) & 0xff),
((tag >> 16) & 0xff),
((tag >> 24) & 0xff), length);
switch (tag) {
case MKTAG('I', 'H', 'D', 'R'):
if (length != 13)
goto fail;
s->width = bytestream2_get_be32(&s->gb);
s->height = bytestream2_get_be32(&s->gb);
if (av_image_check_size(s->width, s->height, 0, avctx)) {
s->width = s->height = 0;
goto fail;
}
s->bit_depth = bytestream2_get_byte(&s->gb);
s->color_type = bytestream2_get_byte(&s->gb);
s->compression_type = bytestream2_get_byte(&s->gb);
s->filter_type = bytestream2_get_byte(&s->gb);
s->interlace_type = bytestream2_get_byte(&s->gb);
bytestream2_skip(&s->gb, 4);
s->state |= PNG_IHDR;
av_dlog(avctx, "width=%d height=%d depth=%d color_type=%d "
"compression_type=%d filter_type=%d interlace_type=%d\n",
s->width, s->height, s->bit_depth, s->color_type,
s->compression_type, s->filter_type, s->interlace_type);
break;
case MKTAG('I', 'D', 'A', 'T'):
if (!(s->state & PNG_IHDR))
goto fail;
if (!(s->state & PNG_IDAT)) {
avctx->width = s->width;
avctx->height = s->height;
s->channels = ff_png_get_nb_channels(s->color_type);
s->bits_per_pixel = s->bit_depth * s->channels;
s->bpp = (s->bits_per_pixel + 7) >> 3;
s->row_size = (avctx->width * s->bits_per_pixel + 7) >> 3;
if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_RGB) {
avctx->pix_fmt = AV_PIX_FMT_RGB24;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
avctx->pix_fmt = AV_PIX_FMT_RGB32;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_GRAY) {
avctx->pix_fmt = AV_PIX_FMT_GRAY8;
} else if (s->bit_depth == 16 &&
s->color_type == PNG_COLOR_TYPE_GRAY) {
avctx->pix_fmt = AV_PIX_FMT_GRAY16BE;
} else if (s->bit_depth == 16 &&
s->color_type == PNG_COLOR_TYPE_RGB) {
avctx->pix_fmt = AV_PIX_FMT_RGB48BE;
} else if (s->bit_depth == 1 &&
s->color_type == PNG_COLOR_TYPE_GRAY) {
avctx->pix_fmt = AV_PIX_FMT_MONOBLACK;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_PALETTE) {
avctx->pix_fmt = AV_PIX_FMT_PAL8;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
avctx->pix_fmt = AV_PIX_FMT_YA8;
} else if (s->bit_depth == 16 &&
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
avctx->pix_fmt = AV_PIX_FMT_YA16BE;
} else {
goto fail;
}
if (ff_get_buffer(avctx, p, AV_GET_BUFFER_FLAG_REF) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
goto fail;
}
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->interlaced_frame = !!s->interlace_type;
if (!s->interlace_type) {
s->crow_size = s->row_size + 1;
} else {
s->pass = 0;
s->pass_row_size = ff_png_pass_row_size(s->pass,
s->bits_per_pixel,
s->width);
s->crow_size = s->pass_row_size + 1;
}
av_dlog(avctx, "row_size=%d crow_size =%d\n",
s->row_size, s->crow_size);
s->image_buf = p->data[0];
s->image_linesize = p->linesize[0];
if (s->color_type == PNG_COLOR_TYPE_PALETTE)
memcpy(p->data[1], s->palette, 256 * sizeof(uint32_t));
s->last_row = av_mallocz(s->row_size);
if (!s->last_row)
goto fail;
if (s->interlace_type ||
s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
s->tmp_row = av_malloc(s->row_size);
if (!s->tmp_row)
goto fail;
}
crow_buf_base = av_malloc(s->row_size + 16);
if (!crow_buf_base)
goto fail;
s->crow_buf = crow_buf_base + 15;
s->zstream.avail_out = s->crow_size;
s->zstream.next_out = s->crow_buf;
}
s->state |= PNG_IDAT;
if (png_decode_idat(s, length) < 0)
goto fail;
bytestream2_skip(&s->gb, 4);
break;
case MKTAG('P', 'L', 'T', 'E'):
{
int n, i, r, g, b;
if ((length % 3) != 0 || length > 256 * 3)
goto skip_tag;
n = length / 3;
for (i = 0; i < n; i++) {
r = bytestream2_get_byte(&s->gb);
g = bytestream2_get_byte(&s->gb);
b = bytestream2_get_byte(&s->gb);
s->palette[i] = (0xff << 24) | (r << 16) | (g << 8) | b;
}
for (; i < 256; i++)
s->palette[i] = (0xff << 24);
s->state |= PNG_PLTE;
bytestream2_skip(&s->gb, 4);
}
break;
case MKTAG('t', 'R', 'N', 'S'):
{
int v, i;
if (s->color_type != PNG_COLOR_TYPE_PALETTE ||
length > 256 ||
!(s->state & PNG_PLTE))
goto skip_tag;
for (i = 0; i < length; i++) {
v = bytestream2_get_byte(&s->gb);
s->palette[i] = (s->palette[i] & 0x00ffffff) | (v << 24);
}
bytestream2_skip(&s->gb, 4);
}
break;
case MKTAG('I', 'E', 'N', 'D'):
if (!(s->state & PNG_ALLIMAGE))
goto fail;
bytestream2_skip(&s->gb, 4);
goto exit_loop;
default:
skip_tag:
bytestream2_skip(&s->gb, length + 4);
break;
}
}
exit_loop:
if (s->prev->data[0]) {
if (!(avpkt->flags & AV_PKT_FLAG_KEY)) {
int i, j;
uint8_t *pd = p->data[0];
uint8_t *pd_last = s->prev->data[0];
for (j = 0; j < s->height; j++) {
for (i = 0; i < s->width * s->bpp; i++)
pd[i] += pd_last[i];
pd += s->image_linesize;
pd_last += s->image_linesize;
}
}
}
av_frame_unref(s->prev);
if ((ret = av_frame_ref(s->prev, p)) < 0)
goto fail;
*got_frame = 1;
ret = bytestream2_tell(&s->gb);
the_end:
inflateEnd(&s->zstream);
av_free(crow_buf_base);
s->crow_buf = NULL;
av_freep(&s->last_row);
av_freep(&s->tmp_row);
return ret;
fail:
ret = -1;
goto the_end;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0,
void *VAR_1, int *VAR_2,
AVPacket *VAR_3)
{
PNGDecContext *const s = VAR_0->priv_data;
const uint8_t *VAR_4 = VAR_3->VAR_1;
int VAR_5 = VAR_3->size;
AVFrame *p = VAR_1;
uint8_t *crow_buf_base = NULL;
uint32_t tag, length;
int VAR_6;
if (VAR_5 < 8 ||
memcmp(VAR_4, ff_pngsig, 8) != 0 &&
memcmp(VAR_4, ff_mngsig, 8) != 0)
return -1;
bytestream2_init(&s->gb, VAR_4 + 8, VAR_5 - 8);
s->y = s->state = 0;
s->zstream.zalloc = ff_png_zalloc;
s->zstream.zfree = ff_png_zfree;
s->zstream.opaque = NULL;
VAR_6 = inflateInit(&s->zstream);
if (VAR_6 != Z_OK)
return -1;
for (;;) {
if (bytestream2_get_bytes_left(&s->gb) <= 0)
goto fail;
length = bytestream2_get_be32(&s->gb);
if (length > 0x7fffffff)
goto fail;
tag = bytestream2_get_le32(&s->gb);
av_dlog(VAR_0, "png: tag=%c%c%c%c length=%u\VAR_7",
(tag & 0xff),
((tag >> 8) & 0xff),
((tag >> 16) & 0xff),
((tag >> 24) & 0xff), length);
switch (tag) {
case MKTAG('I', 'H', 'D', 'R'):
if (length != 13)
goto fail;
s->width = bytestream2_get_be32(&s->gb);
s->height = bytestream2_get_be32(&s->gb);
if (av_image_check_size(s->width, s->height, 0, VAR_0)) {
s->width = s->height = 0;
goto fail;
}
s->bit_depth = bytestream2_get_byte(&s->gb);
s->color_type = bytestream2_get_byte(&s->gb);
s->compression_type = bytestream2_get_byte(&s->gb);
s->filter_type = bytestream2_get_byte(&s->gb);
s->interlace_type = bytestream2_get_byte(&s->gb);
bytestream2_skip(&s->gb, 4);
s->state |= PNG_IHDR;
av_dlog(VAR_0, "width=%d height=%d depth=%d color_type=%d "
"compression_type=%d filter_type=%d interlace_type=%d\VAR_7",
s->width, s->height, s->bit_depth, s->color_type,
s->compression_type, s->filter_type, s->interlace_type);
break;
case MKTAG('I', 'D', 'A', 'T'):
if (!(s->state & PNG_IHDR))
goto fail;
if (!(s->state & PNG_IDAT)) {
VAR_0->width = s->width;
VAR_0->height = s->height;
s->channels = ff_png_get_nb_channels(s->color_type);
s->bits_per_pixel = s->bit_depth * s->channels;
s->bpp = (s->bits_per_pixel + 7) >> 3;
s->row_size = (VAR_0->width * s->bits_per_pixel + 7) >> 3;
if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_RGB) {
VAR_0->pix_fmt = AV_PIX_FMT_RGB24;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
VAR_0->pix_fmt = AV_PIX_FMT_RGB32;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_GRAY) {
VAR_0->pix_fmt = AV_PIX_FMT_GRAY8;
} else if (s->bit_depth == 16 &&
s->color_type == PNG_COLOR_TYPE_GRAY) {
VAR_0->pix_fmt = AV_PIX_FMT_GRAY16BE;
} else if (s->bit_depth == 16 &&
s->color_type == PNG_COLOR_TYPE_RGB) {
VAR_0->pix_fmt = AV_PIX_FMT_RGB48BE;
} else if (s->bit_depth == 1 &&
s->color_type == PNG_COLOR_TYPE_GRAY) {
VAR_0->pix_fmt = AV_PIX_FMT_MONOBLACK;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_PALETTE) {
VAR_0->pix_fmt = AV_PIX_FMT_PAL8;
} else if (s->bit_depth == 8 &&
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
VAR_0->pix_fmt = AV_PIX_FMT_YA8;
} else if (s->bit_depth == 16 &&
s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
VAR_0->pix_fmt = AV_PIX_FMT_YA16BE;
} else {
goto fail;
}
if (ff_get_buffer(VAR_0, p, AV_GET_BUFFER_FLAG_REF) < 0) {
av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\VAR_7");
goto fail;
}
p->pict_type = AV_PICTURE_TYPE_I;
p->key_frame = 1;
p->interlaced_frame = !!s->interlace_type;
if (!s->interlace_type) {
s->crow_size = s->row_size + 1;
} else {
s->pass = 0;
s->pass_row_size = ff_png_pass_row_size(s->pass,
s->bits_per_pixel,
s->width);
s->crow_size = s->pass_row_size + 1;
}
av_dlog(VAR_0, "row_size=%d crow_size =%d\VAR_7",
s->row_size, s->crow_size);
s->image_buf = p->VAR_1[0];
s->image_linesize = p->linesize[0];
if (s->color_type == PNG_COLOR_TYPE_PALETTE)
memcpy(p->VAR_1[1], s->palette, 256 * sizeof(uint32_t));
s->last_row = av_mallocz(s->row_size);
if (!s->last_row)
goto fail;
if (s->interlace_type ||
s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
s->tmp_row = av_malloc(s->row_size);
if (!s->tmp_row)
goto fail;
}
crow_buf_base = av_malloc(s->row_size + 16);
if (!crow_buf_base)
goto fail;
s->crow_buf = crow_buf_base + 15;
s->zstream.avail_out = s->crow_size;
s->zstream.next_out = s->crow_buf;
}
s->state |= PNG_IDAT;
if (png_decode_idat(s, length) < 0)
goto fail;
bytestream2_skip(&s->gb, 4);
break;
case MKTAG('P', 'L', 'T', 'E'):
{
int VAR_7, VAR_13, VAR_9, VAR_10, VAR_11;
if ((length % 3) != 0 || length > 256 * 3)
goto skip_tag;
VAR_7 = length / 3;
for (VAR_13 = 0; VAR_13 < VAR_7; VAR_13++) {
VAR_9 = bytestream2_get_byte(&s->gb);
VAR_10 = bytestream2_get_byte(&s->gb);
VAR_11 = bytestream2_get_byte(&s->gb);
s->palette[VAR_13] = (0xff << 24) | (VAR_9 << 16) | (VAR_10 << 8) | VAR_11;
}
for (; VAR_13 < 256; VAR_13++)
s->palette[VAR_13] = (0xff << 24);
s->state |= PNG_PLTE;
bytestream2_skip(&s->gb, 4);
}
break;
case MKTAG('t', 'R', 'N', 'S'):
{
int VAR_12, VAR_13;
if (s->color_type != PNG_COLOR_TYPE_PALETTE ||
length > 256 ||
!(s->state & PNG_PLTE))
goto skip_tag;
for (VAR_13 = 0; VAR_13 < length; VAR_13++) {
VAR_12 = bytestream2_get_byte(&s->gb);
s->palette[VAR_13] = (s->palette[VAR_13] & 0x00ffffff) | (VAR_12 << 24);
}
bytestream2_skip(&s->gb, 4);
}
break;
case MKTAG('I', 'E', 'N', 'D'):
if (!(s->state & PNG_ALLIMAGE))
goto fail;
bytestream2_skip(&s->gb, 4);
goto exit_loop;
default:
skip_tag:
bytestream2_skip(&s->gb, length + 4);
break;
}
}
exit_loop:
if (s->prev->VAR_1[0]) {
if (!(VAR_3->flags & AV_PKT_FLAG_KEY)) {
int VAR_13, VAR_13;
uint8_t *pd = p->VAR_1[0];
uint8_t *pd_last = s->prev->VAR_1[0];
for (VAR_13 = 0; VAR_13 < s->height; VAR_13++) {
for (VAR_13 = 0; VAR_13 < s->width * s->bpp; VAR_13++)
pd[VAR_13] += pd_last[VAR_13];
pd += s->image_linesize;
pd_last += s->image_linesize;
}
}
}
av_frame_unref(s->prev);
if ((VAR_6 = av_frame_ref(s->prev, p)) < 0)
goto fail;
*VAR_2 = 1;
VAR_6 = bytestream2_tell(&s->gb);
the_end:
inflateEnd(&s->zstream);
av_free(crow_buf_base);
s->crow_buf = NULL;
av_freep(&s->last_row);
av_freep(&s->tmp_row);
return VAR_6;
fail:
VAR_6 = -1;
goto the_end;
}
| [
"static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{",
"PNGDecContext *const s = VAR_0->priv_data;",
"const uint8_t *VAR_4 = VAR_3->VAR_1;",
"int VAR_5 = VAR_3->size;",
"AVFrame *p = VAR_1;",
"uint8_t *crow_buf_base = NULL;",
"uint32_t tag, length;",
"int VAR_6;",
"if (VAR_5 < 8 ||\nmemcmp(VAR_4, ff_pngsig, 8) != 0 &&\nmemcmp(VAR_4, ff_mngsig, 8) != 0)\nreturn -1;",
"bytestream2_init(&s->gb, VAR_4 + 8, VAR_5 - 8);",
"s->y = s->state = 0;",
"s->zstream.zalloc = ff_png_zalloc;",
"s->zstream.zfree = ff_png_zfree;",
"s->zstream.opaque = NULL;",
"VAR_6 = inflateInit(&s->zstream);",
"if (VAR_6 != Z_OK)\nreturn -1;",
"for (;;) {",
"if (bytestream2_get_bytes_left(&s->gb) <= 0)\ngoto fail;",
"length = bytestream2_get_be32(&s->gb);",
"if (length > 0x7fffffff)\ngoto fail;",
"tag = bytestream2_get_le32(&s->gb);",
"av_dlog(VAR_0, \"png: tag=%c%c%c%c length=%u\\VAR_7\",\n(tag & 0xff),\n((tag >> 8) & 0xff),\n((tag >> 16) & 0xff),\n((tag >> 24) & 0xff), length);",
"switch (tag) {",
"case MKTAG('I', 'H', 'D', 'R'):\nif (length != 13)\ngoto fail;",
"s->width = bytestream2_get_be32(&s->gb);",
"s->height = bytestream2_get_be32(&s->gb);",
"if (av_image_check_size(s->width, s->height, 0, VAR_0)) {",
"s->width = s->height = 0;",
"goto fail;",
"}",
"s->bit_depth = bytestream2_get_byte(&s->gb);",
"s->color_type = bytestream2_get_byte(&s->gb);",
"s->compression_type = bytestream2_get_byte(&s->gb);",
"s->filter_type = bytestream2_get_byte(&s->gb);",
"s->interlace_type = bytestream2_get_byte(&s->gb);",
"bytestream2_skip(&s->gb, 4);",
"s->state |= PNG_IHDR;",
"av_dlog(VAR_0, \"width=%d height=%d depth=%d color_type=%d \"\n\"compression_type=%d filter_type=%d interlace_type=%d\\VAR_7\",\ns->width, s->height, s->bit_depth, s->color_type,\ns->compression_type, s->filter_type, s->interlace_type);",
"break;",
"case MKTAG('I', 'D', 'A', 'T'):\nif (!(s->state & PNG_IHDR))\ngoto fail;",
"if (!(s->state & PNG_IDAT)) {",
"VAR_0->width = s->width;",
"VAR_0->height = s->height;",
"s->channels = ff_png_get_nb_channels(s->color_type);",
"s->bits_per_pixel = s->bit_depth * s->channels;",
"s->bpp = (s->bits_per_pixel + 7) >> 3;",
"s->row_size = (VAR_0->width * s->bits_per_pixel + 7) >> 3;",
"if (s->bit_depth == 8 &&\ns->color_type == PNG_COLOR_TYPE_RGB) {",
"VAR_0->pix_fmt = AV_PIX_FMT_RGB24;",
"} else if (s->bit_depth == 8 &&",
"s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {",
"VAR_0->pix_fmt = AV_PIX_FMT_RGB32;",
"} else if (s->bit_depth == 8 &&",
"s->color_type == PNG_COLOR_TYPE_GRAY) {",
"VAR_0->pix_fmt = AV_PIX_FMT_GRAY8;",
"} else if (s->bit_depth == 16 &&",
"s->color_type == PNG_COLOR_TYPE_GRAY) {",
"VAR_0->pix_fmt = AV_PIX_FMT_GRAY16BE;",
"} else if (s->bit_depth == 16 &&",
"s->color_type == PNG_COLOR_TYPE_RGB) {",
"VAR_0->pix_fmt = AV_PIX_FMT_RGB48BE;",
"} else if (s->bit_depth == 1 &&",
"s->color_type == PNG_COLOR_TYPE_GRAY) {",
"VAR_0->pix_fmt = AV_PIX_FMT_MONOBLACK;",
"} else if (s->bit_depth == 8 &&",
"s->color_type == PNG_COLOR_TYPE_PALETTE) {",
"VAR_0->pix_fmt = AV_PIX_FMT_PAL8;",
"} else if (s->bit_depth == 8 &&",
"s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {",
"VAR_0->pix_fmt = AV_PIX_FMT_YA8;",
"} else if (s->bit_depth == 16 &&",
"s->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {",
"VAR_0->pix_fmt = AV_PIX_FMT_YA16BE;",
"} else {",
"goto fail;",
"}",
"if (ff_get_buffer(VAR_0, p, AV_GET_BUFFER_FLAG_REF) < 0) {",
"av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\VAR_7\");",
"goto fail;",
"}",
"p->pict_type = AV_PICTURE_TYPE_I;",
"p->key_frame = 1;",
"p->interlaced_frame = !!s->interlace_type;",
"if (!s->interlace_type) {",
"s->crow_size = s->row_size + 1;",
"} else {",
"s->pass = 0;",
"s->pass_row_size = ff_png_pass_row_size(s->pass,\ns->bits_per_pixel,\ns->width);",
"s->crow_size = s->pass_row_size + 1;",
"}",
"av_dlog(VAR_0, \"row_size=%d crow_size =%d\\VAR_7\",\ns->row_size, s->crow_size);",
"s->image_buf = p->VAR_1[0];",
"s->image_linesize = p->linesize[0];",
"if (s->color_type == PNG_COLOR_TYPE_PALETTE)\nmemcpy(p->VAR_1[1], s->palette, 256 * sizeof(uint32_t));",
"s->last_row = av_mallocz(s->row_size);",
"if (!s->last_row)\ngoto fail;",
"if (s->interlace_type ||\ns->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {",
"s->tmp_row = av_malloc(s->row_size);",
"if (!s->tmp_row)\ngoto fail;",
"}",
"crow_buf_base = av_malloc(s->row_size + 16);",
"if (!crow_buf_base)\ngoto fail;",
"s->crow_buf = crow_buf_base + 15;",
"s->zstream.avail_out = s->crow_size;",
"s->zstream.next_out = s->crow_buf;",
"}",
"s->state |= PNG_IDAT;",
"if (png_decode_idat(s, length) < 0)\ngoto fail;",
"bytestream2_skip(&s->gb, 4);",
"break;",
"case MKTAG('P', 'L', 'T', 'E'):\n{",
"int VAR_7, VAR_13, VAR_9, VAR_10, VAR_11;",
"if ((length % 3) != 0 || length > 256 * 3)\ngoto skip_tag;",
"VAR_7 = length / 3;",
"for (VAR_13 = 0; VAR_13 < VAR_7; VAR_13++) {",
"VAR_9 = bytestream2_get_byte(&s->gb);",
"VAR_10 = bytestream2_get_byte(&s->gb);",
"VAR_11 = bytestream2_get_byte(&s->gb);",
"s->palette[VAR_13] = (0xff << 24) | (VAR_9 << 16) | (VAR_10 << 8) | VAR_11;",
"}",
"for (; VAR_13 < 256; VAR_13++)",
"s->palette[VAR_13] = (0xff << 24);",
"s->state |= PNG_PLTE;",
"bytestream2_skip(&s->gb, 4);",
"}",
"break;",
"case MKTAG('t', 'R', 'N', 'S'):\n{",
"int VAR_12, VAR_13;",
"if (s->color_type != PNG_COLOR_TYPE_PALETTE ||\nlength > 256 ||\n!(s->state & PNG_PLTE))\ngoto skip_tag;",
"for (VAR_13 = 0; VAR_13 < length; VAR_13++) {",
"VAR_12 = bytestream2_get_byte(&s->gb);",
"s->palette[VAR_13] = (s->palette[VAR_13] & 0x00ffffff) | (VAR_12 << 24);",
"}",
"bytestream2_skip(&s->gb, 4);",
"}",
"break;",
"case MKTAG('I', 'E', 'N', 'D'):\nif (!(s->state & PNG_ALLIMAGE))\ngoto fail;",
"bytestream2_skip(&s->gb, 4);",
"goto exit_loop;",
"default:\nskip_tag:\nbytestream2_skip(&s->gb, length + 4);",
"break;",
"}",
"}",
"exit_loop:\nif (s->prev->VAR_1[0]) {",
"if (!(VAR_3->flags & AV_PKT_FLAG_KEY)) {",
"int VAR_13, VAR_13;",
"uint8_t *pd = p->VAR_1[0];",
"uint8_t *pd_last = s->prev->VAR_1[0];",
"for (VAR_13 = 0; VAR_13 < s->height; VAR_13++) {",
"for (VAR_13 = 0; VAR_13 < s->width * s->bpp; VAR_13++)",
"pd[VAR_13] += pd_last[VAR_13];",
"pd += s->image_linesize;",
"pd_last += s->image_linesize;",
"}",
"}",
"}",
"av_frame_unref(s->prev);",
"if ((VAR_6 = av_frame_ref(s->prev, p)) < 0)\ngoto fail;",
"*VAR_2 = 1;",
"VAR_6 = bytestream2_tell(&s->gb);",
"the_end:\ninflateEnd(&s->zstream);",
"av_free(crow_buf_base);",
"s->crow_buf = NULL;",
"av_freep(&s->last_row);",
"av_freep(&s->tmp_row);",
"return VAR_6;",
"fail:\nVAR_6 = -1;",
"goto the_end;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
27,
29,
31,
33
],
[
37
],
[
39
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53,
55
],
[
57
],
[
59,
61
],
[
63
],
[
65,
67
],
[
69
],
[
71,
73,
75,
77,
79
],
[
81
],
[
83,
85,
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115,
117,
119,
121
],
[
123
],
[
125,
127,
129
],
[
131
],
[
135
],
[
137
],
[
141
],
[
143
],
[
145
],
[
147
],
[
151,
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209
],
[
213
],
[
215
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
231
],
[
233
],
[
235
],
[
237
],
[
239,
241,
243
],
[
245
],
[
247
],
[
249,
251
],
[
253
],
[
255
],
[
259,
261
],
[
265
],
[
267,
269
],
[
271,
273
],
[
275
],
[
277,
279
],
[
281
],
[
285
],
[
287,
289
],
[
295
],
[
297
],
[
299
],
[
301
],
[
303
],
[
305,
307
],
[
309
],
[
311
],
[
313,
315
],
[
317
],
[
321,
323
],
[
327
],
[
329
],
[
331
],
[
333
],
[
335
],
[
337
],
[
339
],
[
341
],
[
343
],
[
345
],
[
347
],
[
349
],
[
351
],
[
353,
355
],
[
357
],
[
363,
365,
367,
369
],
[
371
],
[
373
],
[
375
],
[
377
],
[
379
],
[
381
],
[
383
],
[
385,
387,
389
],
[
391
],
[
393
],
[
395,
399,
401
],
[
403
],
[
405
],
[
407
],
[
409,
413
],
[
415
],
[
417
],
[
419
],
[
421
],
[
425
],
[
427
],
[
429
],
[
431
],
[
433
],
[
435
],
[
437
],
[
439
],
[
443
],
[
445,
447
],
[
451
],
[
455
],
[
457,
459
],
[
461
],
[
463
],
[
465
],
[
467
],
[
469
],
[
471,
473
],
[
475
],
[
477
]
] |
1,544 | static bool rtas_event_log_contains(uint32_t event_mask)
{
sPAPREventLogEntry *entry = NULL;
/* we only queue EPOW events atm. */
if ((event_mask & EVENT_MASK_EPOW) == 0) {
return false;
}
QTAILQ_FOREACH(entry, &spapr->pending_events, next) {
/* EPOW and hotplug events are surfaced in the same manner */
if (entry->log_type == RTAS_LOG_TYPE_EPOW ||
entry->log_type == RTAS_LOG_TYPE_HOTPLUG) {
return true;
}
}
return false;
}
| false | qemu | 79853e18d904b0a4bcef62701d48559688007c93 | static bool rtas_event_log_contains(uint32_t event_mask)
{
sPAPREventLogEntry *entry = NULL;
if ((event_mask & EVENT_MASK_EPOW) == 0) {
return false;
}
QTAILQ_FOREACH(entry, &spapr->pending_events, next) {
if (entry->log_type == RTAS_LOG_TYPE_EPOW ||
entry->log_type == RTAS_LOG_TYPE_HOTPLUG) {
return true;
}
}
return false;
}
| {
"code": [],
"line_no": []
} | static bool FUNC_0(uint32_t event_mask)
{
sPAPREventLogEntry *entry = NULL;
if ((event_mask & EVENT_MASK_EPOW) == 0) {
return false;
}
QTAILQ_FOREACH(entry, &spapr->pending_events, next) {
if (entry->log_type == RTAS_LOG_TYPE_EPOW ||
entry->log_type == RTAS_LOG_TYPE_HOTPLUG) {
return true;
}
}
return false;
}
| [
"static bool FUNC_0(uint32_t event_mask)\n{",
"sPAPREventLogEntry *entry = NULL;",
"if ((event_mask & EVENT_MASK_EPOW) == 0) {",
"return false;",
"}",
"QTAILQ_FOREACH(entry, &spapr->pending_events, next) {",
"if (entry->log_type == RTAS_LOG_TYPE_EPOW ||\nentry->log_type == RTAS_LOG_TYPE_HOTPLUG) {",
"return true;",
"}",
"}",
"return false;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
11
],
[
13
],
[
15
],
[
19
],
[
23,
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
]
] |
1,545 | static void test_visitor_out_native_list_int16(TestOutputVisitorData *data,
const void *unused)
{
test_native_list(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_S16);
}
| false | qemu | b3db211f3c80bb996a704d665fe275619f728bd4 | static void test_visitor_out_native_list_int16(TestOutputVisitorData *data,
const void *unused)
{
test_native_list(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_S16);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(TestOutputVisitorData *VAR_0,
const void *VAR_1)
{
test_native_list(VAR_0, VAR_1, USER_DEF_NATIVE_LIST_UNION_KIND_S16);
}
| [
"static void FUNC_0(TestOutputVisitorData *VAR_0,\nconst void *VAR_1)\n{",
"test_native_list(VAR_0, VAR_1, USER_DEF_NATIVE_LIST_UNION_KIND_S16);",
"}"
] | [
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
]
] |
1,546 | void sh4_cpu_list(FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
{
int i;
for (i = 0; i < ARRAY_SIZE(sh4_defs); i++)
(*cpu_fprintf)(f, "%s\n", sh4_defs[i].name);
}
| false | qemu | 9a78eead0c74333a394c0f7bbfc4423ac746fcd5 | void sh4_cpu_list(FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
{
int i;
for (i = 0; i < ARRAY_SIZE(sh4_defs); i++)
(*cpu_fprintf)(f, "%s\n", sh4_defs[i].name);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(FILE *VAR_2, int (*VAR_1)(FILE *VAR_2, const char *VAR_2, ...))
{
int VAR_3;
for (VAR_3 = 0; VAR_3 < ARRAY_SIZE(sh4_defs); VAR_3++)
(*VAR_1)(VAR_2, "%s\n", sh4_defs[VAR_3].name);
}
| [
"void FUNC_0(FILE *VAR_2, int (*VAR_1)(FILE *VAR_2, const char *VAR_2, ...))\n{",
"int VAR_3;",
"for (VAR_3 = 0; VAR_3 < ARRAY_SIZE(sh4_defs); VAR_3++)",
"(*VAR_1)(VAR_2, \"%s\\n\", sh4_defs[VAR_3].name);",
"}"
] | [
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
]
] |
1,547 | static int qemu_rbd_set_conf(rados_t cluster, const char *conf)
{
char *p, *buf;
char name[RBD_MAX_CONF_NAME_SIZE];
char value[RBD_MAX_CONF_VAL_SIZE];
int ret = 0;
buf = g_strdup(conf);
p = buf;
while (p) {
ret = qemu_rbd_next_tok(name, sizeof(name), p,
'=', "conf option name", &p);
if (ret < 0) {
break;
}
if (!p) {
error_report("conf option %s has no value", name);
ret = -EINVAL;
break;
}
ret = qemu_rbd_next_tok(value, sizeof(value), p,
':', "conf option value", &p);
if (ret < 0) {
break;
}
if (strcmp(name, "conf")) {
ret = rados_conf_set(cluster, name, value);
if (ret < 0) {
error_report("invalid conf option %s", name);
ret = -EINVAL;
break;
}
} else {
ret = rados_conf_read_file(cluster, value);
if (ret < 0) {
error_report("error reading conf file %s", value);
break;
}
}
}
g_free(buf);
return ret;
}
| false | qemu | 7c7e9df0232a1ce5c411f0f348038d2e72097ae1 | static int qemu_rbd_set_conf(rados_t cluster, const char *conf)
{
char *p, *buf;
char name[RBD_MAX_CONF_NAME_SIZE];
char value[RBD_MAX_CONF_VAL_SIZE];
int ret = 0;
buf = g_strdup(conf);
p = buf;
while (p) {
ret = qemu_rbd_next_tok(name, sizeof(name), p,
'=', "conf option name", &p);
if (ret < 0) {
break;
}
if (!p) {
error_report("conf option %s has no value", name);
ret = -EINVAL;
break;
}
ret = qemu_rbd_next_tok(value, sizeof(value), p,
':', "conf option value", &p);
if (ret < 0) {
break;
}
if (strcmp(name, "conf")) {
ret = rados_conf_set(cluster, name, value);
if (ret < 0) {
error_report("invalid conf option %s", name);
ret = -EINVAL;
break;
}
} else {
ret = rados_conf_read_file(cluster, value);
if (ret < 0) {
error_report("error reading conf file %s", value);
break;
}
}
}
g_free(buf);
return ret;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(rados_t VAR_0, const char *VAR_1)
{
char *VAR_2, *VAR_3;
char VAR_4[RBD_MAX_CONF_NAME_SIZE];
char VAR_5[RBD_MAX_CONF_VAL_SIZE];
int VAR_6 = 0;
VAR_3 = g_strdup(VAR_1);
VAR_2 = VAR_3;
while (VAR_2) {
VAR_6 = qemu_rbd_next_tok(VAR_4, sizeof(VAR_4), VAR_2,
'=', "VAR_1 option VAR_4", &VAR_2);
if (VAR_6 < 0) {
break;
}
if (!VAR_2) {
error_report("VAR_1 option %s has no VAR_5", VAR_4);
VAR_6 = -EINVAL;
break;
}
VAR_6 = qemu_rbd_next_tok(VAR_5, sizeof(VAR_5), VAR_2,
':', "VAR_1 option VAR_5", &VAR_2);
if (VAR_6 < 0) {
break;
}
if (strcmp(VAR_4, "VAR_1")) {
VAR_6 = rados_conf_set(VAR_0, VAR_4, VAR_5);
if (VAR_6 < 0) {
error_report("invalid VAR_1 option %s", VAR_4);
VAR_6 = -EINVAL;
break;
}
} else {
VAR_6 = rados_conf_read_file(VAR_0, VAR_5);
if (VAR_6 < 0) {
error_report("error reading VAR_1 file %s", VAR_5);
break;
}
}
}
g_free(VAR_3);
return VAR_6;
}
| [
"static int FUNC_0(rados_t VAR_0, const char *VAR_1)\n{",
"char *VAR_2, *VAR_3;",
"char VAR_4[RBD_MAX_CONF_NAME_SIZE];",
"char VAR_5[RBD_MAX_CONF_VAL_SIZE];",
"int VAR_6 = 0;",
"VAR_3 = g_strdup(VAR_1);",
"VAR_2 = VAR_3;",
"while (VAR_2) {",
"VAR_6 = qemu_rbd_next_tok(VAR_4, sizeof(VAR_4), VAR_2,\n'=', \"VAR_1 option VAR_4\", &VAR_2);",
"if (VAR_6 < 0) {",
"break;",
"}",
"if (!VAR_2) {",
"error_report(\"VAR_1 option %s has no VAR_5\", VAR_4);",
"VAR_6 = -EINVAL;",
"break;",
"}",
"VAR_6 = qemu_rbd_next_tok(VAR_5, sizeof(VAR_5), VAR_2,\n':', \"VAR_1 option VAR_5\", &VAR_2);",
"if (VAR_6 < 0) {",
"break;",
"}",
"if (strcmp(VAR_4, \"VAR_1\")) {",
"VAR_6 = rados_conf_set(VAR_0, VAR_4, VAR_5);",
"if (VAR_6 < 0) {",
"error_report(\"invalid VAR_1 option %s\", VAR_4);",
"VAR_6 = -EINVAL;",
"break;",
"}",
"} else {",
"VAR_6 = rados_conf_read_file(VAR_0, VAR_5);",
"if (VAR_6 < 0) {",
"error_report(\"error reading VAR_1 file %s\", VAR_5);",
"break;",
"}",
"}",
"}",
"g_free(VAR_3);",
"return VAR_6;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
21
],
[
23,
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
47,
49
],
[
51
],
[
53
],
[
55
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
91
],
[
93
],
[
95
]
] |
1,548 | static void patch_reloc(tcg_insn_unit *code_ptr, int type,
intptr_t value, intptr_t addend)
{
assert(type == R_ARM_PC24);
assert(addend == 0);
reloc_pc24(code_ptr, (tcg_insn_unit *)value);
}
| false | qemu | eabb7b91b36b202b4dac2df2d59d698e3aff197a | static void patch_reloc(tcg_insn_unit *code_ptr, int type,
intptr_t value, intptr_t addend)
{
assert(type == R_ARM_PC24);
assert(addend == 0);
reloc_pc24(code_ptr, (tcg_insn_unit *)value);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(tcg_insn_unit *VAR_0, int VAR_1,
intptr_t VAR_2, intptr_t VAR_3)
{
assert(VAR_1 == R_ARM_PC24);
assert(VAR_3 == 0);
reloc_pc24(VAR_0, (tcg_insn_unit *)VAR_2);
}
| [
"static void FUNC_0(tcg_insn_unit *VAR_0, int VAR_1,\nintptr_t VAR_2, intptr_t VAR_3)\n{",
"assert(VAR_1 == R_ARM_PC24);",
"assert(VAR_3 == 0);",
"reloc_pc24(VAR_0, (tcg_insn_unit *)VAR_2);",
"}"
] | [
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
]
] |
1,549 | void ff_avg_h264_qpel8_mc13_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_hv_qrt_and_aver_dst_8x8_msa(src + stride - 2,
src - (stride * 2),
stride, dst, stride);
}
| false | FFmpeg | 1181d93231e9b807965724587d363c1cfd5a1d0d | void ff_avg_h264_qpel8_mc13_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_hv_qrt_and_aver_dst_8x8_msa(src + stride - 2,
src - (stride * 2),
stride, dst, stride);
}
| {
"code": [],
"line_no": []
} | void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,
ptrdiff_t VAR_2)
{
avc_luma_hv_qrt_and_aver_dst_8x8_msa(VAR_1 + VAR_2 - 2,
VAR_1 - (VAR_2 * 2),
VAR_2, VAR_0, VAR_2);
}
| [
"void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{",
"avc_luma_hv_qrt_and_aver_dst_8x8_msa(VAR_1 + VAR_2 - 2,\nVAR_1 - (VAR_2 * 2),\nVAR_2, VAR_0, VAR_2);",
"}"
] | [
0,
0,
0
] | [
[
1,
3,
5
],
[
7,
9,
11
],
[
13
]
] |
1,550 | static int v9fs_do_symlink(V9fsState *s, V9fsString *oldpath,
V9fsString *newpath)
{
return s->ops->symlink(&s->ctx, oldpath->data, newpath->data);
}
| false | qemu | 879c28133dfa54b780dffbb29e4dcfc6581f6281 | static int v9fs_do_symlink(V9fsState *s, V9fsString *oldpath,
V9fsString *newpath)
{
return s->ops->symlink(&s->ctx, oldpath->data, newpath->data);
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(V9fsState *VAR_0, V9fsString *VAR_1,
V9fsString *VAR_2)
{
return VAR_0->ops->symlink(&VAR_0->ctx, VAR_1->data, VAR_2->data);
}
| [
"static int FUNC_0(V9fsState *VAR_0, V9fsString *VAR_1,\nV9fsString *VAR_2)\n{",
"return VAR_0->ops->symlink(&VAR_0->ctx, VAR_1->data, VAR_2->data);",
"}"
] | [
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
]
] |
1,551 | static int find_pte32 (mmu_ctx_t *ctx, int h, int rw)
{
return _find_pte(ctx, 0, h, rw);
}
| false | qemu | b227a8e9aa5f27d29f77ba90d5eb9d0662a1175e | static int find_pte32 (mmu_ctx_t *ctx, int h, int rw)
{
return _find_pte(ctx, 0, h, rw);
}
| {
"code": [],
"line_no": []
} | static int FUNC_0 (mmu_ctx_t *VAR_0, int VAR_1, int VAR_2)
{
return _find_pte(VAR_0, 0, VAR_1, VAR_2);
}
| [
"static int FUNC_0 (mmu_ctx_t *VAR_0, int VAR_1, int VAR_2)\n{",
"return _find_pte(VAR_0, 0, VAR_1, VAR_2);",
"}"
] | [
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
]
] |
1,552 | static int nic_load(QEMUFile * f, void *opaque, int version_id)
{
EEPRO100State *s = opaque;
int i;
int ret;
if (version_id > 3)
return -EINVAL;
if (version_id >= 3) {
ret = pci_device_load(&s->dev, f);
if (ret < 0)
return ret;
}
if (version_id >= 2) {
qemu_get_8s(f, &s->rxcr);
} else {
s->rxcr = 0x0c;
}
qemu_get_8s(f, &s->cmd);
qemu_get_be32s(f, &s->start);
qemu_get_be32s(f, &s->stop);
qemu_get_8s(f, &s->boundary);
qemu_get_8s(f, &s->tsr);
qemu_get_8s(f, &s->tpsr);
qemu_get_be16s(f, &s->tcnt);
qemu_get_be16s(f, &s->rcnt);
qemu_get_be32s(f, &s->rsar);
qemu_get_8s(f, &s->rsr);
qemu_get_8s(f, &s->isr);
qemu_get_8s(f, &s->dcfg);
qemu_get_8s(f, &s->imr);
qemu_get_buffer(f, s->phys, 6);
qemu_get_8s(f, &s->curpag);
qemu_get_buffer(f, s->mult, 8);
qemu_get_buffer(f, s->mem, sizeof(s->mem));
/* Restore all members of struct between scv_stat and mem. */
qemu_get_8s(f, &s->scb_stat);
qemu_get_8s(f, &s->int_stat);
for (i = 0; i < 3; i++) {
qemu_get_be32s(f, &s->region[i]);
}
qemu_get_buffer(f, s->macaddr, 6);
for (i = 0; i < 19; i++) {
qemu_get_be32s(f, &s->statcounter[i]);
}
for (i = 0; i < 32; i++) {
qemu_get_be16s(f, &s->mdimem[i]);
}
/* The eeprom should be saved and restored by its own routines. */
qemu_get_be32s(f, &s->device);
qemu_get_be32s(f, &s->pointer);
qemu_get_be32s(f, &s->cu_base);
qemu_get_be32s(f, &s->cu_offset);
qemu_get_be32s(f, &s->ru_base);
qemu_get_be32s(f, &s->ru_offset);
qemu_get_be32s(f, &s->statsaddr);
/* Restore epro100_stats_t statistics. */
qemu_get_be32s(f, &s->statistics.tx_good_frames);
qemu_get_be32s(f, &s->statistics.tx_max_collisions);
qemu_get_be32s(f, &s->statistics.tx_late_collisions);
qemu_get_be32s(f, &s->statistics.tx_underruns);
qemu_get_be32s(f, &s->statistics.tx_lost_crs);
qemu_get_be32s(f, &s->statistics.tx_deferred);
qemu_get_be32s(f, &s->statistics.tx_single_collisions);
qemu_get_be32s(f, &s->statistics.tx_multiple_collisions);
qemu_get_be32s(f, &s->statistics.tx_total_collisions);
qemu_get_be32s(f, &s->statistics.rx_good_frames);
qemu_get_be32s(f, &s->statistics.rx_crc_errors);
qemu_get_be32s(f, &s->statistics.rx_alignment_errors);
qemu_get_be32s(f, &s->statistics.rx_resource_errors);
qemu_get_be32s(f, &s->statistics.rx_overrun_errors);
qemu_get_be32s(f, &s->statistics.rx_cdt_errors);
qemu_get_be32s(f, &s->statistics.rx_short_frame_errors);
qemu_get_be32s(f, &s->statistics.fc_xmt_pause);
qemu_get_be32s(f, &s->statistics.fc_rcv_pause);
qemu_get_be32s(f, &s->statistics.fc_rcv_unsupported);
qemu_get_be16s(f, &s->statistics.xmt_tco_frames);
qemu_get_be16s(f, &s->statistics.rcv_tco_frames);
qemu_get_be32s(f, &s->statistics.complete);
#if 0
qemu_get_be16s(f, &s->status);
#endif
/* Configuration bytes. */
qemu_get_buffer(f, s->configuration, sizeof(s->configuration));
return 0;
}
| false | qemu | 3706c43f021918684cf19fe0f6ef8498815e4313 | static int nic_load(QEMUFile * f, void *opaque, int version_id)
{
EEPRO100State *s = opaque;
int i;
int ret;
if (version_id > 3)
return -EINVAL;
if (version_id >= 3) {
ret = pci_device_load(&s->dev, f);
if (ret < 0)
return ret;
}
if (version_id >= 2) {
qemu_get_8s(f, &s->rxcr);
} else {
s->rxcr = 0x0c;
}
qemu_get_8s(f, &s->cmd);
qemu_get_be32s(f, &s->start);
qemu_get_be32s(f, &s->stop);
qemu_get_8s(f, &s->boundary);
qemu_get_8s(f, &s->tsr);
qemu_get_8s(f, &s->tpsr);
qemu_get_be16s(f, &s->tcnt);
qemu_get_be16s(f, &s->rcnt);
qemu_get_be32s(f, &s->rsar);
qemu_get_8s(f, &s->rsr);
qemu_get_8s(f, &s->isr);
qemu_get_8s(f, &s->dcfg);
qemu_get_8s(f, &s->imr);
qemu_get_buffer(f, s->phys, 6);
qemu_get_8s(f, &s->curpag);
qemu_get_buffer(f, s->mult, 8);
qemu_get_buffer(f, s->mem, sizeof(s->mem));
qemu_get_8s(f, &s->scb_stat);
qemu_get_8s(f, &s->int_stat);
for (i = 0; i < 3; i++) {
qemu_get_be32s(f, &s->region[i]);
}
qemu_get_buffer(f, s->macaddr, 6);
for (i = 0; i < 19; i++) {
qemu_get_be32s(f, &s->statcounter[i]);
}
for (i = 0; i < 32; i++) {
qemu_get_be16s(f, &s->mdimem[i]);
}
qemu_get_be32s(f, &s->device);
qemu_get_be32s(f, &s->pointer);
qemu_get_be32s(f, &s->cu_base);
qemu_get_be32s(f, &s->cu_offset);
qemu_get_be32s(f, &s->ru_base);
qemu_get_be32s(f, &s->ru_offset);
qemu_get_be32s(f, &s->statsaddr);
qemu_get_be32s(f, &s->statistics.tx_good_frames);
qemu_get_be32s(f, &s->statistics.tx_max_collisions);
qemu_get_be32s(f, &s->statistics.tx_late_collisions);
qemu_get_be32s(f, &s->statistics.tx_underruns);
qemu_get_be32s(f, &s->statistics.tx_lost_crs);
qemu_get_be32s(f, &s->statistics.tx_deferred);
qemu_get_be32s(f, &s->statistics.tx_single_collisions);
qemu_get_be32s(f, &s->statistics.tx_multiple_collisions);
qemu_get_be32s(f, &s->statistics.tx_total_collisions);
qemu_get_be32s(f, &s->statistics.rx_good_frames);
qemu_get_be32s(f, &s->statistics.rx_crc_errors);
qemu_get_be32s(f, &s->statistics.rx_alignment_errors);
qemu_get_be32s(f, &s->statistics.rx_resource_errors);
qemu_get_be32s(f, &s->statistics.rx_overrun_errors);
qemu_get_be32s(f, &s->statistics.rx_cdt_errors);
qemu_get_be32s(f, &s->statistics.rx_short_frame_errors);
qemu_get_be32s(f, &s->statistics.fc_xmt_pause);
qemu_get_be32s(f, &s->statistics.fc_rcv_pause);
qemu_get_be32s(f, &s->statistics.fc_rcv_unsupported);
qemu_get_be16s(f, &s->statistics.xmt_tco_frames);
qemu_get_be16s(f, &s->statistics.rcv_tco_frames);
qemu_get_be32s(f, &s->statistics.complete);
#if 0
qemu_get_be16s(f, &s->status);
#endif
qemu_get_buffer(f, s->configuration, sizeof(s->configuration));
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(QEMUFile * VAR_0, void *VAR_1, int VAR_2)
{
EEPRO100State *s = VAR_1;
int VAR_3;
int VAR_4;
if (VAR_2 > 3)
return -EINVAL;
if (VAR_2 >= 3) {
VAR_4 = pci_device_load(&s->dev, VAR_0);
if (VAR_4 < 0)
return VAR_4;
}
if (VAR_2 >= 2) {
qemu_get_8s(VAR_0, &s->rxcr);
} else {
s->rxcr = 0x0c;
}
qemu_get_8s(VAR_0, &s->cmd);
qemu_get_be32s(VAR_0, &s->start);
qemu_get_be32s(VAR_0, &s->stop);
qemu_get_8s(VAR_0, &s->boundary);
qemu_get_8s(VAR_0, &s->tsr);
qemu_get_8s(VAR_0, &s->tpsr);
qemu_get_be16s(VAR_0, &s->tcnt);
qemu_get_be16s(VAR_0, &s->rcnt);
qemu_get_be32s(VAR_0, &s->rsar);
qemu_get_8s(VAR_0, &s->rsr);
qemu_get_8s(VAR_0, &s->isr);
qemu_get_8s(VAR_0, &s->dcfg);
qemu_get_8s(VAR_0, &s->imr);
qemu_get_buffer(VAR_0, s->phys, 6);
qemu_get_8s(VAR_0, &s->curpag);
qemu_get_buffer(VAR_0, s->mult, 8);
qemu_get_buffer(VAR_0, s->mem, sizeof(s->mem));
qemu_get_8s(VAR_0, &s->scb_stat);
qemu_get_8s(VAR_0, &s->int_stat);
for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {
qemu_get_be32s(VAR_0, &s->region[VAR_3]);
}
qemu_get_buffer(VAR_0, s->macaddr, 6);
for (VAR_3 = 0; VAR_3 < 19; VAR_3++) {
qemu_get_be32s(VAR_0, &s->statcounter[VAR_3]);
}
for (VAR_3 = 0; VAR_3 < 32; VAR_3++) {
qemu_get_be16s(VAR_0, &s->mdimem[VAR_3]);
}
qemu_get_be32s(VAR_0, &s->device);
qemu_get_be32s(VAR_0, &s->pointer);
qemu_get_be32s(VAR_0, &s->cu_base);
qemu_get_be32s(VAR_0, &s->cu_offset);
qemu_get_be32s(VAR_0, &s->ru_base);
qemu_get_be32s(VAR_0, &s->ru_offset);
qemu_get_be32s(VAR_0, &s->statsaddr);
qemu_get_be32s(VAR_0, &s->statistics.tx_good_frames);
qemu_get_be32s(VAR_0, &s->statistics.tx_max_collisions);
qemu_get_be32s(VAR_0, &s->statistics.tx_late_collisions);
qemu_get_be32s(VAR_0, &s->statistics.tx_underruns);
qemu_get_be32s(VAR_0, &s->statistics.tx_lost_crs);
qemu_get_be32s(VAR_0, &s->statistics.tx_deferred);
qemu_get_be32s(VAR_0, &s->statistics.tx_single_collisions);
qemu_get_be32s(VAR_0, &s->statistics.tx_multiple_collisions);
qemu_get_be32s(VAR_0, &s->statistics.tx_total_collisions);
qemu_get_be32s(VAR_0, &s->statistics.rx_good_frames);
qemu_get_be32s(VAR_0, &s->statistics.rx_crc_errors);
qemu_get_be32s(VAR_0, &s->statistics.rx_alignment_errors);
qemu_get_be32s(VAR_0, &s->statistics.rx_resource_errors);
qemu_get_be32s(VAR_0, &s->statistics.rx_overrun_errors);
qemu_get_be32s(VAR_0, &s->statistics.rx_cdt_errors);
qemu_get_be32s(VAR_0, &s->statistics.rx_short_frame_errors);
qemu_get_be32s(VAR_0, &s->statistics.fc_xmt_pause);
qemu_get_be32s(VAR_0, &s->statistics.fc_rcv_pause);
qemu_get_be32s(VAR_0, &s->statistics.fc_rcv_unsupported);
qemu_get_be16s(VAR_0, &s->statistics.xmt_tco_frames);
qemu_get_be16s(VAR_0, &s->statistics.rcv_tco_frames);
qemu_get_be32s(VAR_0, &s->statistics.complete);
#if 0
qemu_get_be16s(VAR_0, &s->status);
#endif
qemu_get_buffer(VAR_0, s->configuration, sizeof(s->configuration));
return 0;
}
| [
"static int FUNC_0(QEMUFile * VAR_0, void *VAR_1, int VAR_2)\n{",
"EEPRO100State *s = VAR_1;",
"int VAR_3;",
"int VAR_4;",
"if (VAR_2 > 3)\nreturn -EINVAL;",
"if (VAR_2 >= 3) {",
"VAR_4 = pci_device_load(&s->dev, VAR_0);",
"if (VAR_4 < 0)\nreturn VAR_4;",
"}",
"if (VAR_2 >= 2) {",
"qemu_get_8s(VAR_0, &s->rxcr);",
"} else {",
"s->rxcr = 0x0c;",
"}",
"qemu_get_8s(VAR_0, &s->cmd);",
"qemu_get_be32s(VAR_0, &s->start);",
"qemu_get_be32s(VAR_0, &s->stop);",
"qemu_get_8s(VAR_0, &s->boundary);",
"qemu_get_8s(VAR_0, &s->tsr);",
"qemu_get_8s(VAR_0, &s->tpsr);",
"qemu_get_be16s(VAR_0, &s->tcnt);",
"qemu_get_be16s(VAR_0, &s->rcnt);",
"qemu_get_be32s(VAR_0, &s->rsar);",
"qemu_get_8s(VAR_0, &s->rsr);",
"qemu_get_8s(VAR_0, &s->isr);",
"qemu_get_8s(VAR_0, &s->dcfg);",
"qemu_get_8s(VAR_0, &s->imr);",
"qemu_get_buffer(VAR_0, s->phys, 6);",
"qemu_get_8s(VAR_0, &s->curpag);",
"qemu_get_buffer(VAR_0, s->mult, 8);",
"qemu_get_buffer(VAR_0, s->mem, sizeof(s->mem));",
"qemu_get_8s(VAR_0, &s->scb_stat);",
"qemu_get_8s(VAR_0, &s->int_stat);",
"for (VAR_3 = 0; VAR_3 < 3; VAR_3++) {",
"qemu_get_be32s(VAR_0, &s->region[VAR_3]);",
"}",
"qemu_get_buffer(VAR_0, s->macaddr, 6);",
"for (VAR_3 = 0; VAR_3 < 19; VAR_3++) {",
"qemu_get_be32s(VAR_0, &s->statcounter[VAR_3]);",
"}",
"for (VAR_3 = 0; VAR_3 < 32; VAR_3++) {",
"qemu_get_be16s(VAR_0, &s->mdimem[VAR_3]);",
"}",
"qemu_get_be32s(VAR_0, &s->device);",
"qemu_get_be32s(VAR_0, &s->pointer);",
"qemu_get_be32s(VAR_0, &s->cu_base);",
"qemu_get_be32s(VAR_0, &s->cu_offset);",
"qemu_get_be32s(VAR_0, &s->ru_base);",
"qemu_get_be32s(VAR_0, &s->ru_offset);",
"qemu_get_be32s(VAR_0, &s->statsaddr);",
"qemu_get_be32s(VAR_0, &s->statistics.tx_good_frames);",
"qemu_get_be32s(VAR_0, &s->statistics.tx_max_collisions);",
"qemu_get_be32s(VAR_0, &s->statistics.tx_late_collisions);",
"qemu_get_be32s(VAR_0, &s->statistics.tx_underruns);",
"qemu_get_be32s(VAR_0, &s->statistics.tx_lost_crs);",
"qemu_get_be32s(VAR_0, &s->statistics.tx_deferred);",
"qemu_get_be32s(VAR_0, &s->statistics.tx_single_collisions);",
"qemu_get_be32s(VAR_0, &s->statistics.tx_multiple_collisions);",
"qemu_get_be32s(VAR_0, &s->statistics.tx_total_collisions);",
"qemu_get_be32s(VAR_0, &s->statistics.rx_good_frames);",
"qemu_get_be32s(VAR_0, &s->statistics.rx_crc_errors);",
"qemu_get_be32s(VAR_0, &s->statistics.rx_alignment_errors);",
"qemu_get_be32s(VAR_0, &s->statistics.rx_resource_errors);",
"qemu_get_be32s(VAR_0, &s->statistics.rx_overrun_errors);",
"qemu_get_be32s(VAR_0, &s->statistics.rx_cdt_errors);",
"qemu_get_be32s(VAR_0, &s->statistics.rx_short_frame_errors);",
"qemu_get_be32s(VAR_0, &s->statistics.fc_xmt_pause);",
"qemu_get_be32s(VAR_0, &s->statistics.fc_rcv_pause);",
"qemu_get_be32s(VAR_0, &s->statistics.fc_rcv_unsupported);",
"qemu_get_be16s(VAR_0, &s->statistics.xmt_tco_frames);",
"qemu_get_be16s(VAR_0, &s->statistics.rcv_tco_frames);",
"qemu_get_be32s(VAR_0, &s->statistics.complete);",
"#if 0\nqemu_get_be16s(VAR_0, &s->status);",
"#endif\nqemu_get_buffer(VAR_0, s->configuration, sizeof(s->configuration));",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13,
15
],
[
19
],
[
21
],
[
23,
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
99
],
[
101
],
[
103
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167,
169
],
[
171,
177
],
[
181
],
[
183
]
] |
1,553 | static uint32_t slavio_serial_mem_readb(void *opaque, target_phys_addr_t addr)
{
SerialState *ser = opaque;
ChannelState *s;
uint32_t saddr;
uint32_t ret;
int channel;
saddr = (addr & 3) >> 1;
channel = (addr & SERIAL_MAXADDR) >> 2;
s = &ser->chn[channel];
switch (saddr) {
case 0:
SER_DPRINTF("Read channel %c, reg[%d] = %2.2x\n", CHN_C(s), s->reg, s->rregs[s->reg]);
ret = s->rregs[s->reg];
s->reg = 0;
return ret;
case 1:
s->rregs[0] &= ~1;
clr_rxint(s);
if (s->type == kbd || s->type == mouse)
ret = get_queue(s);
else
ret = s->rx;
SER_DPRINTF("Read channel %c, ch %d\n", CHN_C(s), ret);
return ret;
default:
break;
}
return 0;
}
| false | qemu | b3ceef24f4fee8d5ed96b8c4a5d3e80c0a651f0b | static uint32_t slavio_serial_mem_readb(void *opaque, target_phys_addr_t addr)
{
SerialState *ser = opaque;
ChannelState *s;
uint32_t saddr;
uint32_t ret;
int channel;
saddr = (addr & 3) >> 1;
channel = (addr & SERIAL_MAXADDR) >> 2;
s = &ser->chn[channel];
switch (saddr) {
case 0:
SER_DPRINTF("Read channel %c, reg[%d] = %2.2x\n", CHN_C(s), s->reg, s->rregs[s->reg]);
ret = s->rregs[s->reg];
s->reg = 0;
return ret;
case 1:
s->rregs[0] &= ~1;
clr_rxint(s);
if (s->type == kbd || s->type == mouse)
ret = get_queue(s);
else
ret = s->rx;
SER_DPRINTF("Read channel %c, ch %d\n", CHN_C(s), ret);
return ret;
default:
break;
}
return 0;
}
| {
"code": [],
"line_no": []
} | static uint32_t FUNC_0(void *opaque, target_phys_addr_t addr)
{
SerialState *ser = opaque;
ChannelState *s;
uint32_t saddr;
uint32_t ret;
int VAR_0;
saddr = (addr & 3) >> 1;
VAR_0 = (addr & SERIAL_MAXADDR) >> 2;
s = &ser->chn[VAR_0];
switch (saddr) {
case 0:
SER_DPRINTF("Read VAR_0 %c, reg[%d] = %2.2x\n", CHN_C(s), s->reg, s->rregs[s->reg]);
ret = s->rregs[s->reg];
s->reg = 0;
return ret;
case 1:
s->rregs[0] &= ~1;
clr_rxint(s);
if (s->type == kbd || s->type == mouse)
ret = get_queue(s);
else
ret = s->rx;
SER_DPRINTF("Read VAR_0 %c, ch %d\n", CHN_C(s), ret);
return ret;
default:
break;
}
return 0;
}
| [
"static uint32_t FUNC_0(void *opaque, target_phys_addr_t addr)\n{",
"SerialState *ser = opaque;",
"ChannelState *s;",
"uint32_t saddr;",
"uint32_t ret;",
"int VAR_0;",
"saddr = (addr & 3) >> 1;",
"VAR_0 = (addr & SERIAL_MAXADDR) >> 2;",
"s = &ser->chn[VAR_0];",
"switch (saddr) {",
"case 0:\nSER_DPRINTF(\"Read VAR_0 %c, reg[%d] = %2.2x\\n\", CHN_C(s), s->reg, s->rregs[s->reg]);",
"ret = s->rregs[s->reg];",
"s->reg = 0;",
"return ret;",
"case 1:\ns->rregs[0] &= ~1;",
"clr_rxint(s);",
"if (s->type == kbd || s->type == mouse)\nret = get_queue(s);",
"else\nret = s->rx;",
"SER_DPRINTF(\"Read VAR_0 %c, ch %d\\n\", CHN_C(s), ret);",
"return ret;",
"default:\nbreak;",
"}",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25,
27
],
[
29
],
[
31
],
[
33
],
[
35,
37
],
[
39
],
[
41,
43
],
[
45,
47
],
[
49
],
[
51
],
[
53,
55
],
[
57
],
[
59
],
[
61
]
] |
1,554 | int cpu_sparc_handle_mmu_fault (CPUState *env, uint32_t address, int rw,
int is_user, int is_softmmu)
{
int exception = 0;
int access_type, access_perms = 0, access_index = 0;
uint8_t *pde_ptr;
uint32_t pde, virt_addr;
int error_code = 0, is_dirty, prot, ret = 0;
unsigned long paddr, vaddr, page_offset;
access_type = env->access_type;
if (env->user_mode_only) {
/* user mode only emulation */
ret = -2;
goto do_fault;
}
virt_addr = address & TARGET_PAGE_MASK;
if ((env->mmuregs[0] & MMU_E) == 0) { /* MMU disabled */
paddr = address;
page_offset = address & (TARGET_PAGE_SIZE - 1);
prot = PAGE_READ | PAGE_WRITE;
goto do_mapping;
}
/* SPARC reference MMU table walk: Context table->L1->L2->PTE */
/* Context base + context number */
pde_ptr = phys_ram_base + (env->mmuregs[1] << 4) + (env->mmuregs[2] << 4);
env->access_type = ACCESS_MMU;
pde = ldl_raw(pde_ptr);
/* Ctx pde */
switch (pde & PTE_ENTRYTYPE_MASK) {
case 0: /* Invalid */
error_code = 1;
goto do_fault;
case 2: /* PTE, maybe should not happen? */
case 3: /* Reserved */
error_code = 4;
goto do_fault;
case 1: /* L1 PDE */
pde_ptr = phys_ram_base + ((address >> 22) & ~3) + ((pde & ~3) << 4);
pde = ldl_raw(pde_ptr);
switch (pde & PTE_ENTRYTYPE_MASK) {
case 0: /* Invalid */
error_code = 1;
goto do_fault;
case 3: /* Reserved */
error_code = 4;
goto do_fault;
case 1: /* L2 PDE */
pde_ptr = phys_ram_base + ((address & 0xfc0000) >> 16) + ((pde & ~3) << 4);
pde = ldl_raw(pde_ptr);
switch (pde & PTE_ENTRYTYPE_MASK) {
case 0: /* Invalid */
error_code = 1;
goto do_fault;
case 3: /* Reserved */
error_code = 4;
goto do_fault;
case 1: /* L3 PDE */
pde_ptr = phys_ram_base + ((address & 0x3f000) >> 10) + ((pde & ~3) << 4);
pde = ldl_raw(pde_ptr);
switch (pde & PTE_ENTRYTYPE_MASK) {
case 0: /* Invalid */
error_code = 1;
goto do_fault;
case 1: /* PDE, should not happen */
case 3: /* Reserved */
error_code = 4;
goto do_fault;
case 2: /* L3 PTE */
virt_addr = address & TARGET_PAGE_MASK;
page_offset = (address & TARGET_PAGE_MASK) & (TARGET_PAGE_SIZE - 1);
}
break;
case 2: /* L2 PTE */
virt_addr = address & ~0x3ffff;
page_offset = address & 0x3ffff;
}
break;
case 2: /* L1 PTE */
virt_addr = address & ~0xffffff;
page_offset = address & 0xffffff;
}
}
/* update page modified and dirty bits */
is_dirty = rw && !(pde & PG_MODIFIED_MASK);
if (!(pde & PG_ACCESSED_MASK) || is_dirty) {
pde |= PG_ACCESSED_MASK;
if (is_dirty)
pde |= PG_MODIFIED_MASK;
stl_raw(pde_ptr, pde);
}
/* check access */
access_index = (rw << 2) | ((access_type == ACCESS_CODE)? 2 : 0) | (is_user? 0 : 1);
access_perms = (pde & PTE_ACCESS_MASK) >> PTE_ACCESS_SHIFT;
error_code = access_table[access_index][access_perms];
if (error_code)
goto do_fault;
/* the page can be put in the TLB */
prot = PAGE_READ;
if (pde & PG_MODIFIED_MASK) {
/* only set write access if already dirty... otherwise wait
for dirty access */
if (rw_table[is_user][access_perms])
prot |= PAGE_WRITE;
}
/* Even if large ptes, we map only one 4KB page in the cache to
avoid filling it too fast */
virt_addr = address & TARGET_PAGE_MASK;
paddr = ((pde & PTE_ADDR_MASK) << 4) + page_offset;
do_mapping:
env->access_type = access_type;
vaddr = virt_addr + ((address & TARGET_PAGE_MASK) & (TARGET_PAGE_SIZE - 1));
ret = tlb_set_page(env, vaddr, paddr, prot, is_user, is_softmmu);
return ret;
do_fault:
env->access_type = access_type;
if (env->mmuregs[3]) /* Fault status register */
env->mmuregs[3] = 1; /* overflow (not read before another fault) */
env->mmuregs[3] |= (access_index << 5) | (error_code << 2) | 2;
env->mmuregs[4] = address; /* Fault address register */
if (env->mmuregs[0] & MMU_NF) // No fault
return 0;
env->exception_index = exception;
env->error_code = error_code;
return error_code;
}
| false | qemu | b769d8fef6c06ddb39ef0337882a4f8872b9c2bc | int cpu_sparc_handle_mmu_fault (CPUState *env, uint32_t address, int rw,
int is_user, int is_softmmu)
{
int exception = 0;
int access_type, access_perms = 0, access_index = 0;
uint8_t *pde_ptr;
uint32_t pde, virt_addr;
int error_code = 0, is_dirty, prot, ret = 0;
unsigned long paddr, vaddr, page_offset;
access_type = env->access_type;
if (env->user_mode_only) {
ret = -2;
goto do_fault;
}
virt_addr = address & TARGET_PAGE_MASK;
if ((env->mmuregs[0] & MMU_E) == 0) {
paddr = address;
page_offset = address & (TARGET_PAGE_SIZE - 1);
prot = PAGE_READ | PAGE_WRITE;
goto do_mapping;
}
pde_ptr = phys_ram_base + (env->mmuregs[1] << 4) + (env->mmuregs[2] << 4);
env->access_type = ACCESS_MMU;
pde = ldl_raw(pde_ptr);
switch (pde & PTE_ENTRYTYPE_MASK) {
case 0:
error_code = 1;
goto do_fault;
case 2:
case 3:
error_code = 4;
goto do_fault;
case 1:
pde_ptr = phys_ram_base + ((address >> 22) & ~3) + ((pde & ~3) << 4);
pde = ldl_raw(pde_ptr);
switch (pde & PTE_ENTRYTYPE_MASK) {
case 0:
error_code = 1;
goto do_fault;
case 3:
error_code = 4;
goto do_fault;
case 1:
pde_ptr = phys_ram_base + ((address & 0xfc0000) >> 16) + ((pde & ~3) << 4);
pde = ldl_raw(pde_ptr);
switch (pde & PTE_ENTRYTYPE_MASK) {
case 0:
error_code = 1;
goto do_fault;
case 3:
error_code = 4;
goto do_fault;
case 1:
pde_ptr = phys_ram_base + ((address & 0x3f000) >> 10) + ((pde & ~3) << 4);
pde = ldl_raw(pde_ptr);
switch (pde & PTE_ENTRYTYPE_MASK) {
case 0:
error_code = 1;
goto do_fault;
case 1:
case 3:
error_code = 4;
goto do_fault;
case 2:
virt_addr = address & TARGET_PAGE_MASK;
page_offset = (address & TARGET_PAGE_MASK) & (TARGET_PAGE_SIZE - 1);
}
break;
case 2:
virt_addr = address & ~0x3ffff;
page_offset = address & 0x3ffff;
}
break;
case 2:
virt_addr = address & ~0xffffff;
page_offset = address & 0xffffff;
}
}
is_dirty = rw && !(pde & PG_MODIFIED_MASK);
if (!(pde & PG_ACCESSED_MASK) || is_dirty) {
pde |= PG_ACCESSED_MASK;
if (is_dirty)
pde |= PG_MODIFIED_MASK;
stl_raw(pde_ptr, pde);
}
access_index = (rw << 2) | ((access_type == ACCESS_CODE)? 2 : 0) | (is_user? 0 : 1);
access_perms = (pde & PTE_ACCESS_MASK) >> PTE_ACCESS_SHIFT;
error_code = access_table[access_index][access_perms];
if (error_code)
goto do_fault;
prot = PAGE_READ;
if (pde & PG_MODIFIED_MASK) {
if (rw_table[is_user][access_perms])
prot |= PAGE_WRITE;
}
virt_addr = address & TARGET_PAGE_MASK;
paddr = ((pde & PTE_ADDR_MASK) << 4) + page_offset;
do_mapping:
env->access_type = access_type;
vaddr = virt_addr + ((address & TARGET_PAGE_MASK) & (TARGET_PAGE_SIZE - 1));
ret = tlb_set_page(env, vaddr, paddr, prot, is_user, is_softmmu);
return ret;
do_fault:
env->access_type = access_type;
if (env->mmuregs[3])
env->mmuregs[3] = 1;
env->mmuregs[3] |= (access_index << 5) | (error_code << 2) | 2;
env->mmuregs[4] = address;
if (env->mmuregs[0] & MMU_NF)
return 0;
env->exception_index = exception;
env->error_code = error_code;
return error_code;
}
| {
"code": [],
"line_no": []
} | int FUNC_0 (CPUState *VAR_0, uint32_t VAR_1, int VAR_2,
int VAR_3, int VAR_4)
{
int VAR_5 = 0;
int VAR_6, VAR_7 = 0, VAR_8 = 0;
uint8_t *pde_ptr;
uint32_t pde, virt_addr;
int VAR_9 = 0, VAR_10, VAR_11, VAR_12 = 0;
unsigned long VAR_13, VAR_14, VAR_15;
VAR_6 = VAR_0->VAR_6;
if (VAR_0->user_mode_only) {
VAR_12 = -2;
goto do_fault;
}
virt_addr = VAR_1 & TARGET_PAGE_MASK;
if ((VAR_0->mmuregs[0] & MMU_E) == 0) {
VAR_13 = VAR_1;
VAR_15 = VAR_1 & (TARGET_PAGE_SIZE - 1);
VAR_11 = PAGE_READ | PAGE_WRITE;
goto do_mapping;
}
pde_ptr = phys_ram_base + (VAR_0->mmuregs[1] << 4) + (VAR_0->mmuregs[2] << 4);
VAR_0->VAR_6 = ACCESS_MMU;
pde = ldl_raw(pde_ptr);
switch (pde & PTE_ENTRYTYPE_MASK) {
case 0:
VAR_9 = 1;
goto do_fault;
case 2:
case 3:
VAR_9 = 4;
goto do_fault;
case 1:
pde_ptr = phys_ram_base + ((VAR_1 >> 22) & ~3) + ((pde & ~3) << 4);
pde = ldl_raw(pde_ptr);
switch (pde & PTE_ENTRYTYPE_MASK) {
case 0:
VAR_9 = 1;
goto do_fault;
case 3:
VAR_9 = 4;
goto do_fault;
case 1:
pde_ptr = phys_ram_base + ((VAR_1 & 0xfc0000) >> 16) + ((pde & ~3) << 4);
pde = ldl_raw(pde_ptr);
switch (pde & PTE_ENTRYTYPE_MASK) {
case 0:
VAR_9 = 1;
goto do_fault;
case 3:
VAR_9 = 4;
goto do_fault;
case 1:
pde_ptr = phys_ram_base + ((VAR_1 & 0x3f000) >> 10) + ((pde & ~3) << 4);
pde = ldl_raw(pde_ptr);
switch (pde & PTE_ENTRYTYPE_MASK) {
case 0:
VAR_9 = 1;
goto do_fault;
case 1:
case 3:
VAR_9 = 4;
goto do_fault;
case 2:
virt_addr = VAR_1 & TARGET_PAGE_MASK;
VAR_15 = (VAR_1 & TARGET_PAGE_MASK) & (TARGET_PAGE_SIZE - 1);
}
break;
case 2:
virt_addr = VAR_1 & ~0x3ffff;
VAR_15 = VAR_1 & 0x3ffff;
}
break;
case 2:
virt_addr = VAR_1 & ~0xffffff;
VAR_15 = VAR_1 & 0xffffff;
}
}
VAR_10 = VAR_2 && !(pde & PG_MODIFIED_MASK);
if (!(pde & PG_ACCESSED_MASK) || VAR_10) {
pde |= PG_ACCESSED_MASK;
if (VAR_10)
pde |= PG_MODIFIED_MASK;
stl_raw(pde_ptr, pde);
}
VAR_8 = (VAR_2 << 2) | ((VAR_6 == ACCESS_CODE)? 2 : 0) | (VAR_3? 0 : 1);
VAR_7 = (pde & PTE_ACCESS_MASK) >> PTE_ACCESS_SHIFT;
VAR_9 = access_table[VAR_8][VAR_7];
if (VAR_9)
goto do_fault;
VAR_11 = PAGE_READ;
if (pde & PG_MODIFIED_MASK) {
if (rw_table[VAR_3][VAR_7])
VAR_11 |= PAGE_WRITE;
}
virt_addr = VAR_1 & TARGET_PAGE_MASK;
VAR_13 = ((pde & PTE_ADDR_MASK) << 4) + VAR_15;
do_mapping:
VAR_0->VAR_6 = VAR_6;
VAR_14 = virt_addr + ((VAR_1 & TARGET_PAGE_MASK) & (TARGET_PAGE_SIZE - 1));
VAR_12 = tlb_set_page(VAR_0, VAR_14, VAR_13, VAR_11, VAR_3, VAR_4);
return VAR_12;
do_fault:
VAR_0->VAR_6 = VAR_6;
if (VAR_0->mmuregs[3])
VAR_0->mmuregs[3] = 1;
VAR_0->mmuregs[3] |= (VAR_8 << 5) | (VAR_9 << 2) | 2;
VAR_0->mmuregs[4] = VAR_1;
if (VAR_0->mmuregs[0] & MMU_NF)
return 0;
VAR_0->exception_index = VAR_5;
VAR_0->VAR_9 = VAR_9;
return VAR_9;
}
| [
"int FUNC_0 (CPUState *VAR_0, uint32_t VAR_1, int VAR_2,\nint VAR_3, int VAR_4)\n{",
"int VAR_5 = 0;",
"int VAR_6, VAR_7 = 0, VAR_8 = 0;",
"uint8_t *pde_ptr;",
"uint32_t pde, virt_addr;",
"int VAR_9 = 0, VAR_10, VAR_11, VAR_12 = 0;",
"unsigned long VAR_13, VAR_14, VAR_15;",
"VAR_6 = VAR_0->VAR_6;",
"if (VAR_0->user_mode_only) {",
"VAR_12 = -2;",
"goto do_fault;",
"}",
"virt_addr = VAR_1 & TARGET_PAGE_MASK;",
"if ((VAR_0->mmuregs[0] & MMU_E) == 0) {",
"VAR_13 = VAR_1;",
"VAR_15 = VAR_1 & (TARGET_PAGE_SIZE - 1);",
"VAR_11 = PAGE_READ | PAGE_WRITE;",
"goto do_mapping;",
"}",
"pde_ptr = phys_ram_base + (VAR_0->mmuregs[1] << 4) + (VAR_0->mmuregs[2] << 4);",
"VAR_0->VAR_6 = ACCESS_MMU;",
"pde = ldl_raw(pde_ptr);",
"switch (pde & PTE_ENTRYTYPE_MASK) {",
"case 0:\nVAR_9 = 1;",
"goto do_fault;",
"case 2:\ncase 3:\nVAR_9 = 4;",
"goto do_fault;",
"case 1:\npde_ptr = phys_ram_base + ((VAR_1 >> 22) & ~3) + ((pde & ~3) << 4);",
"pde = ldl_raw(pde_ptr);",
"switch (pde & PTE_ENTRYTYPE_MASK) {",
"case 0:\nVAR_9 = 1;",
"goto do_fault;",
"case 3:\nVAR_9 = 4;",
"goto do_fault;",
"case 1:\npde_ptr = phys_ram_base + ((VAR_1 & 0xfc0000) >> 16) + ((pde & ~3) << 4);",
"pde = ldl_raw(pde_ptr);",
"switch (pde & PTE_ENTRYTYPE_MASK) {",
"case 0:\nVAR_9 = 1;",
"goto do_fault;",
"case 3:\nVAR_9 = 4;",
"goto do_fault;",
"case 1:\npde_ptr = phys_ram_base + ((VAR_1 & 0x3f000) >> 10) + ((pde & ~3) << 4);",
"pde = ldl_raw(pde_ptr);",
"switch (pde & PTE_ENTRYTYPE_MASK) {",
"case 0:\nVAR_9 = 1;",
"goto do_fault;",
"case 1:\ncase 3:\nVAR_9 = 4;",
"goto do_fault;",
"case 2:\nvirt_addr = VAR_1 & TARGET_PAGE_MASK;",
"VAR_15 = (VAR_1 & TARGET_PAGE_MASK) & (TARGET_PAGE_SIZE - 1);",
"}",
"break;",
"case 2:\nvirt_addr = VAR_1 & ~0x3ffff;",
"VAR_15 = VAR_1 & 0x3ffff;",
"}",
"break;",
"case 2:\nvirt_addr = VAR_1 & ~0xffffff;",
"VAR_15 = VAR_1 & 0xffffff;",
"}",
"}",
"VAR_10 = VAR_2 && !(pde & PG_MODIFIED_MASK);",
"if (!(pde & PG_ACCESSED_MASK) || VAR_10) {",
"pde |= PG_ACCESSED_MASK;",
"if (VAR_10)\npde |= PG_MODIFIED_MASK;",
"stl_raw(pde_ptr, pde);",
"}",
"VAR_8 = (VAR_2 << 2) | ((VAR_6 == ACCESS_CODE)? 2 : 0) | (VAR_3? 0 : 1);",
"VAR_7 = (pde & PTE_ACCESS_MASK) >> PTE_ACCESS_SHIFT;",
"VAR_9 = access_table[VAR_8][VAR_7];",
"if (VAR_9)\ngoto do_fault;",
"VAR_11 = PAGE_READ;",
"if (pde & PG_MODIFIED_MASK) {",
"if (rw_table[VAR_3][VAR_7])\nVAR_11 |= PAGE_WRITE;",
"}",
"virt_addr = VAR_1 & TARGET_PAGE_MASK;",
"VAR_13 = ((pde & PTE_ADDR_MASK) << 4) + VAR_15;",
"do_mapping:\nVAR_0->VAR_6 = VAR_6;",
"VAR_14 = virt_addr + ((VAR_1 & TARGET_PAGE_MASK) & (TARGET_PAGE_SIZE - 1));",
"VAR_12 = tlb_set_page(VAR_0, VAR_14, VAR_13, VAR_11, VAR_3, VAR_4);",
"return VAR_12;",
"do_fault:\nVAR_0->VAR_6 = VAR_6;",
"if (VAR_0->mmuregs[3])\nVAR_0->mmuregs[3] = 1;",
"VAR_0->mmuregs[3] |= (VAR_8 << 5) | (VAR_9 << 2) | 2;",
"VAR_0->mmuregs[4] = VAR_1;",
"if (VAR_0->mmuregs[0] & MMU_NF)\nreturn 0;",
"VAR_0->exception_index = VAR_5;",
"VAR_0->VAR_9 = VAR_9;",
"return VAR_9;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
55
],
[
57
],
[
59
],
[
65
],
[
67,
69
],
[
71
],
[
73,
75,
77
],
[
79
],
[
81,
83
],
[
85
],
[
89
],
[
91,
93
],
[
95
],
[
97,
99
],
[
101
],
[
103,
105
],
[
107
],
[
111
],
[
113,
115
],
[
117
],
[
119,
121
],
[
123
],
[
125,
127
],
[
129
],
[
133
],
[
135,
137
],
[
139
],
[
141,
143,
145
],
[
147
],
[
149,
151
],
[
153
],
[
155
],
[
157
],
[
159,
161
],
[
163
],
[
165
],
[
167
],
[
169,
171
],
[
173
],
[
175
],
[
177
],
[
183
],
[
185
],
[
187
],
[
189,
191
],
[
193
],
[
195
],
[
201
],
[
203
],
[
205
],
[
207,
209
],
[
215
],
[
217
],
[
223,
225
],
[
227
],
[
235
],
[
237
],
[
241,
243
],
[
245
],
[
249
],
[
251
],
[
255,
257
],
[
259,
261
],
[
263
],
[
265
],
[
269,
271
],
[
275
],
[
277
],
[
279
],
[
281
]
] |
1,555 | static void gen_farith (DisasContext *ctx, enum fopcode op1,
int ft, int fs, int fd, int cc)
{
const char *opn = "farith";
const char *condnames[] = {
"c.f",
"c.un",
"c.eq",
"c.ueq",
"c.olt",
"c.ult",
"c.ole",
"c.ule",
"c.sf",
"c.ngle",
"c.seq",
"c.ngl",
"c.lt",
"c.nge",
"c.le",
"c.ngt",
};
const char *condnames_abs[] = {
"cabs.f",
"cabs.un",
"cabs.eq",
"cabs.ueq",
"cabs.olt",
"cabs.ult",
"cabs.ole",
"cabs.ule",
"cabs.sf",
"cabs.ngle",
"cabs.seq",
"cabs.ngl",
"cabs.lt",
"cabs.nge",
"cabs.le",
"cabs.ngt",
};
enum { BINOP, CMPOP, OTHEROP } optype = OTHEROP;
uint32_t func = ctx->opcode & 0x3f;
switch (op1) {
case OPC_ADD_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_add_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "add.s";
optype = BINOP;
break;
case OPC_SUB_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_sub_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "sub.s";
optype = BINOP;
break;
case OPC_MUL_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_mul_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "mul.s";
optype = BINOP;
break;
case OPC_DIV_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_div_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "div.s";
optype = BINOP;
break;
case OPC_SQRT_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_sqrt_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "sqrt.s";
break;
case OPC_ABS_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_abs_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "abs.s";
break;
case OPC_MOV_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "mov.s";
break;
case OPC_NEG_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_chs_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "neg.s";
break;
case OPC_ROUND_L_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_roundl_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "round.l.s";
break;
case OPC_TRUNC_L_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_truncl_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "trunc.l.s";
break;
case OPC_CEIL_L_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_ceill_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "ceil.l.s";
break;
case OPC_FLOOR_L_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_floorl_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "floor.l.s";
break;
case OPC_ROUND_W_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_roundw_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "round.w.s";
break;
case OPC_TRUNC_W_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_truncw_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "trunc.w.s";
break;
case OPC_CEIL_W_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_ceilw_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "ceil.w.s";
break;
case OPC_FLOOR_W_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_floorw_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "floor.w.s";
break;
case OPC_MOVCF_S:
gen_movcf_s(fs, fd, (ft >> 2) & 0x7, ft & 0x1);
opn = "movcf.s";
break;
case OPC_MOVZ_S:
{
int l1 = gen_new_label();
TCGv_i32 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[ft], 0, l1);
}
fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
gen_set_label(l1);
}
opn = "movz.s";
break;
case OPC_MOVN_S:
{
int l1 = gen_new_label();
TCGv_i32 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[ft], 0, l1);
fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
gen_set_label(l1);
}
}
opn = "movn.s";
break;
case OPC_RECIP_S:
check_cop1x(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_recip_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "recip.s";
break;
case OPC_RSQRT_S:
check_cop1x(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_rsqrt_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "rsqrt.s";
break;
case OPC_RECIP2_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_recip2_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "recip2.s";
break;
case OPC_RECIP1_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_recip1_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "recip1.s";
break;
case OPC_RSQRT1_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_rsqrt1_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "rsqrt1.s";
break;
case OPC_RSQRT2_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_rsqrt2_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "rsqrt2.s";
break;
case OPC_CVT_D_S:
check_cp1_registers(ctx, fd);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_cvtd_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "cvt.d.s";
break;
case OPC_CVT_W_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_cvtw_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "cvt.w.s";
break;
case OPC_CVT_L_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_cvtl_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "cvt.l.s";
break;
case OPC_CVT_PS_S:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp64 = tcg_temp_new_i64();
TCGv_i32 fp32_0 = tcg_temp_new_i32();
TCGv_i32 fp32_1 = tcg_temp_new_i32();
gen_load_fpr32(fp32_0, fs);
gen_load_fpr32(fp32_1, ft);
tcg_gen_concat_i32_i64(fp64, fp32_1, fp32_0);
tcg_temp_free_i32(fp32_1);
tcg_temp_free_i32(fp32_0);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "cvt.ps.s";
break;
case OPC_CMP_F_S:
case OPC_CMP_UN_S:
case OPC_CMP_EQ_S:
case OPC_CMP_UEQ_S:
case OPC_CMP_OLT_S:
case OPC_CMP_ULT_S:
case OPC_CMP_OLE_S:
case OPC_CMP_ULE_S:
case OPC_CMP_SF_S:
case OPC_CMP_NGLE_S:
case OPC_CMP_SEQ_S:
case OPC_CMP_NGL_S:
case OPC_CMP_LT_S:
case OPC_CMP_NGE_S:
case OPC_CMP_LE_S:
case OPC_CMP_NGT_S:
if (ctx->opcode & (1 << 6)) {
gen_cmpabs_s(ctx, func-48, ft, fs, cc);
opn = condnames_abs[func-48];
} else {
gen_cmp_s(ctx, func-48, ft, fs, cc);
opn = condnames[func-48];
}
break;
case OPC_ADD_D:
check_cp1_registers(ctx, fs | ft | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_add_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "add.d";
optype = BINOP;
break;
case OPC_SUB_D:
check_cp1_registers(ctx, fs | ft | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_sub_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "sub.d";
optype = BINOP;
break;
case OPC_MUL_D:
check_cp1_registers(ctx, fs | ft | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_mul_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mul.d";
optype = BINOP;
break;
case OPC_DIV_D:
check_cp1_registers(ctx, fs | ft | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_div_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "div.d";
optype = BINOP;
break;
case OPC_SQRT_D:
check_cp1_registers(ctx, fs | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_sqrt_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "sqrt.d";
break;
case OPC_ABS_D:
check_cp1_registers(ctx, fs | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_abs_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "abs.d";
break;
case OPC_MOV_D:
check_cp1_registers(ctx, fs | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mov.d";
break;
case OPC_NEG_D:
check_cp1_registers(ctx, fs | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_chs_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "neg.d";
break;
case OPC_ROUND_L_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_roundl_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "round.l.d";
break;
case OPC_TRUNC_L_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_truncl_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "trunc.l.d";
break;
case OPC_CEIL_L_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_ceill_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "ceil.l.d";
break;
case OPC_FLOOR_L_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_floorl_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "floor.l.d";
break;
case OPC_ROUND_W_D:
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_roundw_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "round.w.d";
break;
case OPC_TRUNC_W_D:
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_truncw_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "trunc.w.d";
break;
case OPC_CEIL_W_D:
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_ceilw_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "ceil.w.d";
break;
case OPC_FLOOR_W_D:
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_floorw_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "floor.w.d";
break;
case OPC_MOVCF_D:
gen_movcf_d(ctx, fs, fd, (ft >> 2) & 0x7, ft & 0x1);
opn = "movcf.d";
break;
case OPC_MOVZ_D:
{
int l1 = gen_new_label();
TCGv_i64 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[ft], 0, l1);
}
fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
gen_set_label(l1);
}
opn = "movz.d";
break;
case OPC_MOVN_D:
{
int l1 = gen_new_label();
TCGv_i64 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[ft], 0, l1);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
gen_set_label(l1);
}
}
opn = "movn.d";
break;
case OPC_RECIP_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_recip_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip.d";
break;
case OPC_RSQRT_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_rsqrt_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt.d";
break;
case OPC_RECIP2_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_recip2_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip2.d";
break;
case OPC_RECIP1_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_recip1_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip1.d";
break;
case OPC_RSQRT1_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_rsqrt1_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt1.d";
break;
case OPC_RSQRT2_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_rsqrt2_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt2.d";
break;
case OPC_CMP_F_D:
case OPC_CMP_UN_D:
case OPC_CMP_EQ_D:
case OPC_CMP_UEQ_D:
case OPC_CMP_OLT_D:
case OPC_CMP_ULT_D:
case OPC_CMP_OLE_D:
case OPC_CMP_ULE_D:
case OPC_CMP_SF_D:
case OPC_CMP_NGLE_D:
case OPC_CMP_SEQ_D:
case OPC_CMP_NGL_D:
case OPC_CMP_LT_D:
case OPC_CMP_NGE_D:
case OPC_CMP_LE_D:
case OPC_CMP_NGT_D:
if (ctx->opcode & (1 << 6)) {
gen_cmpabs_d(ctx, func-48, ft, fs, cc);
opn = condnames_abs[func-48];
} else {
gen_cmp_d(ctx, func-48, ft, fs, cc);
opn = condnames[func-48];
}
break;
case OPC_CVT_S_D:
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_cvts_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "cvt.s.d";
break;
case OPC_CVT_W_D:
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_cvtw_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "cvt.w.d";
break;
case OPC_CVT_L_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_cvtl_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "cvt.l.d";
break;
case OPC_CVT_S_W:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_cvts_w(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "cvt.s.w";
break;
case OPC_CVT_D_W:
check_cp1_registers(ctx, fd);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_cvtd_w(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "cvt.d.w";
break;
case OPC_CVT_S_L:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_cvts_l(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "cvt.s.l";
break;
case OPC_CVT_D_L:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_cvtd_l(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "cvt.d.l";
break;
case OPC_CVT_PS_PW:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_cvtps_pw(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "cvt.ps.pw";
break;
case OPC_ADD_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_add_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "add.ps";
break;
case OPC_SUB_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_sub_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "sub.ps";
break;
case OPC_MUL_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_mul_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mul.ps";
break;
case OPC_ABS_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_abs_ps(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "abs.ps";
break;
case OPC_MOV_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mov.ps";
break;
case OPC_NEG_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_chs_ps(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "neg.ps";
break;
case OPC_MOVCF_PS:
check_cp1_64bitmode(ctx);
gen_movcf_ps(fs, fd, (ft >> 2) & 0x7, ft & 0x1);
opn = "movcf.ps";
break;
case OPC_MOVZ_PS:
check_cp1_64bitmode(ctx);
{
int l1 = gen_new_label();
TCGv_i64 fp0;
if (ft != 0)
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[ft], 0, l1);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
gen_set_label(l1);
}
opn = "movz.ps";
break;
case OPC_MOVN_PS:
check_cp1_64bitmode(ctx);
{
int l1 = gen_new_label();
TCGv_i64 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[ft], 0, l1);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
gen_set_label(l1);
}
}
opn = "movn.ps";
break;
case OPC_ADDR_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, ft);
gen_load_fpr64(ctx, fp1, fs);
gen_helper_float_addr_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "addr.ps";
break;
case OPC_MULR_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, ft);
gen_load_fpr64(ctx, fp1, fs);
gen_helper_float_mulr_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mulr.ps";
break;
case OPC_RECIP2_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_recip2_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip2.ps";
break;
case OPC_RECIP1_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_recip1_ps(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip1.ps";
break;
case OPC_RSQRT1_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_rsqrt1_ps(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt1.ps";
break;
case OPC_RSQRT2_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_rsqrt2_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt2.ps";
break;
case OPC_CVT_S_PU:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, fs);
gen_helper_float_cvts_pu(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "cvt.s.pu";
break;
case OPC_CVT_PW_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_cvtpw_ps(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "cvt.pw.ps";
break;
case OPC_CVT_S_PL:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_cvts_pl(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "cvt.s.pl";
break;
case OPC_PLL_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_store_fpr32h(fp0, fd);
gen_store_fpr32(fp1, fd);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
opn = "pll.ps";
break;
case OPC_PLU_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32h(fp1, ft);
gen_store_fpr32(fp1, fd);
gen_store_fpr32h(fp0, fd);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
opn = "plu.ps";
break;
case OPC_PUL_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_store_fpr32(fp1, fd);
gen_store_fpr32h(fp0, fd);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
opn = "pul.ps";
break;
case OPC_PUU_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, fs);
gen_load_fpr32h(fp1, ft);
gen_store_fpr32(fp1, fd);
gen_store_fpr32h(fp0, fd);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
opn = "puu.ps";
break;
case OPC_CMP_F_PS:
case OPC_CMP_UN_PS:
case OPC_CMP_EQ_PS:
case OPC_CMP_UEQ_PS:
case OPC_CMP_OLT_PS:
case OPC_CMP_ULT_PS:
case OPC_CMP_OLE_PS:
case OPC_CMP_ULE_PS:
case OPC_CMP_SF_PS:
case OPC_CMP_NGLE_PS:
case OPC_CMP_SEQ_PS:
case OPC_CMP_NGL_PS:
case OPC_CMP_LT_PS:
case OPC_CMP_NGE_PS:
case OPC_CMP_LE_PS:
case OPC_CMP_NGT_PS:
if (ctx->opcode & (1 << 6)) {
gen_cmpabs_ps(ctx, func-48, ft, fs, cc);
opn = condnames_abs[func-48];
} else {
gen_cmp_ps(ctx, func-48, ft, fs, cc);
opn = condnames[func-48];
}
break;
default:
MIPS_INVAL(opn);
generate_exception (ctx, EXCP_RI);
return;
}
(void)opn; /* avoid a compiler warning */
switch (optype) {
case BINOP:
MIPS_DEBUG("%s %s, %s, %s", opn, fregnames[fd], fregnames[fs], fregnames[ft]);
break;
case CMPOP:
MIPS_DEBUG("%s %s,%s", opn, fregnames[fs], fregnames[ft]);
break;
default:
MIPS_DEBUG("%s %s,%s", opn, fregnames[fd], fregnames[fs]);
break;
}
}
| false | qemu | 7f6613cedc59fa849105668ae971dc31004bca1c | static void gen_farith (DisasContext *ctx, enum fopcode op1,
int ft, int fs, int fd, int cc)
{
const char *opn = "farith";
const char *condnames[] = {
"c.f",
"c.un",
"c.eq",
"c.ueq",
"c.olt",
"c.ult",
"c.ole",
"c.ule",
"c.sf",
"c.ngle",
"c.seq",
"c.ngl",
"c.lt",
"c.nge",
"c.le",
"c.ngt",
};
const char *condnames_abs[] = {
"cabs.f",
"cabs.un",
"cabs.eq",
"cabs.ueq",
"cabs.olt",
"cabs.ult",
"cabs.ole",
"cabs.ule",
"cabs.sf",
"cabs.ngle",
"cabs.seq",
"cabs.ngl",
"cabs.lt",
"cabs.nge",
"cabs.le",
"cabs.ngt",
};
enum { BINOP, CMPOP, OTHEROP } optype = OTHEROP;
uint32_t func = ctx->opcode & 0x3f;
switch (op1) {
case OPC_ADD_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_add_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "add.s";
optype = BINOP;
break;
case OPC_SUB_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_sub_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "sub.s";
optype = BINOP;
break;
case OPC_MUL_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_mul_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "mul.s";
optype = BINOP;
break;
case OPC_DIV_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_div_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "div.s";
optype = BINOP;
break;
case OPC_SQRT_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_sqrt_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "sqrt.s";
break;
case OPC_ABS_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_abs_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "abs.s";
break;
case OPC_MOV_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "mov.s";
break;
case OPC_NEG_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_chs_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "neg.s";
break;
case OPC_ROUND_L_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_roundl_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "round.l.s";
break;
case OPC_TRUNC_L_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_truncl_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "trunc.l.s";
break;
case OPC_CEIL_L_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_ceill_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "ceil.l.s";
break;
case OPC_FLOOR_L_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_floorl_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "floor.l.s";
break;
case OPC_ROUND_W_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_roundw_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "round.w.s";
break;
case OPC_TRUNC_W_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_truncw_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "trunc.w.s";
break;
case OPC_CEIL_W_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_ceilw_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "ceil.w.s";
break;
case OPC_FLOOR_W_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_floorw_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "floor.w.s";
break;
case OPC_MOVCF_S:
gen_movcf_s(fs, fd, (ft >> 2) & 0x7, ft & 0x1);
opn = "movcf.s";
break;
case OPC_MOVZ_S:
{
int l1 = gen_new_label();
TCGv_i32 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[ft], 0, l1);
}
fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
gen_set_label(l1);
}
opn = "movz.s";
break;
case OPC_MOVN_S:
{
int l1 = gen_new_label();
TCGv_i32 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[ft], 0, l1);
fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
gen_set_label(l1);
}
}
opn = "movn.s";
break;
case OPC_RECIP_S:
check_cop1x(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_recip_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "recip.s";
break;
case OPC_RSQRT_S:
check_cop1x(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_rsqrt_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "rsqrt.s";
break;
case OPC_RECIP2_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_recip2_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "recip2.s";
break;
case OPC_RECIP1_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_recip1_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "recip1.s";
break;
case OPC_RSQRT1_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_rsqrt1_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "rsqrt1.s";
break;
case OPC_RSQRT2_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_rsqrt2_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "rsqrt2.s";
break;
case OPC_CVT_D_S:
check_cp1_registers(ctx, fd);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_cvtd_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "cvt.d.s";
break;
case OPC_CVT_W_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_cvtw_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "cvt.w.s";
break;
case OPC_CVT_L_S:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_cvtl_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "cvt.l.s";
break;
case OPC_CVT_PS_S:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp64 = tcg_temp_new_i64();
TCGv_i32 fp32_0 = tcg_temp_new_i32();
TCGv_i32 fp32_1 = tcg_temp_new_i32();
gen_load_fpr32(fp32_0, fs);
gen_load_fpr32(fp32_1, ft);
tcg_gen_concat_i32_i64(fp64, fp32_1, fp32_0);
tcg_temp_free_i32(fp32_1);
tcg_temp_free_i32(fp32_0);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "cvt.ps.s";
break;
case OPC_CMP_F_S:
case OPC_CMP_UN_S:
case OPC_CMP_EQ_S:
case OPC_CMP_UEQ_S:
case OPC_CMP_OLT_S:
case OPC_CMP_ULT_S:
case OPC_CMP_OLE_S:
case OPC_CMP_ULE_S:
case OPC_CMP_SF_S:
case OPC_CMP_NGLE_S:
case OPC_CMP_SEQ_S:
case OPC_CMP_NGL_S:
case OPC_CMP_LT_S:
case OPC_CMP_NGE_S:
case OPC_CMP_LE_S:
case OPC_CMP_NGT_S:
if (ctx->opcode & (1 << 6)) {
gen_cmpabs_s(ctx, func-48, ft, fs, cc);
opn = condnames_abs[func-48];
} else {
gen_cmp_s(ctx, func-48, ft, fs, cc);
opn = condnames[func-48];
}
break;
case OPC_ADD_D:
check_cp1_registers(ctx, fs | ft | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_add_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "add.d";
optype = BINOP;
break;
case OPC_SUB_D:
check_cp1_registers(ctx, fs | ft | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_sub_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "sub.d";
optype = BINOP;
break;
case OPC_MUL_D:
check_cp1_registers(ctx, fs | ft | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_mul_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mul.d";
optype = BINOP;
break;
case OPC_DIV_D:
check_cp1_registers(ctx, fs | ft | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_div_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "div.d";
optype = BINOP;
break;
case OPC_SQRT_D:
check_cp1_registers(ctx, fs | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_sqrt_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "sqrt.d";
break;
case OPC_ABS_D:
check_cp1_registers(ctx, fs | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_abs_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "abs.d";
break;
case OPC_MOV_D:
check_cp1_registers(ctx, fs | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mov.d";
break;
case OPC_NEG_D:
check_cp1_registers(ctx, fs | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_chs_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "neg.d";
break;
case OPC_ROUND_L_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_roundl_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "round.l.d";
break;
case OPC_TRUNC_L_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_truncl_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "trunc.l.d";
break;
case OPC_CEIL_L_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_ceill_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "ceil.l.d";
break;
case OPC_FLOOR_L_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_floorl_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "floor.l.d";
break;
case OPC_ROUND_W_D:
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_roundw_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "round.w.d";
break;
case OPC_TRUNC_W_D:
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_truncw_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "trunc.w.d";
break;
case OPC_CEIL_W_D:
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_ceilw_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "ceil.w.d";
break;
case OPC_FLOOR_W_D:
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_floorw_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "floor.w.d";
break;
case OPC_MOVCF_D:
gen_movcf_d(ctx, fs, fd, (ft >> 2) & 0x7, ft & 0x1);
opn = "movcf.d";
break;
case OPC_MOVZ_D:
{
int l1 = gen_new_label();
TCGv_i64 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[ft], 0, l1);
}
fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
gen_set_label(l1);
}
opn = "movz.d";
break;
case OPC_MOVN_D:
{
int l1 = gen_new_label();
TCGv_i64 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[ft], 0, l1);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
gen_set_label(l1);
}
}
opn = "movn.d";
break;
case OPC_RECIP_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_recip_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip.d";
break;
case OPC_RSQRT_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_rsqrt_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt.d";
break;
case OPC_RECIP2_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_recip2_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip2.d";
break;
case OPC_RECIP1_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_recip1_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip1.d";
break;
case OPC_RSQRT1_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_rsqrt1_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt1.d";
break;
case OPC_RSQRT2_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_rsqrt2_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt2.d";
break;
case OPC_CMP_F_D:
case OPC_CMP_UN_D:
case OPC_CMP_EQ_D:
case OPC_CMP_UEQ_D:
case OPC_CMP_OLT_D:
case OPC_CMP_ULT_D:
case OPC_CMP_OLE_D:
case OPC_CMP_ULE_D:
case OPC_CMP_SF_D:
case OPC_CMP_NGLE_D:
case OPC_CMP_SEQ_D:
case OPC_CMP_NGL_D:
case OPC_CMP_LT_D:
case OPC_CMP_NGE_D:
case OPC_CMP_LE_D:
case OPC_CMP_NGT_D:
if (ctx->opcode & (1 << 6)) {
gen_cmpabs_d(ctx, func-48, ft, fs, cc);
opn = condnames_abs[func-48];
} else {
gen_cmp_d(ctx, func-48, ft, fs, cc);
opn = condnames[func-48];
}
break;
case OPC_CVT_S_D:
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_cvts_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "cvt.s.d";
break;
case OPC_CVT_W_D:
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_cvtw_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "cvt.w.d";
break;
case OPC_CVT_L_D:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_cvtl_d(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "cvt.l.d";
break;
case OPC_CVT_S_W:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_cvts_w(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "cvt.s.w";
break;
case OPC_CVT_D_W:
check_cp1_registers(ctx, fd);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_cvtd_w(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "cvt.d.w";
break;
case OPC_CVT_S_L:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_cvts_l(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "cvt.s.l";
break;
case OPC_CVT_D_L:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_cvtd_l(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "cvt.d.l";
break;
case OPC_CVT_PS_PW:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_cvtps_pw(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "cvt.ps.pw";
break;
case OPC_ADD_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_add_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "add.ps";
break;
case OPC_SUB_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_sub_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "sub.ps";
break;
case OPC_MUL_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_mul_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mul.ps";
break;
case OPC_ABS_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_abs_ps(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "abs.ps";
break;
case OPC_MOV_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mov.ps";
break;
case OPC_NEG_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_chs_ps(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "neg.ps";
break;
case OPC_MOVCF_PS:
check_cp1_64bitmode(ctx);
gen_movcf_ps(fs, fd, (ft >> 2) & 0x7, ft & 0x1);
opn = "movcf.ps";
break;
case OPC_MOVZ_PS:
check_cp1_64bitmode(ctx);
{
int l1 = gen_new_label();
TCGv_i64 fp0;
if (ft != 0)
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[ft], 0, l1);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
gen_set_label(l1);
}
opn = "movz.ps";
break;
case OPC_MOVN_PS:
check_cp1_64bitmode(ctx);
{
int l1 = gen_new_label();
TCGv_i64 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[ft], 0, l1);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
gen_set_label(l1);
}
}
opn = "movn.ps";
break;
case OPC_ADDR_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, ft);
gen_load_fpr64(ctx, fp1, fs);
gen_helper_float_addr_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "addr.ps";
break;
case OPC_MULR_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, ft);
gen_load_fpr64(ctx, fp1, fs);
gen_helper_float_mulr_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mulr.ps";
break;
case OPC_RECIP2_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_recip2_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip2.ps";
break;
case OPC_RECIP1_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_recip1_ps(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip1.ps";
break;
case OPC_RSQRT1_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_rsqrt1_ps(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt1.ps";
break;
case OPC_RSQRT2_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_rsqrt2_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt2.ps";
break;
case OPC_CVT_S_PU:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, fs);
gen_helper_float_cvts_pu(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "cvt.s.pu";
break;
case OPC_CVT_PW_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_cvtpw_ps(fp0, cpu_env, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "cvt.pw.ps";
break;
case OPC_CVT_S_PL:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_cvts_pl(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "cvt.s.pl";
break;
case OPC_PLL_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_store_fpr32h(fp0, fd);
gen_store_fpr32(fp1, fd);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
opn = "pll.ps";
break;
case OPC_PLU_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32h(fp1, ft);
gen_store_fpr32(fp1, fd);
gen_store_fpr32h(fp0, fd);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
opn = "plu.ps";
break;
case OPC_PUL_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_store_fpr32(fp1, fd);
gen_store_fpr32h(fp0, fd);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
opn = "pul.ps";
break;
case OPC_PUU_PS:
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, fs);
gen_load_fpr32h(fp1, ft);
gen_store_fpr32(fp1, fd);
gen_store_fpr32h(fp0, fd);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
opn = "puu.ps";
break;
case OPC_CMP_F_PS:
case OPC_CMP_UN_PS:
case OPC_CMP_EQ_PS:
case OPC_CMP_UEQ_PS:
case OPC_CMP_OLT_PS:
case OPC_CMP_ULT_PS:
case OPC_CMP_OLE_PS:
case OPC_CMP_ULE_PS:
case OPC_CMP_SF_PS:
case OPC_CMP_NGLE_PS:
case OPC_CMP_SEQ_PS:
case OPC_CMP_NGL_PS:
case OPC_CMP_LT_PS:
case OPC_CMP_NGE_PS:
case OPC_CMP_LE_PS:
case OPC_CMP_NGT_PS:
if (ctx->opcode & (1 << 6)) {
gen_cmpabs_ps(ctx, func-48, ft, fs, cc);
opn = condnames_abs[func-48];
} else {
gen_cmp_ps(ctx, func-48, ft, fs, cc);
opn = condnames[func-48];
}
break;
default:
MIPS_INVAL(opn);
generate_exception (ctx, EXCP_RI);
return;
}
(void)opn;
switch (optype) {
case BINOP:
MIPS_DEBUG("%s %s, %s, %s", opn, fregnames[fd], fregnames[fs], fregnames[ft]);
break;
case CMPOP:
MIPS_DEBUG("%s %s,%s", opn, fregnames[fs], fregnames[ft]);
break;
default:
MIPS_DEBUG("%s %s,%s", opn, fregnames[fd], fregnames[fs]);
break;
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0 (DisasContext *VAR_0, enum fopcode VAR_1,
int VAR_2, int VAR_3, int VAR_4, int VAR_5)
{
const char *VAR_6 = "farith";
const char *VAR_7[] = {
"c.f",
"c.un",
"c.eq",
"c.ueq",
"c.olt",
"c.ult",
"c.ole",
"c.ule",
"c.sf",
"c.ngle",
"c.seq",
"c.ngl",
"c.lt",
"c.nge",
"c.le",
"c.ngt",
};
const char *VAR_8[] = {
"cabs.f",
"cabs.un",
"cabs.eq",
"cabs.ueq",
"cabs.olt",
"cabs.ult",
"cabs.ole",
"cabs.ule",
"cabs.sf",
"cabs.ngle",
"cabs.seq",
"cabs.ngl",
"cabs.lt",
"cabs.nge",
"cabs.le",
"cabs.ngt",
};
enum { BINOP, CMPOP, OTHEROP } VAR_9 = OTHEROP;
uint32_t func = VAR_0->opcode & 0x3f;
switch (VAR_1) {
case OPC_ADD_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_load_fpr32(fp1, VAR_2);
gen_helper_float_add_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "add.s";
VAR_9 = BINOP;
break;
case OPC_SUB_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_load_fpr32(fp1, VAR_2);
gen_helper_float_sub_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "sub.s";
VAR_9 = BINOP;
break;
case OPC_MUL_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_load_fpr32(fp1, VAR_2);
gen_helper_float_mul_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "mul.s";
VAR_9 = BINOP;
break;
case OPC_DIV_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_load_fpr32(fp1, VAR_2);
gen_helper_float_div_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "div.s";
VAR_9 = BINOP;
break;
case OPC_SQRT_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_sqrt_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "sqrt.s";
break;
case OPC_ABS_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_abs_s(fp0, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "abs.s";
break;
case OPC_MOV_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "mov.s";
break;
case OPC_NEG_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_chs_s(fp0, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "neg.s";
break;
case OPC_ROUND_L_S:
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, VAR_3);
gen_helper_float_roundl_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(VAR_0, fp64, VAR_4);
tcg_temp_free_i64(fp64);
}
VAR_6 = "round.l.s";
break;
case OPC_TRUNC_L_S:
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, VAR_3);
gen_helper_float_truncl_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(VAR_0, fp64, VAR_4);
tcg_temp_free_i64(fp64);
}
VAR_6 = "trunc.l.s";
break;
case OPC_CEIL_L_S:
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, VAR_3);
gen_helper_float_ceill_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(VAR_0, fp64, VAR_4);
tcg_temp_free_i64(fp64);
}
VAR_6 = "ceil.l.s";
break;
case OPC_FLOOR_L_S:
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, VAR_3);
gen_helper_float_floorl_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(VAR_0, fp64, VAR_4);
tcg_temp_free_i64(fp64);
}
VAR_6 = "floor.l.s";
break;
case OPC_ROUND_W_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_roundw_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "round.w.s";
break;
case OPC_TRUNC_W_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_truncw_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "trunc.w.s";
break;
case OPC_CEIL_W_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_ceilw_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "ceil.w.s";
break;
case OPC_FLOOR_W_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_floorw_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "floor.w.s";
break;
case OPC_MOVCF_S:
gen_movcf_s(VAR_3, VAR_4, (VAR_2 >> 2) & 0x7, VAR_2 & 0x1);
VAR_6 = "movcf.s";
break;
case OPC_MOVZ_S:
{
int VAR_11 = gen_new_label();
TCGv_i32 fp0;
if (VAR_2 != 0) {
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[VAR_2], 0, VAR_11);
}
fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
gen_set_label(VAR_11);
}
VAR_6 = "movz.s";
break;
case OPC_MOVN_S:
{
int VAR_11 = gen_new_label();
TCGv_i32 fp0;
if (VAR_2 != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[VAR_2], 0, VAR_11);
fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
gen_set_label(VAR_11);
}
}
VAR_6 = "movn.s";
break;
case OPC_RECIP_S:
check_cop1x(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_recip_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "recip.s";
break;
case OPC_RSQRT_S:
check_cop1x(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_rsqrt_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "rsqrt.s";
break;
case OPC_RECIP2_S:
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_load_fpr32(fp1, VAR_2);
gen_helper_float_recip2_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "recip2.s";
break;
case OPC_RECIP1_S:
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_recip1_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "recip1.s";
break;
case OPC_RSQRT1_S:
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_rsqrt1_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "rsqrt1.s";
break;
case OPC_RSQRT2_S:
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_load_fpr32(fp1, VAR_2);
gen_helper_float_rsqrt2_s(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "rsqrt2.s";
break;
case OPC_CVT_D_S:
check_cp1_registers(VAR_0, VAR_4);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, VAR_3);
gen_helper_float_cvtd_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(VAR_0, fp64, VAR_4);
tcg_temp_free_i64(fp64);
}
VAR_6 = "cvt.d.s";
break;
case OPC_CVT_W_S:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_cvtw_s(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "cvt.w.s";
break;
case OPC_CVT_L_S:
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, VAR_3);
gen_helper_float_cvtl_s(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(VAR_0, fp64, VAR_4);
tcg_temp_free_i64(fp64);
}
VAR_6 = "cvt.l.s";
break;
case OPC_CVT_PS_S:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp64 = tcg_temp_new_i64();
TCGv_i32 fp32_0 = tcg_temp_new_i32();
TCGv_i32 fp32_1 = tcg_temp_new_i32();
gen_load_fpr32(fp32_0, VAR_3);
gen_load_fpr32(fp32_1, VAR_2);
tcg_gen_concat_i32_i64(fp64, fp32_1, fp32_0);
tcg_temp_free_i32(fp32_1);
tcg_temp_free_i32(fp32_0);
gen_store_fpr64(VAR_0, fp64, VAR_4);
tcg_temp_free_i64(fp64);
}
VAR_6 = "cvt.ps.s";
break;
case OPC_CMP_F_S:
case OPC_CMP_UN_S:
case OPC_CMP_EQ_S:
case OPC_CMP_UEQ_S:
case OPC_CMP_OLT_S:
case OPC_CMP_ULT_S:
case OPC_CMP_OLE_S:
case OPC_CMP_ULE_S:
case OPC_CMP_SF_S:
case OPC_CMP_NGLE_S:
case OPC_CMP_SEQ_S:
case OPC_CMP_NGL_S:
case OPC_CMP_LT_S:
case OPC_CMP_NGE_S:
case OPC_CMP_LE_S:
case OPC_CMP_NGT_S:
if (VAR_0->opcode & (1 << 6)) {
gen_cmpabs_s(VAR_0, func-48, VAR_2, VAR_3, VAR_5);
VAR_6 = VAR_8[func-48];
} else {
gen_cmp_s(VAR_0, func-48, VAR_2, VAR_3, VAR_5);
VAR_6 = VAR_7[func-48];
}
break;
case OPC_ADD_D:
check_cp1_registers(VAR_0, VAR_3 | VAR_2 | VAR_4);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_add_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "add.d";
VAR_9 = BINOP;
break;
case OPC_SUB_D:
check_cp1_registers(VAR_0, VAR_3 | VAR_2 | VAR_4);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_sub_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "sub.d";
VAR_9 = BINOP;
break;
case OPC_MUL_D:
check_cp1_registers(VAR_0, VAR_3 | VAR_2 | VAR_4);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_mul_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "mul.d";
VAR_9 = BINOP;
break;
case OPC_DIV_D:
check_cp1_registers(VAR_0, VAR_3 | VAR_2 | VAR_4);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_div_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "div.d";
VAR_9 = BINOP;
break;
case OPC_SQRT_D:
check_cp1_registers(VAR_0, VAR_3 | VAR_4);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_sqrt_d(fp0, cpu_env, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "sqrt.d";
break;
case OPC_ABS_D:
check_cp1_registers(VAR_0, VAR_3 | VAR_4);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_abs_d(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "abs.d";
break;
case OPC_MOV_D:
check_cp1_registers(VAR_0, VAR_3 | VAR_4);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "mov.d";
break;
case OPC_NEG_D:
check_cp1_registers(VAR_0, VAR_3 | VAR_4);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_chs_d(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "neg.d";
break;
case OPC_ROUND_L_D:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_roundl_d(fp0, cpu_env, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "round.l.d";
break;
case OPC_TRUNC_L_D:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_truncl_d(fp0, cpu_env, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "trunc.l.d";
break;
case OPC_CEIL_L_D:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_ceill_d(fp0, cpu_env, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "ceil.l.d";
break;
case OPC_FLOOR_L_D:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_floorl_d(fp0, cpu_env, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "floor.l.d";
break;
case OPC_ROUND_W_D:
check_cp1_registers(VAR_0, VAR_3);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp64, VAR_3);
gen_helper_float_roundw_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, VAR_4);
tcg_temp_free_i32(fp32);
}
VAR_6 = "round.w.d";
break;
case OPC_TRUNC_W_D:
check_cp1_registers(VAR_0, VAR_3);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp64, VAR_3);
gen_helper_float_truncw_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, VAR_4);
tcg_temp_free_i32(fp32);
}
VAR_6 = "trunc.w.d";
break;
case OPC_CEIL_W_D:
check_cp1_registers(VAR_0, VAR_3);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp64, VAR_3);
gen_helper_float_ceilw_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, VAR_4);
tcg_temp_free_i32(fp32);
}
VAR_6 = "ceil.w.d";
break;
case OPC_FLOOR_W_D:
check_cp1_registers(VAR_0, VAR_3);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp64, VAR_3);
gen_helper_float_floorw_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, VAR_4);
tcg_temp_free_i32(fp32);
}
VAR_6 = "floor.w.d";
break;
case OPC_MOVCF_D:
gen_movcf_d(VAR_0, VAR_3, VAR_4, (VAR_2 >> 2) & 0x7, VAR_2 & 0x1);
VAR_6 = "movcf.d";
break;
case OPC_MOVZ_D:
{
int VAR_11 = gen_new_label();
TCGv_i64 fp0;
if (VAR_2 != 0) {
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[VAR_2], 0, VAR_11);
}
fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
gen_set_label(VAR_11);
}
VAR_6 = "movz.d";
break;
case OPC_MOVN_D:
{
int VAR_11 = gen_new_label();
TCGv_i64 fp0;
if (VAR_2 != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[VAR_2], 0, VAR_11);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
gen_set_label(VAR_11);
}
}
VAR_6 = "movn.d";
break;
case OPC_RECIP_D:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_recip_d(fp0, cpu_env, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "recip.d";
break;
case OPC_RSQRT_D:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_rsqrt_d(fp0, cpu_env, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "rsqrt.d";
break;
case OPC_RECIP2_D:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_recip2_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "recip2.d";
break;
case OPC_RECIP1_D:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_recip1_d(fp0, cpu_env, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "recip1.d";
break;
case OPC_RSQRT1_D:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_rsqrt1_d(fp0, cpu_env, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "rsqrt1.d";
break;
case OPC_RSQRT2_D:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_rsqrt2_d(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "rsqrt2.d";
break;
case OPC_CMP_F_D:
case OPC_CMP_UN_D:
case OPC_CMP_EQ_D:
case OPC_CMP_UEQ_D:
case OPC_CMP_OLT_D:
case OPC_CMP_ULT_D:
case OPC_CMP_OLE_D:
case OPC_CMP_ULE_D:
case OPC_CMP_SF_D:
case OPC_CMP_NGLE_D:
case OPC_CMP_SEQ_D:
case OPC_CMP_NGL_D:
case OPC_CMP_LT_D:
case OPC_CMP_NGE_D:
case OPC_CMP_LE_D:
case OPC_CMP_NGT_D:
if (VAR_0->opcode & (1 << 6)) {
gen_cmpabs_d(VAR_0, func-48, VAR_2, VAR_3, VAR_5);
VAR_6 = VAR_8[func-48];
} else {
gen_cmp_d(VAR_0, func-48, VAR_2, VAR_3, VAR_5);
VAR_6 = VAR_7[func-48];
}
break;
case OPC_CVT_S_D:
check_cp1_registers(VAR_0, VAR_3);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp64, VAR_3);
gen_helper_float_cvts_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, VAR_4);
tcg_temp_free_i32(fp32);
}
VAR_6 = "cvt.s.d";
break;
case OPC_CVT_W_D:
check_cp1_registers(VAR_0, VAR_3);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp64, VAR_3);
gen_helper_float_cvtw_d(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, VAR_4);
tcg_temp_free_i32(fp32);
}
VAR_6 = "cvt.w.d";
break;
case OPC_CVT_L_D:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_cvtl_d(fp0, cpu_env, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "cvt.l.d";
break;
case OPC_CVT_S_W:
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_cvts_w(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "cvt.s.w";
break;
case OPC_CVT_D_W:
check_cp1_registers(VAR_0, VAR_4);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, VAR_3);
gen_helper_float_cvtd_w(fp64, cpu_env, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(VAR_0, fp64, VAR_4);
tcg_temp_free_i64(fp64);
}
VAR_6 = "cvt.d.w";
break;
case OPC_CVT_S_L:
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp64, VAR_3);
gen_helper_float_cvts_l(fp32, cpu_env, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, VAR_4);
tcg_temp_free_i32(fp32);
}
VAR_6 = "cvt.s.l";
break;
case OPC_CVT_D_L:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_cvtd_l(fp0, cpu_env, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "cvt.d.l";
break;
case OPC_CVT_PS_PW:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_cvtps_pw(fp0, cpu_env, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "cvt.ps.pw";
break;
case OPC_ADD_PS:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_add_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "add.ps";
break;
case OPC_SUB_PS:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_sub_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "sub.ps";
break;
case OPC_MUL_PS:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_mul_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "mul.ps";
break;
case OPC_ABS_PS:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_abs_ps(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "abs.ps";
break;
case OPC_MOV_PS:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "mov.ps";
break;
case OPC_NEG_PS:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_chs_ps(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "neg.ps";
break;
case OPC_MOVCF_PS:
check_cp1_64bitmode(VAR_0);
gen_movcf_ps(VAR_3, VAR_4, (VAR_2 >> 2) & 0x7, VAR_2 & 0x1);
VAR_6 = "movcf.ps";
break;
case OPC_MOVZ_PS:
check_cp1_64bitmode(VAR_0);
{
int VAR_11 = gen_new_label();
TCGv_i64 fp0;
if (VAR_2 != 0)
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[VAR_2], 0, VAR_11);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
gen_set_label(VAR_11);
}
VAR_6 = "movz.ps";
break;
case OPC_MOVN_PS:
check_cp1_64bitmode(VAR_0);
{
int VAR_11 = gen_new_label();
TCGv_i64 fp0;
if (VAR_2 != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[VAR_2], 0, VAR_11);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
gen_set_label(VAR_11);
}
}
VAR_6 = "movn.ps";
break;
case OPC_ADDR_PS:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_2);
gen_load_fpr64(VAR_0, fp1, VAR_3);
gen_helper_float_addr_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "addr.ps";
break;
case OPC_MULR_PS:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_2);
gen_load_fpr64(VAR_0, fp1, VAR_3);
gen_helper_float_mulr_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "mulr.ps";
break;
case OPC_RECIP2_PS:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_recip2_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "recip2.ps";
break;
case OPC_RECIP1_PS:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_recip1_ps(fp0, cpu_env, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "recip1.ps";
break;
case OPC_RSQRT1_PS:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_rsqrt1_ps(fp0, cpu_env, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "rsqrt1.ps";
break;
case OPC_RSQRT2_PS:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_rsqrt2_ps(fp0, cpu_env, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "rsqrt2.ps";
break;
case OPC_CVT_S_PU:
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, VAR_3);
gen_helper_float_cvts_pu(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "cvt.s.pu";
break;
case OPC_CVT_PW_PS:
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_cvtpw_ps(fp0, cpu_env, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "cvt.pw.ps";
break;
case OPC_CVT_S_PL:
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_cvts_pl(fp0, cpu_env, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "cvt.s.pl";
break;
case OPC_PLL_PS:
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_load_fpr32(fp1, VAR_2);
gen_store_fpr32h(fp0, VAR_4);
gen_store_fpr32(fp1, VAR_4);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
VAR_6 = "pll.ps";
break;
case OPC_PLU_PS:
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_load_fpr32h(fp1, VAR_2);
gen_store_fpr32(fp1, VAR_4);
gen_store_fpr32h(fp0, VAR_4);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
VAR_6 = "plu.ps";
break;
case OPC_PUL_PS:
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, VAR_3);
gen_load_fpr32(fp1, VAR_2);
gen_store_fpr32(fp1, VAR_4);
gen_store_fpr32h(fp0, VAR_4);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
VAR_6 = "pul.ps";
break;
case OPC_PUU_PS:
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, VAR_3);
gen_load_fpr32h(fp1, VAR_2);
gen_store_fpr32(fp1, VAR_4);
gen_store_fpr32h(fp0, VAR_4);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
VAR_6 = "puu.ps";
break;
case OPC_CMP_F_PS:
case OPC_CMP_UN_PS:
case OPC_CMP_EQ_PS:
case OPC_CMP_UEQ_PS:
case OPC_CMP_OLT_PS:
case OPC_CMP_ULT_PS:
case OPC_CMP_OLE_PS:
case OPC_CMP_ULE_PS:
case OPC_CMP_SF_PS:
case OPC_CMP_NGLE_PS:
case OPC_CMP_SEQ_PS:
case OPC_CMP_NGL_PS:
case OPC_CMP_LT_PS:
case OPC_CMP_NGE_PS:
case OPC_CMP_LE_PS:
case OPC_CMP_NGT_PS:
if (VAR_0->opcode & (1 << 6)) {
gen_cmpabs_ps(VAR_0, func-48, VAR_2, VAR_3, VAR_5);
VAR_6 = VAR_8[func-48];
} else {
gen_cmp_ps(VAR_0, func-48, VAR_2, VAR_3, VAR_5);
VAR_6 = VAR_7[func-48];
}
break;
default:
MIPS_INVAL(VAR_6);
generate_exception (VAR_0, EXCP_RI);
return;
}
(void)VAR_6;
switch (VAR_9) {
case BINOP:
MIPS_DEBUG("%s %s, %s, %s", VAR_6, fregnames[VAR_4], fregnames[VAR_3], fregnames[VAR_2]);
break;
case CMPOP:
MIPS_DEBUG("%s %s,%s", VAR_6, fregnames[VAR_3], fregnames[VAR_2]);
break;
default:
MIPS_DEBUG("%s %s,%s", VAR_6, fregnames[VAR_4], fregnames[VAR_3]);
break;
}
}
| [
"static void FUNC_0 (DisasContext *VAR_0, enum fopcode VAR_1,\nint VAR_2, int VAR_3, int VAR_4, int VAR_5)\n{",
"const char *VAR_6 = \"farith\";",
"const char *VAR_7[] = {",
"\"c.f\",\n\"c.un\",\n\"c.eq\",\n\"c.ueq\",\n\"c.olt\",\n\"c.ult\",\n\"c.ole\",\n\"c.ule\",\n\"c.sf\",\n\"c.ngle\",\n\"c.seq\",\n\"c.ngl\",\n\"c.lt\",\n\"c.nge\",\n\"c.le\",\n\"c.ngt\",\n};",
"const char *VAR_8[] = {",
"\"cabs.f\",\n\"cabs.un\",\n\"cabs.eq\",\n\"cabs.ueq\",\n\"cabs.olt\",\n\"cabs.ult\",\n\"cabs.ole\",\n\"cabs.ule\",\n\"cabs.sf\",\n\"cabs.ngle\",\n\"cabs.seq\",\n\"cabs.ngl\",\n\"cabs.lt\",\n\"cabs.nge\",\n\"cabs.le\",\n\"cabs.ngt\",\n};",
"enum { BINOP, CMPOP, OTHEROP } VAR_9 = OTHEROP;",
"uint32_t func = VAR_0->opcode & 0x3f;",
"switch (VAR_1) {",
"case OPC_ADD_S:\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_load_fpr32(fp1, VAR_2);",
"gen_helper_float_add_s(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i32(fp1);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"add.s\";",
"VAR_9 = BINOP;",
"break;",
"case OPC_SUB_S:\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_load_fpr32(fp1, VAR_2);",
"gen_helper_float_sub_s(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i32(fp1);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"sub.s\";",
"VAR_9 = BINOP;",
"break;",
"case OPC_MUL_S:\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_load_fpr32(fp1, VAR_2);",
"gen_helper_float_mul_s(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i32(fp1);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"mul.s\";",
"VAR_9 = BINOP;",
"break;",
"case OPC_DIV_S:\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_load_fpr32(fp1, VAR_2);",
"gen_helper_float_div_s(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i32(fp1);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"div.s\";",
"VAR_9 = BINOP;",
"break;",
"case OPC_SQRT_S:\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_sqrt_s(fp0, cpu_env, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"sqrt.s\";",
"break;",
"case OPC_ABS_S:\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_abs_s(fp0, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"abs.s\";",
"break;",
"case OPC_MOV_S:\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"mov.s\";",
"break;",
"case OPC_NEG_S:\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_chs_s(fp0, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"neg.s\";",
"break;",
"case OPC_ROUND_L_S:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr32(fp32, VAR_3);",
"gen_helper_float_roundl_s(fp64, cpu_env, fp32);",
"tcg_temp_free_i32(fp32);",
"gen_store_fpr64(VAR_0, fp64, VAR_4);",
"tcg_temp_free_i64(fp64);",
"}",
"VAR_6 = \"round.l.s\";",
"break;",
"case OPC_TRUNC_L_S:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr32(fp32, VAR_3);",
"gen_helper_float_truncl_s(fp64, cpu_env, fp32);",
"tcg_temp_free_i32(fp32);",
"gen_store_fpr64(VAR_0, fp64, VAR_4);",
"tcg_temp_free_i64(fp64);",
"}",
"VAR_6 = \"trunc.l.s\";",
"break;",
"case OPC_CEIL_L_S:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr32(fp32, VAR_3);",
"gen_helper_float_ceill_s(fp64, cpu_env, fp32);",
"tcg_temp_free_i32(fp32);",
"gen_store_fpr64(VAR_0, fp64, VAR_4);",
"tcg_temp_free_i64(fp64);",
"}",
"VAR_6 = \"ceil.l.s\";",
"break;",
"case OPC_FLOOR_L_S:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr32(fp32, VAR_3);",
"gen_helper_float_floorl_s(fp64, cpu_env, fp32);",
"tcg_temp_free_i32(fp32);",
"gen_store_fpr64(VAR_0, fp64, VAR_4);",
"tcg_temp_free_i64(fp64);",
"}",
"VAR_6 = \"floor.l.s\";",
"break;",
"case OPC_ROUND_W_S:\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_roundw_s(fp0, cpu_env, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"round.w.s\";",
"break;",
"case OPC_TRUNC_W_S:\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_truncw_s(fp0, cpu_env, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"trunc.w.s\";",
"break;",
"case OPC_CEIL_W_S:\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_ceilw_s(fp0, cpu_env, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"ceil.w.s\";",
"break;",
"case OPC_FLOOR_W_S:\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_floorw_s(fp0, cpu_env, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"floor.w.s\";",
"break;",
"case OPC_MOVCF_S:\ngen_movcf_s(VAR_3, VAR_4, (VAR_2 >> 2) & 0x7, VAR_2 & 0x1);",
"VAR_6 = \"movcf.s\";",
"break;",
"case OPC_MOVZ_S:\n{",
"int VAR_11 = gen_new_label();",
"TCGv_i32 fp0;",
"if (VAR_2 != 0) {",
"tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[VAR_2], 0, VAR_11);",
"}",
"fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"gen_set_label(VAR_11);",
"}",
"VAR_6 = \"movz.s\";",
"break;",
"case OPC_MOVN_S:\n{",
"int VAR_11 = gen_new_label();",
"TCGv_i32 fp0;",
"if (VAR_2 != 0) {",
"tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[VAR_2], 0, VAR_11);",
"fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"gen_set_label(VAR_11);",
"}",
"}",
"VAR_6 = \"movn.s\";",
"break;",
"case OPC_RECIP_S:\ncheck_cop1x(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_recip_s(fp0, cpu_env, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"recip.s\";",
"break;",
"case OPC_RSQRT_S:\ncheck_cop1x(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_rsqrt_s(fp0, cpu_env, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"rsqrt.s\";",
"break;",
"case OPC_RECIP2_S:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_load_fpr32(fp1, VAR_2);",
"gen_helper_float_recip2_s(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i32(fp1);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"recip2.s\";",
"break;",
"case OPC_RECIP1_S:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_recip1_s(fp0, cpu_env, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"recip1.s\";",
"break;",
"case OPC_RSQRT1_S:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_rsqrt1_s(fp0, cpu_env, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"rsqrt1.s\";",
"break;",
"case OPC_RSQRT2_S:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_load_fpr32(fp1, VAR_2);",
"gen_helper_float_rsqrt2_s(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i32(fp1);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"rsqrt2.s\";",
"break;",
"case OPC_CVT_D_S:\ncheck_cp1_registers(VAR_0, VAR_4);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr32(fp32, VAR_3);",
"gen_helper_float_cvtd_s(fp64, cpu_env, fp32);",
"tcg_temp_free_i32(fp32);",
"gen_store_fpr64(VAR_0, fp64, VAR_4);",
"tcg_temp_free_i64(fp64);",
"}",
"VAR_6 = \"cvt.d.s\";",
"break;",
"case OPC_CVT_W_S:\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_cvtw_s(fp0, cpu_env, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"cvt.w.s\";",
"break;",
"case OPC_CVT_L_S:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr32(fp32, VAR_3);",
"gen_helper_float_cvtl_s(fp64, cpu_env, fp32);",
"tcg_temp_free_i32(fp32);",
"gen_store_fpr64(VAR_0, fp64, VAR_4);",
"tcg_temp_free_i64(fp64);",
"}",
"VAR_6 = \"cvt.l.s\";",
"break;",
"case OPC_CVT_PS_S:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"TCGv_i32 fp32_0 = tcg_temp_new_i32();",
"TCGv_i32 fp32_1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp32_0, VAR_3);",
"gen_load_fpr32(fp32_1, VAR_2);",
"tcg_gen_concat_i32_i64(fp64, fp32_1, fp32_0);",
"tcg_temp_free_i32(fp32_1);",
"tcg_temp_free_i32(fp32_0);",
"gen_store_fpr64(VAR_0, fp64, VAR_4);",
"tcg_temp_free_i64(fp64);",
"}",
"VAR_6 = \"cvt.ps.s\";",
"break;",
"case OPC_CMP_F_S:\ncase OPC_CMP_UN_S:\ncase OPC_CMP_EQ_S:\ncase OPC_CMP_UEQ_S:\ncase OPC_CMP_OLT_S:\ncase OPC_CMP_ULT_S:\ncase OPC_CMP_OLE_S:\ncase OPC_CMP_ULE_S:\ncase OPC_CMP_SF_S:\ncase OPC_CMP_NGLE_S:\ncase OPC_CMP_SEQ_S:\ncase OPC_CMP_NGL_S:\ncase OPC_CMP_LT_S:\ncase OPC_CMP_NGE_S:\ncase OPC_CMP_LE_S:\ncase OPC_CMP_NGT_S:\nif (VAR_0->opcode & (1 << 6)) {",
"gen_cmpabs_s(VAR_0, func-48, VAR_2, VAR_3, VAR_5);",
"VAR_6 = VAR_8[func-48];",
"} else {",
"gen_cmp_s(VAR_0, func-48, VAR_2, VAR_3, VAR_5);",
"VAR_6 = VAR_7[func-48];",
"}",
"break;",
"case OPC_ADD_D:\ncheck_cp1_registers(VAR_0, VAR_3 | VAR_2 | VAR_4);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_add_d(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"add.d\";",
"VAR_9 = BINOP;",
"break;",
"case OPC_SUB_D:\ncheck_cp1_registers(VAR_0, VAR_3 | VAR_2 | VAR_4);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_sub_d(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"sub.d\";",
"VAR_9 = BINOP;",
"break;",
"case OPC_MUL_D:\ncheck_cp1_registers(VAR_0, VAR_3 | VAR_2 | VAR_4);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_mul_d(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"mul.d\";",
"VAR_9 = BINOP;",
"break;",
"case OPC_DIV_D:\ncheck_cp1_registers(VAR_0, VAR_3 | VAR_2 | VAR_4);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_div_d(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"div.d\";",
"VAR_9 = BINOP;",
"break;",
"case OPC_SQRT_D:\ncheck_cp1_registers(VAR_0, VAR_3 | VAR_4);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_sqrt_d(fp0, cpu_env, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"sqrt.d\";",
"break;",
"case OPC_ABS_D:\ncheck_cp1_registers(VAR_0, VAR_3 | VAR_4);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_abs_d(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"abs.d\";",
"break;",
"case OPC_MOV_D:\ncheck_cp1_registers(VAR_0, VAR_3 | VAR_4);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"mov.d\";",
"break;",
"case OPC_NEG_D:\ncheck_cp1_registers(VAR_0, VAR_3 | VAR_4);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_chs_d(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"neg.d\";",
"break;",
"case OPC_ROUND_L_D:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_roundl_d(fp0, cpu_env, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"round.l.d\";",
"break;",
"case OPC_TRUNC_L_D:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_truncl_d(fp0, cpu_env, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"trunc.l.d\";",
"break;",
"case OPC_CEIL_L_D:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_ceill_d(fp0, cpu_env, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"ceil.l.d\";",
"break;",
"case OPC_FLOOR_L_D:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_floorl_d(fp0, cpu_env, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"floor.l.d\";",
"break;",
"case OPC_ROUND_W_D:\ncheck_cp1_registers(VAR_0, VAR_3);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp64, VAR_3);",
"gen_helper_float_roundw_d(fp32, cpu_env, fp64);",
"tcg_temp_free_i64(fp64);",
"gen_store_fpr32(fp32, VAR_4);",
"tcg_temp_free_i32(fp32);",
"}",
"VAR_6 = \"round.w.d\";",
"break;",
"case OPC_TRUNC_W_D:\ncheck_cp1_registers(VAR_0, VAR_3);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp64, VAR_3);",
"gen_helper_float_truncw_d(fp32, cpu_env, fp64);",
"tcg_temp_free_i64(fp64);",
"gen_store_fpr32(fp32, VAR_4);",
"tcg_temp_free_i32(fp32);",
"}",
"VAR_6 = \"trunc.w.d\";",
"break;",
"case OPC_CEIL_W_D:\ncheck_cp1_registers(VAR_0, VAR_3);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp64, VAR_3);",
"gen_helper_float_ceilw_d(fp32, cpu_env, fp64);",
"tcg_temp_free_i64(fp64);",
"gen_store_fpr32(fp32, VAR_4);",
"tcg_temp_free_i32(fp32);",
"}",
"VAR_6 = \"ceil.w.d\";",
"break;",
"case OPC_FLOOR_W_D:\ncheck_cp1_registers(VAR_0, VAR_3);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp64, VAR_3);",
"gen_helper_float_floorw_d(fp32, cpu_env, fp64);",
"tcg_temp_free_i64(fp64);",
"gen_store_fpr32(fp32, VAR_4);",
"tcg_temp_free_i32(fp32);",
"}",
"VAR_6 = \"floor.w.d\";",
"break;",
"case OPC_MOVCF_D:\ngen_movcf_d(VAR_0, VAR_3, VAR_4, (VAR_2 >> 2) & 0x7, VAR_2 & 0x1);",
"VAR_6 = \"movcf.d\";",
"break;",
"case OPC_MOVZ_D:\n{",
"int VAR_11 = gen_new_label();",
"TCGv_i64 fp0;",
"if (VAR_2 != 0) {",
"tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[VAR_2], 0, VAR_11);",
"}",
"fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"gen_set_label(VAR_11);",
"}",
"VAR_6 = \"movz.d\";",
"break;",
"case OPC_MOVN_D:\n{",
"int VAR_11 = gen_new_label();",
"TCGv_i64 fp0;",
"if (VAR_2 != 0) {",
"tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[VAR_2], 0, VAR_11);",
"fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"gen_set_label(VAR_11);",
"}",
"}",
"VAR_6 = \"movn.d\";",
"break;",
"case OPC_RECIP_D:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_recip_d(fp0, cpu_env, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"recip.d\";",
"break;",
"case OPC_RSQRT_D:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_rsqrt_d(fp0, cpu_env, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"rsqrt.d\";",
"break;",
"case OPC_RECIP2_D:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_recip2_d(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"recip2.d\";",
"break;",
"case OPC_RECIP1_D:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_recip1_d(fp0, cpu_env, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"recip1.d\";",
"break;",
"case OPC_RSQRT1_D:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_rsqrt1_d(fp0, cpu_env, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"rsqrt1.d\";",
"break;",
"case OPC_RSQRT2_D:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_rsqrt2_d(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"rsqrt2.d\";",
"break;",
"case OPC_CMP_F_D:\ncase OPC_CMP_UN_D:\ncase OPC_CMP_EQ_D:\ncase OPC_CMP_UEQ_D:\ncase OPC_CMP_OLT_D:\ncase OPC_CMP_ULT_D:\ncase OPC_CMP_OLE_D:\ncase OPC_CMP_ULE_D:\ncase OPC_CMP_SF_D:\ncase OPC_CMP_NGLE_D:\ncase OPC_CMP_SEQ_D:\ncase OPC_CMP_NGL_D:\ncase OPC_CMP_LT_D:\ncase OPC_CMP_NGE_D:\ncase OPC_CMP_LE_D:\ncase OPC_CMP_NGT_D:\nif (VAR_0->opcode & (1 << 6)) {",
"gen_cmpabs_d(VAR_0, func-48, VAR_2, VAR_3, VAR_5);",
"VAR_6 = VAR_8[func-48];",
"} else {",
"gen_cmp_d(VAR_0, func-48, VAR_2, VAR_3, VAR_5);",
"VAR_6 = VAR_7[func-48];",
"}",
"break;",
"case OPC_CVT_S_D:\ncheck_cp1_registers(VAR_0, VAR_3);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp64, VAR_3);",
"gen_helper_float_cvts_d(fp32, cpu_env, fp64);",
"tcg_temp_free_i64(fp64);",
"gen_store_fpr32(fp32, VAR_4);",
"tcg_temp_free_i32(fp32);",
"}",
"VAR_6 = \"cvt.s.d\";",
"break;",
"case OPC_CVT_W_D:\ncheck_cp1_registers(VAR_0, VAR_3);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp64, VAR_3);",
"gen_helper_float_cvtw_d(fp32, cpu_env, fp64);",
"tcg_temp_free_i64(fp64);",
"gen_store_fpr32(fp32, VAR_4);",
"tcg_temp_free_i32(fp32);",
"}",
"VAR_6 = \"cvt.w.d\";",
"break;",
"case OPC_CVT_L_D:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_cvtl_d(fp0, cpu_env, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"cvt.l.d\";",
"break;",
"case OPC_CVT_S_W:\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_cvts_w(fp0, cpu_env, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"cvt.s.w\";",
"break;",
"case OPC_CVT_D_W:\ncheck_cp1_registers(VAR_0, VAR_4);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr32(fp32, VAR_3);",
"gen_helper_float_cvtd_w(fp64, cpu_env, fp32);",
"tcg_temp_free_i32(fp32);",
"gen_store_fpr64(VAR_0, fp64, VAR_4);",
"tcg_temp_free_i64(fp64);",
"}",
"VAR_6 = \"cvt.d.w\";",
"break;",
"case OPC_CVT_S_L:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp64, VAR_3);",
"gen_helper_float_cvts_l(fp32, cpu_env, fp64);",
"tcg_temp_free_i64(fp64);",
"gen_store_fpr32(fp32, VAR_4);",
"tcg_temp_free_i32(fp32);",
"}",
"VAR_6 = \"cvt.s.l\";",
"break;",
"case OPC_CVT_D_L:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_cvtd_l(fp0, cpu_env, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"cvt.d.l\";",
"break;",
"case OPC_CVT_PS_PW:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_cvtps_pw(fp0, cpu_env, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"cvt.ps.pw\";",
"break;",
"case OPC_ADD_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_add_ps(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"add.ps\";",
"break;",
"case OPC_SUB_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_sub_ps(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"sub.ps\";",
"break;",
"case OPC_MUL_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_mul_ps(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"mul.ps\";",
"break;",
"case OPC_ABS_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_abs_ps(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"abs.ps\";",
"break;",
"case OPC_MOV_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"mov.ps\";",
"break;",
"case OPC_NEG_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_chs_ps(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"neg.ps\";",
"break;",
"case OPC_MOVCF_PS:\ncheck_cp1_64bitmode(VAR_0);",
"gen_movcf_ps(VAR_3, VAR_4, (VAR_2 >> 2) & 0x7, VAR_2 & 0x1);",
"VAR_6 = \"movcf.ps\";",
"break;",
"case OPC_MOVZ_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"int VAR_11 = gen_new_label();",
"TCGv_i64 fp0;",
"if (VAR_2 != 0)\ntcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[VAR_2], 0, VAR_11);",
"fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"gen_set_label(VAR_11);",
"}",
"VAR_6 = \"movz.ps\";",
"break;",
"case OPC_MOVN_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"int VAR_11 = gen_new_label();",
"TCGv_i64 fp0;",
"if (VAR_2 != 0) {",
"tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[VAR_2], 0, VAR_11);",
"fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"gen_set_label(VAR_11);",
"}",
"}",
"VAR_6 = \"movn.ps\";",
"break;",
"case OPC_ADDR_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_2);",
"gen_load_fpr64(VAR_0, fp1, VAR_3);",
"gen_helper_float_addr_ps(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"addr.ps\";",
"break;",
"case OPC_MULR_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_2);",
"gen_load_fpr64(VAR_0, fp1, VAR_3);",
"gen_helper_float_mulr_ps(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"mulr.ps\";",
"break;",
"case OPC_RECIP2_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_recip2_ps(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"recip2.ps\";",
"break;",
"case OPC_RECIP1_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_recip1_ps(fp0, cpu_env, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"recip1.ps\";",
"break;",
"case OPC_RSQRT1_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_rsqrt1_ps(fp0, cpu_env, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"rsqrt1.ps\";",
"break;",
"case OPC_RSQRT2_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_rsqrt2_ps(fp0, cpu_env, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"rsqrt2.ps\";",
"break;",
"case OPC_CVT_S_PU:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32h(fp0, VAR_3);",
"gen_helper_float_cvts_pu(fp0, cpu_env, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"cvt.s.pu\";",
"break;",
"case OPC_CVT_PW_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_cvtpw_ps(fp0, cpu_env, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"cvt.pw.ps\";",
"break;",
"case OPC_CVT_S_PL:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_cvts_pl(fp0, cpu_env, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"cvt.s.pl\";",
"break;",
"case OPC_PLL_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_load_fpr32(fp1, VAR_2);",
"gen_store_fpr32h(fp0, VAR_4);",
"gen_store_fpr32(fp1, VAR_4);",
"tcg_temp_free_i32(fp0);",
"tcg_temp_free_i32(fp1);",
"}",
"VAR_6 = \"pll.ps\";",
"break;",
"case OPC_PLU_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_load_fpr32h(fp1, VAR_2);",
"gen_store_fpr32(fp1, VAR_4);",
"gen_store_fpr32h(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"tcg_temp_free_i32(fp1);",
"}",
"VAR_6 = \"plu.ps\";",
"break;",
"case OPC_PUL_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32h(fp0, VAR_3);",
"gen_load_fpr32(fp1, VAR_2);",
"gen_store_fpr32(fp1, VAR_4);",
"gen_store_fpr32h(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"tcg_temp_free_i32(fp1);",
"}",
"VAR_6 = \"pul.ps\";",
"break;",
"case OPC_PUU_PS:\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32h(fp0, VAR_3);",
"gen_load_fpr32h(fp1, VAR_2);",
"gen_store_fpr32(fp1, VAR_4);",
"gen_store_fpr32h(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"tcg_temp_free_i32(fp1);",
"}",
"VAR_6 = \"puu.ps\";",
"break;",
"case OPC_CMP_F_PS:\ncase OPC_CMP_UN_PS:\ncase OPC_CMP_EQ_PS:\ncase OPC_CMP_UEQ_PS:\ncase OPC_CMP_OLT_PS:\ncase OPC_CMP_ULT_PS:\ncase OPC_CMP_OLE_PS:\ncase OPC_CMP_ULE_PS:\ncase OPC_CMP_SF_PS:\ncase OPC_CMP_NGLE_PS:\ncase OPC_CMP_SEQ_PS:\ncase OPC_CMP_NGL_PS:\ncase OPC_CMP_LT_PS:\ncase OPC_CMP_NGE_PS:\ncase OPC_CMP_LE_PS:\ncase OPC_CMP_NGT_PS:\nif (VAR_0->opcode & (1 << 6)) {",
"gen_cmpabs_ps(VAR_0, func-48, VAR_2, VAR_3, VAR_5);",
"VAR_6 = VAR_8[func-48];",
"} else {",
"gen_cmp_ps(VAR_0, func-48, VAR_2, VAR_3, VAR_5);",
"VAR_6 = VAR_7[func-48];",
"}",
"break;",
"default:\nMIPS_INVAL(VAR_6);",
"generate_exception (VAR_0, EXCP_RI);",
"return;",
"}",
"(void)VAR_6;",
"switch (VAR_9) {",
"case BINOP:\nMIPS_DEBUG(\"%s %s, %s, %s\", VAR_6, fregnames[VAR_4], fregnames[VAR_3], fregnames[VAR_2]);",
"break;",
"case CMPOP:\nMIPS_DEBUG(\"%s %s,%s\", VAR_6, fregnames[VAR_3], fregnames[VAR_2]);",
"break;",
"default:\nMIPS_DEBUG(\"%s %s,%s\", VAR_6, fregnames[VAR_4], fregnames[VAR_3]);",
"break;",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11,
13,
15,
17,
19,
21,
23,
25,
27,
29,
31,
33,
35,
37,
39,
41,
43
],
[
45
],
[
47,
49,
51,
53,
55,
57,
59,
61,
63,
65,
67,
69,
71,
73,
75,
77,
79
],
[
81
],
[
83
],
[
87
],
[
89,
91
],
[
93
],
[
95
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119,
121
],
[
123
],
[
125
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149,
151
],
[
153
],
[
155
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179,
181
],
[
183
],
[
185
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209,
211
],
[
213
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
231,
233
],
[
235
],
[
239
],
[
241
],
[
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
253,
255
],
[
257
],
[
261
],
[
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273,
275
],
[
277
],
[
281
],
[
283
],
[
285
],
[
287
],
[
289
],
[
291
],
[
293
],
[
295,
297
],
[
299
],
[
301
],
[
303
],
[
307
],
[
309
],
[
311
],
[
313
],
[
315
],
[
317
],
[
319
],
[
321
],
[
323,
325
],
[
327
],
[
329
],
[
331
],
[
335
],
[
337
],
[
339
],
[
341
],
[
343
],
[
345
],
[
347
],
[
349
],
[
351,
353
],
[
355
],
[
357
],
[
359
],
[
363
],
[
365
],
[
367
],
[
369
],
[
371
],
[
373
],
[
375
],
[
377
],
[
379,
381
],
[
383
],
[
385
],
[
387
],
[
391
],
[
393
],
[
395
],
[
397
],
[
399
],
[
401
],
[
403
],
[
405
],
[
407,
409
],
[
411
],
[
415
],
[
417
],
[
419
],
[
421
],
[
423
],
[
425
],
[
427
],
[
429,
431
],
[
433
],
[
437
],
[
439
],
[
441
],
[
443
],
[
445
],
[
447
],
[
449
],
[
451,
453
],
[
455
],
[
459
],
[
461
],
[
463
],
[
465
],
[
467
],
[
469
],
[
471
],
[
473,
475
],
[
477
],
[
481
],
[
483
],
[
485
],
[
487
],
[
489
],
[
491
],
[
493
],
[
495,
497
],
[
499
],
[
501
],
[
503,
505
],
[
507
],
[
509
],
[
513
],
[
515
],
[
517
],
[
519
],
[
521
],
[
523
],
[
525
],
[
527
],
[
529
],
[
531
],
[
533
],
[
535,
537
],
[
539
],
[
541
],
[
545
],
[
547
],
[
549
],
[
551
],
[
553
],
[
555
],
[
557
],
[
559
],
[
561
],
[
563
],
[
565
],
[
567,
569
],
[
571
],
[
573
],
[
577
],
[
579
],
[
581
],
[
583
],
[
585
],
[
587
],
[
589
],
[
591,
593
],
[
595
],
[
597
],
[
601
],
[
603
],
[
605
],
[
607
],
[
609
],
[
611
],
[
613
],
[
615,
617
],
[
619
],
[
621
],
[
623
],
[
627
],
[
629
],
[
631
],
[
633
],
[
635
],
[
637
],
[
639
],
[
641
],
[
643
],
[
645,
647
],
[
649
],
[
651
],
[
655
],
[
657
],
[
659
],
[
661
],
[
663
],
[
665
],
[
667
],
[
669,
671
],
[
673
],
[
675
],
[
679
],
[
681
],
[
683
],
[
685
],
[
687
],
[
689
],
[
691
],
[
693,
695
],
[
697
],
[
699
],
[
701
],
[
705
],
[
707
],
[
709
],
[
711
],
[
713
],
[
715
],
[
717
],
[
719
],
[
721
],
[
723,
725
],
[
727
],
[
729
],
[
731
],
[
735
],
[
737
],
[
739
],
[
741
],
[
743
],
[
745
],
[
747
],
[
749
],
[
751,
753
],
[
755
],
[
759
],
[
761
],
[
763
],
[
765
],
[
767
],
[
769
],
[
771
],
[
773,
775
],
[
777
],
[
779
],
[
781
],
[
785
],
[
787
],
[
789
],
[
791
],
[
793
],
[
795
],
[
797
],
[
799
],
[
801,
803
],
[
805
],
[
807
],
[
809
],
[
811
],
[
815
],
[
817
],
[
819
],
[
821
],
[
823
],
[
825
],
[
827
],
[
829
],
[
831
],
[
833
],
[
835,
837,
839,
841,
843,
845,
847,
849,
851,
853,
855,
857,
859,
861,
863,
865,
867
],
[
869
],
[
871
],
[
873
],
[
875
],
[
877
],
[
879
],
[
881
],
[
883,
885
],
[
887
],
[
889
],
[
891
],
[
895
],
[
897
],
[
899
],
[
901
],
[
903
],
[
905
],
[
907
],
[
909
],
[
911
],
[
913
],
[
915,
917
],
[
919
],
[
921
],
[
923
],
[
927
],
[
929
],
[
931
],
[
933
],
[
935
],
[
937
],
[
939
],
[
941
],
[
943
],
[
945
],
[
947,
949
],
[
951
],
[
953
],
[
955
],
[
959
],
[
961
],
[
963
],
[
965
],
[
967
],
[
969
],
[
971
],
[
973
],
[
975
],
[
977
],
[
979,
981
],
[
983
],
[
985
],
[
987
],
[
991
],
[
993
],
[
995
],
[
997
],
[
999
],
[
1001
],
[
1003
],
[
1005
],
[
1007
],
[
1009
],
[
1011,
1013
],
[
1015
],
[
1017
],
[
1021
],
[
1023
],
[
1025
],
[
1027
],
[
1029
],
[
1031
],
[
1033
],
[
1035,
1037
],
[
1039
],
[
1041
],
[
1045
],
[
1047
],
[
1049
],
[
1051
],
[
1053
],
[
1055
],
[
1057
],
[
1059,
1061
],
[
1063
],
[
1065
],
[
1069
],
[
1071
],
[
1073
],
[
1075
],
[
1077
],
[
1079
],
[
1081,
1083
],
[
1085
],
[
1087
],
[
1091
],
[
1093
],
[
1095
],
[
1097
],
[
1099
],
[
1101
],
[
1103
],
[
1105,
1107
],
[
1109
],
[
1111
],
[
1115
],
[
1117
],
[
1119
],
[
1121
],
[
1123
],
[
1125
],
[
1127
],
[
1129,
1131
],
[
1133
],
[
1135
],
[
1139
],
[
1141
],
[
1143
],
[
1145
],
[
1147
],
[
1149
],
[
1151
],
[
1153,
1155
],
[
1157
],
[
1159
],
[
1163
],
[
1165
],
[
1167
],
[
1169
],
[
1171
],
[
1173
],
[
1175
],
[
1177,
1179
],
[
1181
],
[
1183
],
[
1187
],
[
1189
],
[
1191
],
[
1193
],
[
1195
],
[
1197
],
[
1199
],
[
1201,
1203
],
[
1205
],
[
1207
],
[
1209
],
[
1213
],
[
1215
],
[
1217
],
[
1219
],
[
1221
],
[
1223
],
[
1225
],
[
1227
],
[
1229,
1231
],
[
1233
],
[
1235
],
[
1237
],
[
1241
],
[
1243
],
[
1245
],
[
1247
],
[
1249
],
[
1251
],
[
1253
],
[
1255
],
[
1257,
1259
],
[
1261
],
[
1263
],
[
1265
],
[
1269
],
[
1271
],
[
1273
],
[
1275
],
[
1277
],
[
1279
],
[
1281
],
[
1283
],
[
1285,
1287
],
[
1289
],
[
1291
],
[
1293
],
[
1297
],
[
1299
],
[
1301
],
[
1303
],
[
1305
],
[
1307
],
[
1309
],
[
1311
],
[
1313,
1315
],
[
1317
],
[
1319
],
[
1321,
1323
],
[
1325
],
[
1327
],
[
1331
],
[
1333
],
[
1335
],
[
1337
],
[
1339
],
[
1341
],
[
1343
],
[
1345
],
[
1347
],
[
1349
],
[
1351
],
[
1353,
1355
],
[
1357
],
[
1359
],
[
1363
],
[
1365
],
[
1367
],
[
1369
],
[
1371
],
[
1373
],
[
1375
],
[
1377
],
[
1379
],
[
1381
],
[
1383
],
[
1385,
1387
],
[
1389
],
[
1391
],
[
1395
],
[
1397
],
[
1399
],
[
1401
],
[
1403
],
[
1405
],
[
1407
],
[
1409,
1411
],
[
1413
],
[
1415
],
[
1419
],
[
1421
],
[
1423
],
[
1425
],
[
1427
],
[
1429
],
[
1431
],
[
1433,
1435
],
[
1437
],
[
1439
],
[
1441
],
[
1445
],
[
1447
],
[
1449
],
[
1451
],
[
1453
],
[
1455
],
[
1457
],
[
1459
],
[
1461
],
[
1463,
1465
],
[
1467
],
[
1469
],
[
1473
],
[
1475
],
[
1477
],
[
1479
],
[
1481
],
[
1483
],
[
1485
],
[
1487,
1489
],
[
1491
],
[
1493
],
[
1497
],
[
1499
],
[
1501
],
[
1503
],
[
1505
],
[
1507
],
[
1509
],
[
1511,
1513
],
[
1515
],
[
1517
],
[
1519
],
[
1523
],
[
1525
],
[
1527
],
[
1529
],
[
1531
],
[
1533
],
[
1535
],
[
1537
],
[
1539
],
[
1541,
1543,
1545,
1547,
1549,
1551,
1553,
1555,
1557,
1559,
1561,
1563,
1565,
1567,
1569,
1571,
1573
],
[
1575
],
[
1577
],
[
1579
],
[
1581
],
[
1583
],
[
1585
],
[
1587
],
[
1589,
1591
],
[
1593
],
[
1595
],
[
1597
],
[
1601
],
[
1603
],
[
1605
],
[
1607
],
[
1609
],
[
1611
],
[
1613
],
[
1615
],
[
1617,
1619
],
[
1621
],
[
1623
],
[
1625
],
[
1629
],
[
1631
],
[
1633
],
[
1635
],
[
1637
],
[
1639
],
[
1641
],
[
1643
],
[
1645,
1647
],
[
1649
],
[
1651
],
[
1655
],
[
1657
],
[
1659
],
[
1661
],
[
1663
],
[
1665
],
[
1667
],
[
1669,
1671
],
[
1673
],
[
1677
],
[
1679
],
[
1681
],
[
1683
],
[
1685
],
[
1687
],
[
1689
],
[
1691,
1693
],
[
1695
],
[
1697
],
[
1699
],
[
1703
],
[
1705
],
[
1707
],
[
1709
],
[
1711
],
[
1713
],
[
1715
],
[
1717
],
[
1719,
1721
],
[
1723
],
[
1725
],
[
1727
],
[
1731
],
[
1733
],
[
1735
],
[
1737
],
[
1739
],
[
1741
],
[
1743
],
[
1745
],
[
1747,
1749
],
[
1751
],
[
1753
],
[
1757
],
[
1759
],
[
1761
],
[
1763
],
[
1765
],
[
1767
],
[
1769
],
[
1771,
1773
],
[
1775
],
[
1777
],
[
1781
],
[
1783
],
[
1785
],
[
1787
],
[
1789
],
[
1791
],
[
1793
],
[
1795,
1797
],
[
1799
],
[
1801
],
[
1803
],
[
1807
],
[
1809
],
[
1811
],
[
1813
],
[
1815
],
[
1817
],
[
1819
],
[
1821
],
[
1823
],
[
1825,
1827
],
[
1829
],
[
1831
],
[
1833
],
[
1837
],
[
1839
],
[
1841
],
[
1843
],
[
1845
],
[
1847
],
[
1849
],
[
1851
],
[
1853
],
[
1855,
1857
],
[
1859
],
[
1861
],
[
1863
],
[
1867
],
[
1869
],
[
1871
],
[
1873
],
[
1875
],
[
1877
],
[
1879
],
[
1881
],
[
1883
],
[
1885,
1887
],
[
1889
],
[
1891
],
[
1895
],
[
1897
],
[
1899
],
[
1901
],
[
1903
],
[
1905
],
[
1907
],
[
1909,
1911
],
[
1913
],
[
1915
],
[
1919
],
[
1921
],
[
1923
],
[
1925
],
[
1927
],
[
1929
],
[
1931,
1933
],
[
1935
],
[
1937
],
[
1941
],
[
1943
],
[
1945
],
[
1947
],
[
1949
],
[
1951
],
[
1953
],
[
1955,
1957
],
[
1959
],
[
1961
],
[
1963
],
[
1965,
1967
],
[
1969
],
[
1971
],
[
1973
],
[
1977,
1979
],
[
1981
],
[
1983
],
[
1985
],
[
1987
],
[
1989
],
[
1991
],
[
1993
],
[
1995
],
[
1997,
1999
],
[
2001
],
[
2003
],
[
2005
],
[
2009
],
[
2011
],
[
2013
],
[
2015
],
[
2017
],
[
2019
],
[
2021
],
[
2023
],
[
2025
],
[
2027
],
[
2029
],
[
2031,
2033
],
[
2035
],
[
2037
],
[
2039
],
[
2043
],
[
2045
],
[
2047
],
[
2049
],
[
2051
],
[
2053
],
[
2055
],
[
2057
],
[
2059
],
[
2061,
2063
],
[
2065
],
[
2067
],
[
2069
],
[
2073
],
[
2075
],
[
2077
],
[
2079
],
[
2081
],
[
2083
],
[
2085
],
[
2087
],
[
2089
],
[
2091,
2093
],
[
2095
],
[
2097
],
[
2099
],
[
2103
],
[
2105
],
[
2107
],
[
2109
],
[
2111
],
[
2113
],
[
2115
],
[
2117
],
[
2119
],
[
2121,
2123
],
[
2125
],
[
2127
],
[
2131
],
[
2133
],
[
2135
],
[
2137
],
[
2139
],
[
2141
],
[
2143
],
[
2145,
2147
],
[
2149
],
[
2151
],
[
2155
],
[
2157
],
[
2159
],
[
2161
],
[
2163
],
[
2165
],
[
2167
],
[
2169,
2171
],
[
2173
],
[
2175
],
[
2177
],
[
2181
],
[
2183
],
[
2185
],
[
2187
],
[
2189
],
[
2191
],
[
2193
],
[
2195
],
[
2197
],
[
2199,
2201
],
[
2203
],
[
2205
],
[
2209
],
[
2211
],
[
2213
],
[
2215
],
[
2217
],
[
2219
],
[
2221
],
[
2223,
2225
],
[
2227
],
[
2229
],
[
2233
],
[
2235
],
[
2237
],
[
2239
],
[
2241
],
[
2243
],
[
2245
],
[
2247,
2249
],
[
2251
],
[
2253
],
[
2257
],
[
2259
],
[
2261
],
[
2263
],
[
2265
],
[
2267
],
[
2269
],
[
2271,
2273
],
[
2275
],
[
2277
],
[
2279
],
[
2283
],
[
2285
],
[
2287
],
[
2289
],
[
2291
],
[
2293
],
[
2295
],
[
2297
],
[
2299
],
[
2301,
2303
],
[
2305
],
[
2307
],
[
2309
],
[
2313
],
[
2315
],
[
2317
],
[
2319
],
[
2321
],
[
2323
],
[
2325
],
[
2327
],
[
2329
],
[
2331,
2333
],
[
2335
],
[
2337
],
[
2339
],
[
2343
],
[
2345
],
[
2347
],
[
2349
],
[
2351
],
[
2353
],
[
2355
],
[
2357
],
[
2359
],
[
2361,
2363
],
[
2365
],
[
2367
],
[
2369
],
[
2373
],
[
2375
],
[
2377
],
[
2379
],
[
2381
],
[
2383
],
[
2385
],
[
2387
],
[
2389
],
[
2391,
2393,
2395,
2397,
2399,
2401,
2403,
2405,
2407,
2409,
2411,
2413,
2415,
2417,
2419,
2421,
2423
],
[
2425
],
[
2427
],
[
2429
],
[
2431
],
[
2433
],
[
2435
],
[
2437
],
[
2439,
2441
],
[
2443
],
[
2445
],
[
2447
],
[
2449
],
[
2451
],
[
2453,
2455
],
[
2457
],
[
2459,
2461
],
[
2463
],
[
2465,
2467
],
[
2469
],
[
2471
],
[
2473
]
] |
1,556 | static uint64_t ecc_mem_read(void *opaque, target_phys_addr_t addr,
unsigned size)
{
ECCState *s = opaque;
uint32_t ret = 0;
switch (addr >> 2) {
case ECC_MER:
ret = s->regs[ECC_MER];
trace_ecc_mem_readl_mer(ret);
break;
case ECC_MDR:
ret = s->regs[ECC_MDR];
trace_ecc_mem_readl_mdr(ret);
break;
case ECC_MFSR:
ret = s->regs[ECC_MFSR];
trace_ecc_mem_readl_mfsr(ret);
break;
case ECC_VCR:
ret = s->regs[ECC_VCR];
trace_ecc_mem_readl_vcr(ret);
break;
case ECC_MFAR0:
ret = s->regs[ECC_MFAR0];
trace_ecc_mem_readl_mfar0(ret);
break;
case ECC_MFAR1:
ret = s->regs[ECC_MFAR1];
trace_ecc_mem_readl_mfar1(ret);
break;
case ECC_DR:
ret = s->regs[ECC_DR];
trace_ecc_mem_readl_dr(ret);
break;
case ECC_ECR0:
ret = s->regs[ECC_ECR0];
trace_ecc_mem_readl_ecr0(ret);
break;
case ECC_ECR1:
ret = s->regs[ECC_ECR0];
trace_ecc_mem_readl_ecr1(ret);
break;
}
return ret;
}
| false | qemu | a8170e5e97ad17ca169c64ba87ae2f53850dab4c | static uint64_t ecc_mem_read(void *opaque, target_phys_addr_t addr,
unsigned size)
{
ECCState *s = opaque;
uint32_t ret = 0;
switch (addr >> 2) {
case ECC_MER:
ret = s->regs[ECC_MER];
trace_ecc_mem_readl_mer(ret);
break;
case ECC_MDR:
ret = s->regs[ECC_MDR];
trace_ecc_mem_readl_mdr(ret);
break;
case ECC_MFSR:
ret = s->regs[ECC_MFSR];
trace_ecc_mem_readl_mfsr(ret);
break;
case ECC_VCR:
ret = s->regs[ECC_VCR];
trace_ecc_mem_readl_vcr(ret);
break;
case ECC_MFAR0:
ret = s->regs[ECC_MFAR0];
trace_ecc_mem_readl_mfar0(ret);
break;
case ECC_MFAR1:
ret = s->regs[ECC_MFAR1];
trace_ecc_mem_readl_mfar1(ret);
break;
case ECC_DR:
ret = s->regs[ECC_DR];
trace_ecc_mem_readl_dr(ret);
break;
case ECC_ECR0:
ret = s->regs[ECC_ECR0];
trace_ecc_mem_readl_ecr0(ret);
break;
case ECC_ECR1:
ret = s->regs[ECC_ECR0];
trace_ecc_mem_readl_ecr1(ret);
break;
}
return ret;
}
| {
"code": [],
"line_no": []
} | static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,
unsigned size)
{
ECCState *s = opaque;
uint32_t ret = 0;
switch (addr >> 2) {
case ECC_MER:
ret = s->regs[ECC_MER];
trace_ecc_mem_readl_mer(ret);
break;
case ECC_MDR:
ret = s->regs[ECC_MDR];
trace_ecc_mem_readl_mdr(ret);
break;
case ECC_MFSR:
ret = s->regs[ECC_MFSR];
trace_ecc_mem_readl_mfsr(ret);
break;
case ECC_VCR:
ret = s->regs[ECC_VCR];
trace_ecc_mem_readl_vcr(ret);
break;
case ECC_MFAR0:
ret = s->regs[ECC_MFAR0];
trace_ecc_mem_readl_mfar0(ret);
break;
case ECC_MFAR1:
ret = s->regs[ECC_MFAR1];
trace_ecc_mem_readl_mfar1(ret);
break;
case ECC_DR:
ret = s->regs[ECC_DR];
trace_ecc_mem_readl_dr(ret);
break;
case ECC_ECR0:
ret = s->regs[ECC_ECR0];
trace_ecc_mem_readl_ecr0(ret);
break;
case ECC_ECR1:
ret = s->regs[ECC_ECR0];
trace_ecc_mem_readl_ecr1(ret);
break;
}
return ret;
}
| [
"static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{",
"ECCState *s = opaque;",
"uint32_t ret = 0;",
"switch (addr >> 2) {",
"case ECC_MER:\nret = s->regs[ECC_MER];",
"trace_ecc_mem_readl_mer(ret);",
"break;",
"case ECC_MDR:\nret = s->regs[ECC_MDR];",
"trace_ecc_mem_readl_mdr(ret);",
"break;",
"case ECC_MFSR:\nret = s->regs[ECC_MFSR];",
"trace_ecc_mem_readl_mfsr(ret);",
"break;",
"case ECC_VCR:\nret = s->regs[ECC_VCR];",
"trace_ecc_mem_readl_vcr(ret);",
"break;",
"case ECC_MFAR0:\nret = s->regs[ECC_MFAR0];",
"trace_ecc_mem_readl_mfar0(ret);",
"break;",
"case ECC_MFAR1:\nret = s->regs[ECC_MFAR1];",
"trace_ecc_mem_readl_mfar1(ret);",
"break;",
"case ECC_DR:\nret = s->regs[ECC_DR];",
"trace_ecc_mem_readl_dr(ret);",
"break;",
"case ECC_ECR0:\nret = s->regs[ECC_ECR0];",
"trace_ecc_mem_readl_ecr0(ret);",
"break;",
"case ECC_ECR1:\nret = s->regs[ECC_ECR0];",
"trace_ecc_mem_readl_ecr1(ret);",
"break;",
"}",
"return ret;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
13
],
[
15,
17
],
[
19
],
[
21
],
[
23,
25
],
[
27
],
[
29
],
[
31,
33
],
[
35
],
[
37
],
[
39,
41
],
[
43
],
[
45
],
[
47,
49
],
[
51
],
[
53
],
[
55,
57
],
[
59
],
[
61
],
[
63,
65
],
[
67
],
[
69
],
[
71,
73
],
[
75
],
[
77
],
[
79,
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
]
] |
1,558 | static int usb_host_handle_iso_data(USBHostDevice *s, USBPacket *p, int in)
{
AsyncURB *aurb;
int i, j, ret, max_packet_size, offset, len = 0;
uint8_t *buf;
max_packet_size = usb_ep_get_max_packet_size(&s->dev, p->pid, p->devep);
if (max_packet_size == 0)
return USB_RET_NAK;
aurb = get_iso_urb(s, p->pid, p->devep);
if (!aurb) {
aurb = usb_host_alloc_iso(s, p->pid, p->devep);
}
i = get_iso_urb_idx(s, p->pid, p->devep);
j = aurb[i].iso_frame_idx;
if (j >= 0 && j < ISO_FRAME_DESC_PER_URB) {
if (in) {
/* Check urb status */
if (aurb[i].urb.status) {
len = urb_status_to_usb_ret(aurb[i].urb.status);
/* Move to the next urb */
aurb[i].iso_frame_idx = ISO_FRAME_DESC_PER_URB - 1;
/* Check frame status */
} else if (aurb[i].urb.iso_frame_desc[j].status) {
len = urb_status_to_usb_ret(
aurb[i].urb.iso_frame_desc[j].status);
/* Check the frame fits */
} else if (aurb[i].urb.iso_frame_desc[j].actual_length
> p->iov.size) {
printf("husb: received iso data is larger then packet\n");
len = USB_RET_NAK;
/* All good copy data over */
} else {
len = aurb[i].urb.iso_frame_desc[j].actual_length;
buf = aurb[i].urb.buffer +
j * aurb[i].urb.iso_frame_desc[0].length;
usb_packet_copy(p, buf, len);
}
} else {
len = p->iov.size;
offset = (j == 0) ? 0 : get_iso_buffer_used(s, p->pid, p->devep);
/* Check the frame fits */
if (len > max_packet_size) {
printf("husb: send iso data is larger then max packet size\n");
return USB_RET_NAK;
}
/* All good copy data over */
usb_packet_copy(p, aurb[i].urb.buffer + offset, len);
aurb[i].urb.iso_frame_desc[j].length = len;
offset += len;
set_iso_buffer_used(s, p->pid, p->devep, offset);
/* Start the stream once we have buffered enough data */
if (!is_iso_started(s, p->pid, p->devep) && i == 1 && j == 8) {
set_iso_started(s, p->pid, p->devep);
}
}
aurb[i].iso_frame_idx++;
if (aurb[i].iso_frame_idx == ISO_FRAME_DESC_PER_URB) {
i = (i + 1) % s->iso_urb_count;
set_iso_urb_idx(s, p->pid, p->devep, i);
}
} else {
if (in) {
set_iso_started(s, p->pid, p->devep);
} else {
DPRINTF("hubs: iso out error no free buffer, dropping packet\n");
}
}
if (is_iso_started(s, p->pid, p->devep)) {
/* (Re)-submit all fully consumed / filled urbs */
for (i = 0; i < s->iso_urb_count; i++) {
if (aurb[i].iso_frame_idx == ISO_FRAME_DESC_PER_URB) {
ret = ioctl(s->fd, USBDEVFS_SUBMITURB, &aurb[i]);
if (ret < 0) {
perror("USBDEVFS_SUBMITURB");
if (!in || len == 0) {
switch(errno) {
case ETIMEDOUT:
len = USB_RET_NAK;
break;
case EPIPE:
default:
len = USB_RET_STALL;
}
}
break;
}
aurb[i].iso_frame_idx = -1;
change_iso_inflight(s, p->pid, p->devep, 1);
}
}
}
return len;
}
| false | qemu | 079d0b7f1eedcc634c371fe05b617fdc55c8b762 | static int usb_host_handle_iso_data(USBHostDevice *s, USBPacket *p, int in)
{
AsyncURB *aurb;
int i, j, ret, max_packet_size, offset, len = 0;
uint8_t *buf;
max_packet_size = usb_ep_get_max_packet_size(&s->dev, p->pid, p->devep);
if (max_packet_size == 0)
return USB_RET_NAK;
aurb = get_iso_urb(s, p->pid, p->devep);
if (!aurb) {
aurb = usb_host_alloc_iso(s, p->pid, p->devep);
}
i = get_iso_urb_idx(s, p->pid, p->devep);
j = aurb[i].iso_frame_idx;
if (j >= 0 && j < ISO_FRAME_DESC_PER_URB) {
if (in) {
if (aurb[i].urb.status) {
len = urb_status_to_usb_ret(aurb[i].urb.status);
aurb[i].iso_frame_idx = ISO_FRAME_DESC_PER_URB - 1;
} else if (aurb[i].urb.iso_frame_desc[j].status) {
len = urb_status_to_usb_ret(
aurb[i].urb.iso_frame_desc[j].status);
} else if (aurb[i].urb.iso_frame_desc[j].actual_length
> p->iov.size) {
printf("husb: received iso data is larger then packet\n");
len = USB_RET_NAK;
} else {
len = aurb[i].urb.iso_frame_desc[j].actual_length;
buf = aurb[i].urb.buffer +
j * aurb[i].urb.iso_frame_desc[0].length;
usb_packet_copy(p, buf, len);
}
} else {
len = p->iov.size;
offset = (j == 0) ? 0 : get_iso_buffer_used(s, p->pid, p->devep);
if (len > max_packet_size) {
printf("husb: send iso data is larger then max packet size\n");
return USB_RET_NAK;
}
usb_packet_copy(p, aurb[i].urb.buffer + offset, len);
aurb[i].urb.iso_frame_desc[j].length = len;
offset += len;
set_iso_buffer_used(s, p->pid, p->devep, offset);
if (!is_iso_started(s, p->pid, p->devep) && i == 1 && j == 8) {
set_iso_started(s, p->pid, p->devep);
}
}
aurb[i].iso_frame_idx++;
if (aurb[i].iso_frame_idx == ISO_FRAME_DESC_PER_URB) {
i = (i + 1) % s->iso_urb_count;
set_iso_urb_idx(s, p->pid, p->devep, i);
}
} else {
if (in) {
set_iso_started(s, p->pid, p->devep);
} else {
DPRINTF("hubs: iso out error no free buffer, dropping packet\n");
}
}
if (is_iso_started(s, p->pid, p->devep)) {
for (i = 0; i < s->iso_urb_count; i++) {
if (aurb[i].iso_frame_idx == ISO_FRAME_DESC_PER_URB) {
ret = ioctl(s->fd, USBDEVFS_SUBMITURB, &aurb[i]);
if (ret < 0) {
perror("USBDEVFS_SUBMITURB");
if (!in || len == 0) {
switch(errno) {
case ETIMEDOUT:
len = USB_RET_NAK;
break;
case EPIPE:
default:
len = USB_RET_STALL;
}
}
break;
}
aurb[i].iso_frame_idx = -1;
change_iso_inflight(s, p->pid, p->devep, 1);
}
}
}
return len;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(USBHostDevice *VAR_0, USBPacket *VAR_1, int VAR_2)
{
AsyncURB *aurb;
int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8 = 0;
uint8_t *buf;
VAR_6 = usb_ep_get_max_packet_size(&VAR_0->dev, VAR_1->pid, VAR_1->devep);
if (VAR_6 == 0)
return USB_RET_NAK;
aurb = get_iso_urb(VAR_0, VAR_1->pid, VAR_1->devep);
if (!aurb) {
aurb = usb_host_alloc_iso(VAR_0, VAR_1->pid, VAR_1->devep);
}
VAR_3 = get_iso_urb_idx(VAR_0, VAR_1->pid, VAR_1->devep);
VAR_4 = aurb[VAR_3].iso_frame_idx;
if (VAR_4 >= 0 && VAR_4 < ISO_FRAME_DESC_PER_URB) {
if (VAR_2) {
if (aurb[VAR_3].urb.status) {
VAR_8 = urb_status_to_usb_ret(aurb[VAR_3].urb.status);
aurb[VAR_3].iso_frame_idx = ISO_FRAME_DESC_PER_URB - 1;
} else if (aurb[VAR_3].urb.iso_frame_desc[VAR_4].status) {
VAR_8 = urb_status_to_usb_ret(
aurb[VAR_3].urb.iso_frame_desc[VAR_4].status);
} else if (aurb[VAR_3].urb.iso_frame_desc[VAR_4].actual_length
> VAR_1->iov.size) {
printf("husb: received iso data is larger then packet\n");
VAR_8 = USB_RET_NAK;
} else {
VAR_8 = aurb[VAR_3].urb.iso_frame_desc[VAR_4].actual_length;
buf = aurb[VAR_3].urb.buffer +
VAR_4 * aurb[VAR_3].urb.iso_frame_desc[0].length;
usb_packet_copy(VAR_1, buf, VAR_8);
}
} else {
VAR_8 = VAR_1->iov.size;
VAR_7 = (VAR_4 == 0) ? 0 : get_iso_buffer_used(VAR_0, VAR_1->pid, VAR_1->devep);
if (VAR_8 > VAR_6) {
printf("husb: send iso data is larger then max packet size\n");
return USB_RET_NAK;
}
usb_packet_copy(VAR_1, aurb[VAR_3].urb.buffer + VAR_7, VAR_8);
aurb[VAR_3].urb.iso_frame_desc[VAR_4].length = VAR_8;
VAR_7 += VAR_8;
set_iso_buffer_used(VAR_0, VAR_1->pid, VAR_1->devep, VAR_7);
if (!is_iso_started(VAR_0, VAR_1->pid, VAR_1->devep) && VAR_3 == 1 && VAR_4 == 8) {
set_iso_started(VAR_0, VAR_1->pid, VAR_1->devep);
}
}
aurb[VAR_3].iso_frame_idx++;
if (aurb[VAR_3].iso_frame_idx == ISO_FRAME_DESC_PER_URB) {
VAR_3 = (VAR_3 + 1) % VAR_0->iso_urb_count;
set_iso_urb_idx(VAR_0, VAR_1->pid, VAR_1->devep, VAR_3);
}
} else {
if (VAR_2) {
set_iso_started(VAR_0, VAR_1->pid, VAR_1->devep);
} else {
DPRINTF("hubs: iso out error no free buffer, dropping packet\n");
}
}
if (is_iso_started(VAR_0, VAR_1->pid, VAR_1->devep)) {
for (VAR_3 = 0; VAR_3 < VAR_0->iso_urb_count; VAR_3++) {
if (aurb[VAR_3].iso_frame_idx == ISO_FRAME_DESC_PER_URB) {
VAR_5 = ioctl(VAR_0->fd, USBDEVFS_SUBMITURB, &aurb[VAR_3]);
if (VAR_5 < 0) {
perror("USBDEVFS_SUBMITURB");
if (!VAR_2 || VAR_8 == 0) {
switch(errno) {
case ETIMEDOUT:
VAR_8 = USB_RET_NAK;
break;
case EPIPE:
default:
VAR_8 = USB_RET_STALL;
}
}
break;
}
aurb[VAR_3].iso_frame_idx = -1;
change_iso_inflight(VAR_0, VAR_1->pid, VAR_1->devep, 1);
}
}
}
return VAR_8;
}
| [
"static int FUNC_0(USBHostDevice *VAR_0, USBPacket *VAR_1, int VAR_2)\n{",
"AsyncURB *aurb;",
"int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8 = 0;",
"uint8_t *buf;",
"VAR_6 = usb_ep_get_max_packet_size(&VAR_0->dev, VAR_1->pid, VAR_1->devep);",
"if (VAR_6 == 0)\nreturn USB_RET_NAK;",
"aurb = get_iso_urb(VAR_0, VAR_1->pid, VAR_1->devep);",
"if (!aurb) {",
"aurb = usb_host_alloc_iso(VAR_0, VAR_1->pid, VAR_1->devep);",
"}",
"VAR_3 = get_iso_urb_idx(VAR_0, VAR_1->pid, VAR_1->devep);",
"VAR_4 = aurb[VAR_3].iso_frame_idx;",
"if (VAR_4 >= 0 && VAR_4 < ISO_FRAME_DESC_PER_URB) {",
"if (VAR_2) {",
"if (aurb[VAR_3].urb.status) {",
"VAR_8 = urb_status_to_usb_ret(aurb[VAR_3].urb.status);",
"aurb[VAR_3].iso_frame_idx = ISO_FRAME_DESC_PER_URB - 1;",
"} else if (aurb[VAR_3].urb.iso_frame_desc[VAR_4].status) {",
"VAR_8 = urb_status_to_usb_ret(\naurb[VAR_3].urb.iso_frame_desc[VAR_4].status);",
"} else if (aurb[VAR_3].urb.iso_frame_desc[VAR_4].actual_length",
"> VAR_1->iov.size) {",
"printf(\"husb: received iso data is larger then packet\\n\");",
"VAR_8 = USB_RET_NAK;",
"} else {",
"VAR_8 = aurb[VAR_3].urb.iso_frame_desc[VAR_4].actual_length;",
"buf = aurb[VAR_3].urb.buffer +\nVAR_4 * aurb[VAR_3].urb.iso_frame_desc[0].length;",
"usb_packet_copy(VAR_1, buf, VAR_8);",
"}",
"} else {",
"VAR_8 = VAR_1->iov.size;",
"VAR_7 = (VAR_4 == 0) ? 0 : get_iso_buffer_used(VAR_0, VAR_1->pid, VAR_1->devep);",
"if (VAR_8 > VAR_6) {",
"printf(\"husb: send iso data is larger then max packet size\\n\");",
"return USB_RET_NAK;",
"}",
"usb_packet_copy(VAR_1, aurb[VAR_3].urb.buffer + VAR_7, VAR_8);",
"aurb[VAR_3].urb.iso_frame_desc[VAR_4].length = VAR_8;",
"VAR_7 += VAR_8;",
"set_iso_buffer_used(VAR_0, VAR_1->pid, VAR_1->devep, VAR_7);",
"if (!is_iso_started(VAR_0, VAR_1->pid, VAR_1->devep) && VAR_3 == 1 && VAR_4 == 8) {",
"set_iso_started(VAR_0, VAR_1->pid, VAR_1->devep);",
"}",
"}",
"aurb[VAR_3].iso_frame_idx++;",
"if (aurb[VAR_3].iso_frame_idx == ISO_FRAME_DESC_PER_URB) {",
"VAR_3 = (VAR_3 + 1) % VAR_0->iso_urb_count;",
"set_iso_urb_idx(VAR_0, VAR_1->pid, VAR_1->devep, VAR_3);",
"}",
"} else {",
"if (VAR_2) {",
"set_iso_started(VAR_0, VAR_1->pid, VAR_1->devep);",
"} else {",
"DPRINTF(\"hubs: iso out error no free buffer, dropping packet\\n\");",
"}",
"}",
"if (is_iso_started(VAR_0, VAR_1->pid, VAR_1->devep)) {",
"for (VAR_3 = 0; VAR_3 < VAR_0->iso_urb_count; VAR_3++) {",
"if (aurb[VAR_3].iso_frame_idx == ISO_FRAME_DESC_PER_URB) {",
"VAR_5 = ioctl(VAR_0->fd, USBDEVFS_SUBMITURB, &aurb[VAR_3]);",
"if (VAR_5 < 0) {",
"perror(\"USBDEVFS_SUBMITURB\");",
"if (!VAR_2 || VAR_8 == 0) {",
"switch(errno) {",
"case ETIMEDOUT:\nVAR_8 = USB_RET_NAK;",
"break;",
"case EPIPE:\ndefault:\nVAR_8 = USB_RET_STALL;",
"}",
"}",
"break;",
"}",
"aurb[VAR_3].iso_frame_idx = -1;",
"change_iso_inflight(VAR_0, VAR_1->pid, VAR_1->devep, 1);",
"}",
"}",
"}",
"return VAR_8;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15,
17
],
[
21
],
[
23
],
[
25
],
[
27
],
[
31
],
[
33
],
[
35
],
[
37
],
[
41
],
[
43
],
[
47
],
[
51
],
[
53,
55
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
71
],
[
73,
75
],
[
77
],
[
79
],
[
81
],
[
83
],
[
85
],
[
91
],
[
93
],
[
95
],
[
97
],
[
103
],
[
105
],
[
107
],
[
109
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
149
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167,
169
],
[
171
],
[
173,
175,
177
],
[
179
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
193
],
[
195
],
[
199
],
[
201
]
] |
1,559 | static void gen_farith (DisasContext *ctx, uint32_t op1,
int ft, int fs, int fd, int cc)
{
const char *opn = "farith";
const char *condnames[] = {
"c.f",
"c.un",
"c.eq",
"c.ueq",
"c.olt",
"c.ult",
"c.ole",
"c.ule",
"c.sf",
"c.ngle",
"c.seq",
"c.ngl",
"c.lt",
"c.nge",
"c.le",
"c.ngt",
};
const char *condnames_abs[] = {
"cabs.f",
"cabs.un",
"cabs.eq",
"cabs.ueq",
"cabs.olt",
"cabs.ult",
"cabs.ole",
"cabs.ule",
"cabs.sf",
"cabs.ngle",
"cabs.seq",
"cabs.ngl",
"cabs.lt",
"cabs.nge",
"cabs.le",
"cabs.ngt",
};
enum { BINOP, CMPOP, OTHEROP } optype = OTHEROP;
uint32_t func = ctx->opcode & 0x3f;
switch (ctx->opcode & FOP(0x3f, 0x1f)) {
case FOP(0, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_add_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "add.s";
optype = BINOP;
break;
case FOP(1, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_sub_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "sub.s";
optype = BINOP;
break;
case FOP(2, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_mul_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "mul.s";
optype = BINOP;
break;
case FOP(3, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_div_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "div.s";
optype = BINOP;
break;
case FOP(4, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_sqrt_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "sqrt.s";
break;
case FOP(5, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_abs_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "abs.s";
break;
case FOP(6, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "mov.s";
break;
case FOP(7, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_chs_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "neg.s";
break;
case FOP(8, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_roundl_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "round.l.s";
break;
case FOP(9, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_truncl_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "trunc.l.s";
break;
case FOP(10, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_ceill_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "ceil.l.s";
break;
case FOP(11, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_floorl_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "floor.l.s";
break;
case FOP(12, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_roundw_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "round.w.s";
break;
case FOP(13, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_truncw_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "trunc.w.s";
break;
case FOP(14, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_ceilw_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "ceil.w.s";
break;
case FOP(15, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_floorw_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "floor.w.s";
break;
case FOP(17, 16):
gen_movcf_s(fs, fd, (ft >> 2) & 0x7, ft & 0x1);
opn = "movcf.s";
break;
case FOP(18, 16):
{
int l1 = gen_new_label();
TCGv_i32 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[ft], 0, l1);
}
fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
gen_set_label(l1);
}
opn = "movz.s";
break;
case FOP(19, 16):
{
int l1 = gen_new_label();
TCGv_i32 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[ft], 0, l1);
fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
gen_set_label(l1);
}
}
opn = "movn.s";
break;
case FOP(21, 16):
check_cop1x(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_recip_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "recip.s";
break;
case FOP(22, 16):
check_cop1x(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_rsqrt_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "rsqrt.s";
break;
case FOP(28, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, fd);
gen_helper_float_recip2_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "recip2.s";
break;
case FOP(29, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_recip1_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "recip1.s";
break;
case FOP(30, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_rsqrt1_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "rsqrt1.s";
break;
case FOP(31, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_rsqrt2_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "rsqrt2.s";
break;
case FOP(33, 16):
check_cp1_registers(ctx, fd);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_cvtd_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "cvt.d.s";
break;
case FOP(36, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_cvtw_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "cvt.w.s";
break;
case FOP(37, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_cvtl_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "cvt.l.s";
break;
case FOP(38, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp64 = tcg_temp_new_i64();
TCGv_i32 fp32_0 = tcg_temp_new_i32();
TCGv_i32 fp32_1 = tcg_temp_new_i32();
gen_load_fpr32(fp32_0, fs);
gen_load_fpr32(fp32_1, ft);
tcg_gen_concat_i32_i64(fp64, fp32_0, fp32_1);
tcg_temp_free_i32(fp32_1);
tcg_temp_free_i32(fp32_0);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "cvt.ps.s";
break;
case FOP(48, 16):
case FOP(49, 16):
case FOP(50, 16):
case FOP(51, 16):
case FOP(52, 16):
case FOP(53, 16):
case FOP(54, 16):
case FOP(55, 16):
case FOP(56, 16):
case FOP(57, 16):
case FOP(58, 16):
case FOP(59, 16):
case FOP(60, 16):
case FOP(61, 16):
case FOP(62, 16):
case FOP(63, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
if (ctx->opcode & (1 << 6)) {
check_cop1x(ctx);
gen_cmpabs_s(func-48, fp0, fp1, cc);
opn = condnames_abs[func-48];
} else {
gen_cmp_s(func-48, fp0, fp1, cc);
opn = condnames[func-48];
}
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
break;
case FOP(0, 17):
check_cp1_registers(ctx, fs | ft | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_add_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "add.d";
optype = BINOP;
break;
case FOP(1, 17):
check_cp1_registers(ctx, fs | ft | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_sub_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "sub.d";
optype = BINOP;
break;
case FOP(2, 17):
check_cp1_registers(ctx, fs | ft | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_mul_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mul.d";
optype = BINOP;
break;
case FOP(3, 17):
check_cp1_registers(ctx, fs | ft | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_div_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "div.d";
optype = BINOP;
break;
case FOP(4, 17):
check_cp1_registers(ctx, fs | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_sqrt_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "sqrt.d";
break;
case FOP(5, 17):
check_cp1_registers(ctx, fs | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_abs_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "abs.d";
break;
case FOP(6, 17):
check_cp1_registers(ctx, fs | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mov.d";
break;
case FOP(7, 17):
check_cp1_registers(ctx, fs | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_chs_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "neg.d";
break;
case FOP(8, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_roundl_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "round.l.d";
break;
case FOP(9, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_truncl_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "trunc.l.d";
break;
case FOP(10, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_ceill_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "ceil.l.d";
break;
case FOP(11, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_floorl_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "floor.l.d";
break;
case FOP(12, 17):
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_roundw_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "round.w.d";
break;
case FOP(13, 17):
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_truncw_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "trunc.w.d";
break;
case FOP(14, 17):
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_ceilw_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "ceil.w.d";
break;
case FOP(15, 17):
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_floorw_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "floor.w.d";
break;
case FOP(17, 17):
gen_movcf_d(ctx, fs, fd, (ft >> 2) & 0x7, ft & 0x1);
opn = "movcf.d";
break;
case FOP(18, 17):
{
int l1 = gen_new_label();
TCGv_i64 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[ft], 0, l1);
}
fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
gen_set_label(l1);
}
opn = "movz.d";
break;
case FOP(19, 17):
{
int l1 = gen_new_label();
TCGv_i64 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[ft], 0, l1);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
gen_set_label(l1);
}
}
opn = "movn.d";
break;
case FOP(21, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_recip_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip.d";
break;
case FOP(22, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_rsqrt_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt.d";
break;
case FOP(28, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_recip2_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip2.d";
break;
case FOP(29, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_recip1_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip1.d";
break;
case FOP(30, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_rsqrt1_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt1.d";
break;
case FOP(31, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_rsqrt2_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt2.d";
break;
case FOP(48, 17):
case FOP(49, 17):
case FOP(50, 17):
case FOP(51, 17):
case FOP(52, 17):
case FOP(53, 17):
case FOP(54, 17):
case FOP(55, 17):
case FOP(56, 17):
case FOP(57, 17):
case FOP(58, 17):
case FOP(59, 17):
case FOP(60, 17):
case FOP(61, 17):
case FOP(62, 17):
case FOP(63, 17):
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
if (ctx->opcode & (1 << 6)) {
check_cop1x(ctx);
check_cp1_registers(ctx, fs | ft);
gen_cmpabs_d(func-48, fp0, fp1, cc);
opn = condnames_abs[func-48];
} else {
check_cp1_registers(ctx, fs | ft);
gen_cmp_d(func-48, fp0, fp1, cc);
opn = condnames[func-48];
}
tcg_temp_free_i64(fp0);
tcg_temp_free_i64(fp1);
}
break;
case FOP(32, 17):
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_cvts_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "cvt.s.d";
break;
case FOP(36, 17):
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_cvtw_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "cvt.w.d";
break;
case FOP(37, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_cvtl_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "cvt.l.d";
break;
case FOP(32, 20):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_cvts_w(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "cvt.s.w";
break;
case FOP(33, 20):
check_cp1_registers(ctx, fd);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_cvtd_w(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "cvt.d.w";
break;
case FOP(32, 21):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_cvts_l(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "cvt.s.l";
break;
case FOP(33, 21):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_cvtd_l(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "cvt.d.l";
break;
case FOP(38, 20):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_cvtps_pw(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "cvt.ps.pw";
break;
case FOP(0, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_add_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "add.ps";
break;
case FOP(1, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_sub_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "sub.ps";
break;
case FOP(2, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_mul_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mul.ps";
break;
case FOP(5, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_abs_ps(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "abs.ps";
break;
case FOP(6, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mov.ps";
break;
case FOP(7, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_chs_ps(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "neg.ps";
break;
case FOP(17, 22):
check_cp1_64bitmode(ctx);
gen_movcf_ps(fs, fd, (ft >> 2) & 0x7, ft & 0x1);
opn = "movcf.ps";
break;
case FOP(18, 22):
check_cp1_64bitmode(ctx);
{
int l1 = gen_new_label();
TCGv_i64 fp0;
if (ft != 0)
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[ft], 0, l1);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
gen_set_label(l1);
}
opn = "movz.ps";
break;
case FOP(19, 22):
check_cp1_64bitmode(ctx);
{
int l1 = gen_new_label();
TCGv_i64 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[ft], 0, l1);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
gen_set_label(l1);
}
}
opn = "movn.ps";
break;
case FOP(24, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, ft);
gen_load_fpr64(ctx, fp1, fs);
gen_helper_float_addr_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "addr.ps";
break;
case FOP(26, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, ft);
gen_load_fpr64(ctx, fp1, fs);
gen_helper_float_mulr_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mulr.ps";
break;
case FOP(28, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, fd);
gen_helper_float_recip2_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip2.ps";
break;
case FOP(29, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_recip1_ps(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip1.ps";
break;
case FOP(30, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_rsqrt1_ps(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt1.ps";
break;
case FOP(31, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_rsqrt2_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt2.ps";
break;
case FOP(32, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, fs);
gen_helper_float_cvts_pu(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "cvt.s.pu";
break;
case FOP(36, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_cvtpw_ps(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "cvt.pw.ps";
break;
case FOP(40, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_cvts_pl(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "cvt.s.pl";
break;
case FOP(44, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_store_fpr32h(fp0, fd);
gen_store_fpr32(fp1, fd);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
opn = "pll.ps";
break;
case FOP(45, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32h(fp1, ft);
gen_store_fpr32(fp1, fd);
gen_store_fpr32h(fp0, fd);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
opn = "plu.ps";
break;
case FOP(46, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_store_fpr32(fp1, fd);
gen_store_fpr32h(fp0, fd);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
opn = "pul.ps";
break;
case FOP(47, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, fs);
gen_load_fpr32h(fp1, ft);
gen_store_fpr32(fp1, fd);
gen_store_fpr32h(fp0, fd);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
opn = "puu.ps";
break;
case FOP(48, 22):
case FOP(49, 22):
case FOP(50, 22):
case FOP(51, 22):
case FOP(52, 22):
case FOP(53, 22):
case FOP(54, 22):
case FOP(55, 22):
case FOP(56, 22):
case FOP(57, 22):
case FOP(58, 22):
case FOP(59, 22):
case FOP(60, 22):
case FOP(61, 22):
case FOP(62, 22):
case FOP(63, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
if (ctx->opcode & (1 << 6)) {
gen_cmpabs_ps(func-48, fp0, fp1, cc);
opn = condnames_abs[func-48];
} else {
gen_cmp_ps(func-48, fp0, fp1, cc);
opn = condnames[func-48];
}
tcg_temp_free_i64(fp0);
tcg_temp_free_i64(fp1);
}
break;
default:
MIPS_INVAL(opn);
generate_exception (ctx, EXCP_RI);
return;
}
switch (optype) {
case BINOP:
MIPS_DEBUG("%s %s, %s, %s", opn, fregnames[fd], fregnames[fs], fregnames[ft]);
break;
case CMPOP:
MIPS_DEBUG("%s %s,%s", opn, fregnames[fs], fregnames[ft]);
break;
default:
MIPS_DEBUG("%s %s,%s", opn, fregnames[fd], fregnames[fs]);
break;
}
}
| false | qemu | 007ac6faed12abdd4113e2460ba4464aacb7f4dd | static void gen_farith (DisasContext *ctx, uint32_t op1,
int ft, int fs, int fd, int cc)
{
const char *opn = "farith";
const char *condnames[] = {
"c.f",
"c.un",
"c.eq",
"c.ueq",
"c.olt",
"c.ult",
"c.ole",
"c.ule",
"c.sf",
"c.ngle",
"c.seq",
"c.ngl",
"c.lt",
"c.nge",
"c.le",
"c.ngt",
};
const char *condnames_abs[] = {
"cabs.f",
"cabs.un",
"cabs.eq",
"cabs.ueq",
"cabs.olt",
"cabs.ult",
"cabs.ole",
"cabs.ule",
"cabs.sf",
"cabs.ngle",
"cabs.seq",
"cabs.ngl",
"cabs.lt",
"cabs.nge",
"cabs.le",
"cabs.ngt",
};
enum { BINOP, CMPOP, OTHEROP } optype = OTHEROP;
uint32_t func = ctx->opcode & 0x3f;
switch (ctx->opcode & FOP(0x3f, 0x1f)) {
case FOP(0, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_add_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "add.s";
optype = BINOP;
break;
case FOP(1, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_sub_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "sub.s";
optype = BINOP;
break;
case FOP(2, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_mul_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "mul.s";
optype = BINOP;
break;
case FOP(3, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_div_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "div.s";
optype = BINOP;
break;
case FOP(4, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_sqrt_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "sqrt.s";
break;
case FOP(5, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_abs_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "abs.s";
break;
case FOP(6, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "mov.s";
break;
case FOP(7, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_chs_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "neg.s";
break;
case FOP(8, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_roundl_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "round.l.s";
break;
case FOP(9, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_truncl_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "trunc.l.s";
break;
case FOP(10, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_ceill_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "ceil.l.s";
break;
case FOP(11, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_floorl_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "floor.l.s";
break;
case FOP(12, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_roundw_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "round.w.s";
break;
case FOP(13, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_truncw_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "trunc.w.s";
break;
case FOP(14, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_ceilw_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "ceil.w.s";
break;
case FOP(15, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_floorw_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "floor.w.s";
break;
case FOP(17, 16):
gen_movcf_s(fs, fd, (ft >> 2) & 0x7, ft & 0x1);
opn = "movcf.s";
break;
case FOP(18, 16):
{
int l1 = gen_new_label();
TCGv_i32 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[ft], 0, l1);
}
fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
gen_set_label(l1);
}
opn = "movz.s";
break;
case FOP(19, 16):
{
int l1 = gen_new_label();
TCGv_i32 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[ft], 0, l1);
fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
gen_set_label(l1);
}
}
opn = "movn.s";
break;
case FOP(21, 16):
check_cop1x(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_recip_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "recip.s";
break;
case FOP(22, 16):
check_cop1x(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_rsqrt_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "rsqrt.s";
break;
case FOP(28, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, fd);
gen_helper_float_recip2_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "recip2.s";
break;
case FOP(29, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_recip1_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "recip1.s";
break;
case FOP(30, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_rsqrt1_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "rsqrt1.s";
break;
case FOP(31, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_helper_float_rsqrt2_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "rsqrt2.s";
break;
case FOP(33, 16):
check_cp1_registers(ctx, fd);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_cvtd_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "cvt.d.s";
break;
case FOP(36, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_cvtw_s(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "cvt.w.s";
break;
case FOP(37, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_cvtl_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "cvt.l.s";
break;
case FOP(38, 16):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp64 = tcg_temp_new_i64();
TCGv_i32 fp32_0 = tcg_temp_new_i32();
TCGv_i32 fp32_1 = tcg_temp_new_i32();
gen_load_fpr32(fp32_0, fs);
gen_load_fpr32(fp32_1, ft);
tcg_gen_concat_i32_i64(fp64, fp32_0, fp32_1);
tcg_temp_free_i32(fp32_1);
tcg_temp_free_i32(fp32_0);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "cvt.ps.s";
break;
case FOP(48, 16):
case FOP(49, 16):
case FOP(50, 16):
case FOP(51, 16):
case FOP(52, 16):
case FOP(53, 16):
case FOP(54, 16):
case FOP(55, 16):
case FOP(56, 16):
case FOP(57, 16):
case FOP(58, 16):
case FOP(59, 16):
case FOP(60, 16):
case FOP(61, 16):
case FOP(62, 16):
case FOP(63, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
if (ctx->opcode & (1 << 6)) {
check_cop1x(ctx);
gen_cmpabs_s(func-48, fp0, fp1, cc);
opn = condnames_abs[func-48];
} else {
gen_cmp_s(func-48, fp0, fp1, cc);
opn = condnames[func-48];
}
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
break;
case FOP(0, 17):
check_cp1_registers(ctx, fs | ft | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_add_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "add.d";
optype = BINOP;
break;
case FOP(1, 17):
check_cp1_registers(ctx, fs | ft | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_sub_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "sub.d";
optype = BINOP;
break;
case FOP(2, 17):
check_cp1_registers(ctx, fs | ft | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_mul_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mul.d";
optype = BINOP;
break;
case FOP(3, 17):
check_cp1_registers(ctx, fs | ft | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_div_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "div.d";
optype = BINOP;
break;
case FOP(4, 17):
check_cp1_registers(ctx, fs | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_sqrt_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "sqrt.d";
break;
case FOP(5, 17):
check_cp1_registers(ctx, fs | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_abs_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "abs.d";
break;
case FOP(6, 17):
check_cp1_registers(ctx, fs | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mov.d";
break;
case FOP(7, 17):
check_cp1_registers(ctx, fs | fd);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_chs_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "neg.d";
break;
case FOP(8, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_roundl_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "round.l.d";
break;
case FOP(9, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_truncl_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "trunc.l.d";
break;
case FOP(10, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_ceill_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "ceil.l.d";
break;
case FOP(11, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_floorl_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "floor.l.d";
break;
case FOP(12, 17):
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_roundw_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "round.w.d";
break;
case FOP(13, 17):
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_truncw_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "trunc.w.d";
break;
case FOP(14, 17):
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_ceilw_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "ceil.w.d";
break;
case FOP(15, 17):
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_floorw_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "floor.w.d";
break;
case FOP(17, 17):
gen_movcf_d(ctx, fs, fd, (ft >> 2) & 0x7, ft & 0x1);
opn = "movcf.d";
break;
case FOP(18, 17):
{
int l1 = gen_new_label();
TCGv_i64 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[ft], 0, l1);
}
fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
gen_set_label(l1);
}
opn = "movz.d";
break;
case FOP(19, 17):
{
int l1 = gen_new_label();
TCGv_i64 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[ft], 0, l1);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
gen_set_label(l1);
}
}
opn = "movn.d";
break;
case FOP(21, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_recip_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip.d";
break;
case FOP(22, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_rsqrt_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt.d";
break;
case FOP(28, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_recip2_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip2.d";
break;
case FOP(29, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_recip1_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip1.d";
break;
case FOP(30, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_rsqrt1_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt1.d";
break;
case FOP(31, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_rsqrt2_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt2.d";
break;
case FOP(48, 17):
case FOP(49, 17):
case FOP(50, 17):
case FOP(51, 17):
case FOP(52, 17):
case FOP(53, 17):
case FOP(54, 17):
case FOP(55, 17):
case FOP(56, 17):
case FOP(57, 17):
case FOP(58, 17):
case FOP(59, 17):
case FOP(60, 17):
case FOP(61, 17):
case FOP(62, 17):
case FOP(63, 17):
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
if (ctx->opcode & (1 << 6)) {
check_cop1x(ctx);
check_cp1_registers(ctx, fs | ft);
gen_cmpabs_d(func-48, fp0, fp1, cc);
opn = condnames_abs[func-48];
} else {
check_cp1_registers(ctx, fs | ft);
gen_cmp_d(func-48, fp0, fp1, cc);
opn = condnames[func-48];
}
tcg_temp_free_i64(fp0);
tcg_temp_free_i64(fp1);
}
break;
case FOP(32, 17):
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_cvts_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "cvt.s.d";
break;
case FOP(36, 17):
check_cp1_registers(ctx, fs);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_cvtw_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "cvt.w.d";
break;
case FOP(37, 17):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_cvtl_d(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "cvt.l.d";
break;
case FOP(32, 20):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_cvts_w(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "cvt.s.w";
break;
case FOP(33, 20):
check_cp1_registers(ctx, fd);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, fs);
gen_helper_float_cvtd_w(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(ctx, fp64, fd);
tcg_temp_free_i64(fp64);
}
opn = "cvt.d.w";
break;
case FOP(32, 21):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp64, fs);
gen_helper_float_cvts_l(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, fd);
tcg_temp_free_i32(fp32);
}
opn = "cvt.s.l";
break;
case FOP(33, 21):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_cvtd_l(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "cvt.d.l";
break;
case FOP(38, 20):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_cvtps_pw(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "cvt.ps.pw";
break;
case FOP(0, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_add_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "add.ps";
break;
case FOP(1, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_sub_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "sub.ps";
break;
case FOP(2, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_mul_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mul.ps";
break;
case FOP(5, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_abs_ps(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "abs.ps";
break;
case FOP(6, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mov.ps";
break;
case FOP(7, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_chs_ps(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "neg.ps";
break;
case FOP(17, 22):
check_cp1_64bitmode(ctx);
gen_movcf_ps(fs, fd, (ft >> 2) & 0x7, ft & 0x1);
opn = "movcf.ps";
break;
case FOP(18, 22):
check_cp1_64bitmode(ctx);
{
int l1 = gen_new_label();
TCGv_i64 fp0;
if (ft != 0)
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[ft], 0, l1);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
gen_set_label(l1);
}
opn = "movz.ps";
break;
case FOP(19, 22):
check_cp1_64bitmode(ctx);
{
int l1 = gen_new_label();
TCGv_i64 fp0;
if (ft != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[ft], 0, l1);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
gen_set_label(l1);
}
}
opn = "movn.ps";
break;
case FOP(24, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, ft);
gen_load_fpr64(ctx, fp1, fs);
gen_helper_float_addr_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "addr.ps";
break;
case FOP(26, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, ft);
gen_load_fpr64(ctx, fp1, fs);
gen_helper_float_mulr_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "mulr.ps";
break;
case FOP(28, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, fd);
gen_helper_float_recip2_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip2.ps";
break;
case FOP(29, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_recip1_ps(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "recip1.ps";
break;
case FOP(30, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_rsqrt1_ps(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt1.ps";
break;
case FOP(31, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
gen_helper_float_rsqrt2_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "rsqrt2.ps";
break;
case FOP(32, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, fs);
gen_helper_float_cvts_pu(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "cvt.s.pu";
break;
case FOP(36, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_helper_float_cvtpw_ps(fp0, fp0);
gen_store_fpr64(ctx, fp0, fd);
tcg_temp_free_i64(fp0);
}
opn = "cvt.pw.ps";
break;
case FOP(40, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_helper_float_cvts_pl(fp0, fp0);
gen_store_fpr32(fp0, fd);
tcg_temp_free_i32(fp0);
}
opn = "cvt.s.pl";
break;
case FOP(44, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_store_fpr32h(fp0, fd);
gen_store_fpr32(fp1, fd);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
opn = "pll.ps";
break;
case FOP(45, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, fs);
gen_load_fpr32h(fp1, ft);
gen_store_fpr32(fp1, fd);
gen_store_fpr32h(fp0, fd);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
opn = "plu.ps";
break;
case FOP(46, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, fs);
gen_load_fpr32(fp1, ft);
gen_store_fpr32(fp1, fd);
gen_store_fpr32h(fp0, fd);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
opn = "pul.ps";
break;
case FOP(47, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, fs);
gen_load_fpr32h(fp1, ft);
gen_store_fpr32(fp1, fd);
gen_store_fpr32h(fp0, fd);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
opn = "puu.ps";
break;
case FOP(48, 22):
case FOP(49, 22):
case FOP(50, 22):
case FOP(51, 22):
case FOP(52, 22):
case FOP(53, 22):
case FOP(54, 22):
case FOP(55, 22):
case FOP(56, 22):
case FOP(57, 22):
case FOP(58, 22):
case FOP(59, 22):
case FOP(60, 22):
case FOP(61, 22):
case FOP(62, 22):
case FOP(63, 22):
check_cp1_64bitmode(ctx);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(ctx, fp0, fs);
gen_load_fpr64(ctx, fp1, ft);
if (ctx->opcode & (1 << 6)) {
gen_cmpabs_ps(func-48, fp0, fp1, cc);
opn = condnames_abs[func-48];
} else {
gen_cmp_ps(func-48, fp0, fp1, cc);
opn = condnames[func-48];
}
tcg_temp_free_i64(fp0);
tcg_temp_free_i64(fp1);
}
break;
default:
MIPS_INVAL(opn);
generate_exception (ctx, EXCP_RI);
return;
}
switch (optype) {
case BINOP:
MIPS_DEBUG("%s %s, %s, %s", opn, fregnames[fd], fregnames[fs], fregnames[ft]);
break;
case CMPOP:
MIPS_DEBUG("%s %s,%s", opn, fregnames[fs], fregnames[ft]);
break;
default:
MIPS_DEBUG("%s %s,%s", opn, fregnames[fd], fregnames[fs]);
break;
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0 (DisasContext *VAR_0, uint32_t VAR_1,
int VAR_2, int VAR_3, int VAR_4, int VAR_5)
{
const char *VAR_6 = "farith";
const char *VAR_7[] = {
"c.f",
"c.un",
"c.eq",
"c.ueq",
"c.olt",
"c.ult",
"c.ole",
"c.ule",
"c.sf",
"c.ngle",
"c.seq",
"c.ngl",
"c.lt",
"c.nge",
"c.le",
"c.ngt",
};
const char *VAR_8[] = {
"cabs.f",
"cabs.un",
"cabs.eq",
"cabs.ueq",
"cabs.olt",
"cabs.ult",
"cabs.ole",
"cabs.ule",
"cabs.sf",
"cabs.ngle",
"cabs.seq",
"cabs.ngl",
"cabs.lt",
"cabs.nge",
"cabs.le",
"cabs.ngt",
};
enum { BINOP, CMPOP, OTHEROP } VAR_9 = OTHEROP;
uint32_t func = VAR_0->opcode & 0x3f;
switch (VAR_0->opcode & FOP(0x3f, 0x1f)) {
case FOP(0, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_load_fpr32(fp1, VAR_2);
gen_helper_float_add_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "add.s";
VAR_9 = BINOP;
break;
case FOP(1, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_load_fpr32(fp1, VAR_2);
gen_helper_float_sub_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "sub.s";
VAR_9 = BINOP;
break;
case FOP(2, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_load_fpr32(fp1, VAR_2);
gen_helper_float_mul_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "mul.s";
VAR_9 = BINOP;
break;
case FOP(3, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_load_fpr32(fp1, VAR_2);
gen_helper_float_div_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "div.s";
VAR_9 = BINOP;
break;
case FOP(4, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_sqrt_s(fp0, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "sqrt.s";
break;
case FOP(5, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_abs_s(fp0, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "abs.s";
break;
case FOP(6, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "mov.s";
break;
case FOP(7, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_chs_s(fp0, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "neg.s";
break;
case FOP(8, 16):
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, VAR_3);
gen_helper_float_roundl_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(VAR_0, fp64, VAR_4);
tcg_temp_free_i64(fp64);
}
VAR_6 = "round.l.s";
break;
case FOP(9, 16):
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, VAR_3);
gen_helper_float_truncl_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(VAR_0, fp64, VAR_4);
tcg_temp_free_i64(fp64);
}
VAR_6 = "trunc.l.s";
break;
case FOP(10, 16):
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, VAR_3);
gen_helper_float_ceill_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(VAR_0, fp64, VAR_4);
tcg_temp_free_i64(fp64);
}
VAR_6 = "ceil.l.s";
break;
case FOP(11, 16):
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, VAR_3);
gen_helper_float_floorl_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(VAR_0, fp64, VAR_4);
tcg_temp_free_i64(fp64);
}
VAR_6 = "floor.l.s";
break;
case FOP(12, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_roundw_s(fp0, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "round.w.s";
break;
case FOP(13, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_truncw_s(fp0, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "trunc.w.s";
break;
case FOP(14, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_ceilw_s(fp0, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "ceil.w.s";
break;
case FOP(15, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_floorw_s(fp0, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "floor.w.s";
break;
case FOP(17, 16):
gen_movcf_s(VAR_3, VAR_4, (VAR_2 >> 2) & 0x7, VAR_2 & 0x1);
VAR_6 = "movcf.s";
break;
case FOP(18, 16):
{
int VAR_11 = gen_new_label();
TCGv_i32 fp0;
if (VAR_2 != 0) {
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[VAR_2], 0, VAR_11);
}
fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
gen_set_label(VAR_11);
}
VAR_6 = "movz.s";
break;
case FOP(19, 16):
{
int VAR_11 = gen_new_label();
TCGv_i32 fp0;
if (VAR_2 != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[VAR_2], 0, VAR_11);
fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
gen_set_label(VAR_11);
}
}
VAR_6 = "movn.s";
break;
case FOP(21, 16):
check_cop1x(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_recip_s(fp0, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "recip.s";
break;
case FOP(22, 16):
check_cop1x(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_rsqrt_s(fp0, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "rsqrt.s";
break;
case FOP(28, 16):
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_load_fpr32(fp1, VAR_4);
gen_helper_float_recip2_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "recip2.s";
break;
case FOP(29, 16):
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_recip1_s(fp0, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "recip1.s";
break;
case FOP(30, 16):
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_rsqrt1_s(fp0, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "rsqrt1.s";
break;
case FOP(31, 16):
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_load_fpr32(fp1, VAR_2);
gen_helper_float_rsqrt2_s(fp0, fp0, fp1);
tcg_temp_free_i32(fp1);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "rsqrt2.s";
break;
case FOP(33, 16):
check_cp1_registers(VAR_0, VAR_4);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, VAR_3);
gen_helper_float_cvtd_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(VAR_0, fp64, VAR_4);
tcg_temp_free_i64(fp64);
}
VAR_6 = "cvt.d.s";
break;
case FOP(36, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_cvtw_s(fp0, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "cvt.w.s";
break;
case FOP(37, 16):
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, VAR_3);
gen_helper_float_cvtl_s(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(VAR_0, fp64, VAR_4);
tcg_temp_free_i64(fp64);
}
VAR_6 = "cvt.l.s";
break;
case FOP(38, 16):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp64 = tcg_temp_new_i64();
TCGv_i32 fp32_0 = tcg_temp_new_i32();
TCGv_i32 fp32_1 = tcg_temp_new_i32();
gen_load_fpr32(fp32_0, VAR_3);
gen_load_fpr32(fp32_1, VAR_2);
tcg_gen_concat_i32_i64(fp64, fp32_0, fp32_1);
tcg_temp_free_i32(fp32_1);
tcg_temp_free_i32(fp32_0);
gen_store_fpr64(VAR_0, fp64, VAR_4);
tcg_temp_free_i64(fp64);
}
VAR_6 = "cvt.ps.s";
break;
case FOP(48, 16):
case FOP(49, 16):
case FOP(50, 16):
case FOP(51, 16):
case FOP(52, 16):
case FOP(53, 16):
case FOP(54, 16):
case FOP(55, 16):
case FOP(56, 16):
case FOP(57, 16):
case FOP(58, 16):
case FOP(59, 16):
case FOP(60, 16):
case FOP(61, 16):
case FOP(62, 16):
case FOP(63, 16):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_load_fpr32(fp1, VAR_2);
if (VAR_0->opcode & (1 << 6)) {
check_cop1x(VAR_0);
gen_cmpabs_s(func-48, fp0, fp1, VAR_5);
VAR_6 = VAR_8[func-48];
} else {
gen_cmp_s(func-48, fp0, fp1, VAR_5);
VAR_6 = VAR_7[func-48];
}
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
break;
case FOP(0, 17):
check_cp1_registers(VAR_0, VAR_3 | VAR_2 | VAR_4);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_add_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "add.d";
VAR_9 = BINOP;
break;
case FOP(1, 17):
check_cp1_registers(VAR_0, VAR_3 | VAR_2 | VAR_4);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_sub_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "sub.d";
VAR_9 = BINOP;
break;
case FOP(2, 17):
check_cp1_registers(VAR_0, VAR_3 | VAR_2 | VAR_4);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_mul_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "mul.d";
VAR_9 = BINOP;
break;
case FOP(3, 17):
check_cp1_registers(VAR_0, VAR_3 | VAR_2 | VAR_4);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_div_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "div.d";
VAR_9 = BINOP;
break;
case FOP(4, 17):
check_cp1_registers(VAR_0, VAR_3 | VAR_4);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_sqrt_d(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "sqrt.d";
break;
case FOP(5, 17):
check_cp1_registers(VAR_0, VAR_3 | VAR_4);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_abs_d(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "abs.d";
break;
case FOP(6, 17):
check_cp1_registers(VAR_0, VAR_3 | VAR_4);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "mov.d";
break;
case FOP(7, 17):
check_cp1_registers(VAR_0, VAR_3 | VAR_4);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_chs_d(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "neg.d";
break;
case FOP(8, 17):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_roundl_d(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "round.l.d";
break;
case FOP(9, 17):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_truncl_d(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "trunc.l.d";
break;
case FOP(10, 17):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_ceill_d(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "ceil.l.d";
break;
case FOP(11, 17):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_floorl_d(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "floor.l.d";
break;
case FOP(12, 17):
check_cp1_registers(VAR_0, VAR_3);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp64, VAR_3);
gen_helper_float_roundw_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, VAR_4);
tcg_temp_free_i32(fp32);
}
VAR_6 = "round.w.d";
break;
case FOP(13, 17):
check_cp1_registers(VAR_0, VAR_3);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp64, VAR_3);
gen_helper_float_truncw_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, VAR_4);
tcg_temp_free_i32(fp32);
}
VAR_6 = "trunc.w.d";
break;
case FOP(14, 17):
check_cp1_registers(VAR_0, VAR_3);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp64, VAR_3);
gen_helper_float_ceilw_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, VAR_4);
tcg_temp_free_i32(fp32);
}
VAR_6 = "ceil.w.d";
break;
case FOP(15, 17):
check_cp1_registers(VAR_0, VAR_3);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp64, VAR_3);
gen_helper_float_floorw_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, VAR_4);
tcg_temp_free_i32(fp32);
}
VAR_6 = "floor.w.d";
break;
case FOP(17, 17):
gen_movcf_d(VAR_0, VAR_3, VAR_4, (VAR_2 >> 2) & 0x7, VAR_2 & 0x1);
VAR_6 = "movcf.d";
break;
case FOP(18, 17):
{
int VAR_11 = gen_new_label();
TCGv_i64 fp0;
if (VAR_2 != 0) {
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[VAR_2], 0, VAR_11);
}
fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
gen_set_label(VAR_11);
}
VAR_6 = "movz.d";
break;
case FOP(19, 17):
{
int VAR_11 = gen_new_label();
TCGv_i64 fp0;
if (VAR_2 != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[VAR_2], 0, VAR_11);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
gen_set_label(VAR_11);
}
}
VAR_6 = "movn.d";
break;
case FOP(21, 17):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_recip_d(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "recip.d";
break;
case FOP(22, 17):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_rsqrt_d(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "rsqrt.d";
break;
case FOP(28, 17):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_recip2_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "recip2.d";
break;
case FOP(29, 17):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_recip1_d(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "recip1.d";
break;
case FOP(30, 17):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_rsqrt1_d(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "rsqrt1.d";
break;
case FOP(31, 17):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_rsqrt2_d(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "rsqrt2.d";
break;
case FOP(48, 17):
case FOP(49, 17):
case FOP(50, 17):
case FOP(51, 17):
case FOP(52, 17):
case FOP(53, 17):
case FOP(54, 17):
case FOP(55, 17):
case FOP(56, 17):
case FOP(57, 17):
case FOP(58, 17):
case FOP(59, 17):
case FOP(60, 17):
case FOP(61, 17):
case FOP(62, 17):
case FOP(63, 17):
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
if (VAR_0->opcode & (1 << 6)) {
check_cop1x(VAR_0);
check_cp1_registers(VAR_0, VAR_3 | VAR_2);
gen_cmpabs_d(func-48, fp0, fp1, VAR_5);
VAR_6 = VAR_8[func-48];
} else {
check_cp1_registers(VAR_0, VAR_3 | VAR_2);
gen_cmp_d(func-48, fp0, fp1, VAR_5);
VAR_6 = VAR_7[func-48];
}
tcg_temp_free_i64(fp0);
tcg_temp_free_i64(fp1);
}
break;
case FOP(32, 17):
check_cp1_registers(VAR_0, VAR_3);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp64, VAR_3);
gen_helper_float_cvts_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, VAR_4);
tcg_temp_free_i32(fp32);
}
VAR_6 = "cvt.s.d";
break;
case FOP(36, 17):
check_cp1_registers(VAR_0, VAR_3);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp64, VAR_3);
gen_helper_float_cvtw_d(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, VAR_4);
tcg_temp_free_i32(fp32);
}
VAR_6 = "cvt.w.d";
break;
case FOP(37, 17):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_cvtl_d(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "cvt.l.d";
break;
case FOP(32, 20):
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_cvts_w(fp0, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "cvt.s.w";
break;
case FOP(33, 20):
check_cp1_registers(VAR_0, VAR_4);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr32(fp32, VAR_3);
gen_helper_float_cvtd_w(fp64, fp32);
tcg_temp_free_i32(fp32);
gen_store_fpr64(VAR_0, fp64, VAR_4);
tcg_temp_free_i64(fp64);
}
VAR_6 = "cvt.d.w";
break;
case FOP(32, 21):
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp32 = tcg_temp_new_i32();
TCGv_i64 fp64 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp64, VAR_3);
gen_helper_float_cvts_l(fp32, fp64);
tcg_temp_free_i64(fp64);
gen_store_fpr32(fp32, VAR_4);
tcg_temp_free_i32(fp32);
}
VAR_6 = "cvt.s.l";
break;
case FOP(33, 21):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_cvtd_l(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "cvt.d.l";
break;
case FOP(38, 20):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_cvtps_pw(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "cvt.ps.pw";
break;
case FOP(0, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_add_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "add.ps";
break;
case FOP(1, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_sub_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "sub.ps";
break;
case FOP(2, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_mul_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "mul.ps";
break;
case FOP(5, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_abs_ps(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "abs.ps";
break;
case FOP(6, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "mov.ps";
break;
case FOP(7, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_chs_ps(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "neg.ps";
break;
case FOP(17, 22):
check_cp1_64bitmode(VAR_0);
gen_movcf_ps(VAR_3, VAR_4, (VAR_2 >> 2) & 0x7, VAR_2 & 0x1);
VAR_6 = "movcf.ps";
break;
case FOP(18, 22):
check_cp1_64bitmode(VAR_0);
{
int VAR_11 = gen_new_label();
TCGv_i64 fp0;
if (VAR_2 != 0)
tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[VAR_2], 0, VAR_11);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
gen_set_label(VAR_11);
}
VAR_6 = "movz.ps";
break;
case FOP(19, 22):
check_cp1_64bitmode(VAR_0);
{
int VAR_11 = gen_new_label();
TCGv_i64 fp0;
if (VAR_2 != 0) {
tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[VAR_2], 0, VAR_11);
fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
gen_set_label(VAR_11);
}
}
VAR_6 = "movn.ps";
break;
case FOP(24, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_2);
gen_load_fpr64(VAR_0, fp1, VAR_3);
gen_helper_float_addr_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "addr.ps";
break;
case FOP(26, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_2);
gen_load_fpr64(VAR_0, fp1, VAR_3);
gen_helper_float_mulr_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "mulr.ps";
break;
case FOP(28, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_4);
gen_helper_float_recip2_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "recip2.ps";
break;
case FOP(29, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_recip1_ps(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "recip1.ps";
break;
case FOP(30, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_rsqrt1_ps(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "rsqrt1.ps";
break;
case FOP(31, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
gen_helper_float_rsqrt2_ps(fp0, fp0, fp1);
tcg_temp_free_i64(fp1);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "rsqrt2.ps";
break;
case FOP(32, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, VAR_3);
gen_helper_float_cvts_pu(fp0, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "cvt.s.pu";
break;
case FOP(36, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_helper_float_cvtpw_ps(fp0, fp0);
gen_store_fpr64(VAR_0, fp0, VAR_4);
tcg_temp_free_i64(fp0);
}
VAR_6 = "cvt.pw.ps";
break;
case FOP(40, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_helper_float_cvts_pl(fp0, fp0);
gen_store_fpr32(fp0, VAR_4);
tcg_temp_free_i32(fp0);
}
VAR_6 = "cvt.s.pl";
break;
case FOP(44, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_load_fpr32(fp1, VAR_2);
gen_store_fpr32h(fp0, VAR_4);
gen_store_fpr32(fp1, VAR_4);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
VAR_6 = "pll.ps";
break;
case FOP(45, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32(fp0, VAR_3);
gen_load_fpr32h(fp1, VAR_2);
gen_store_fpr32(fp1, VAR_4);
gen_store_fpr32h(fp0, VAR_4);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
VAR_6 = "plu.ps";
break;
case FOP(46, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, VAR_3);
gen_load_fpr32(fp1, VAR_2);
gen_store_fpr32(fp1, VAR_4);
gen_store_fpr32h(fp0, VAR_4);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
VAR_6 = "pul.ps";
break;
case FOP(47, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i32 fp0 = tcg_temp_new_i32();
TCGv_i32 fp1 = tcg_temp_new_i32();
gen_load_fpr32h(fp0, VAR_3);
gen_load_fpr32h(fp1, VAR_2);
gen_store_fpr32(fp1, VAR_4);
gen_store_fpr32h(fp0, VAR_4);
tcg_temp_free_i32(fp0);
tcg_temp_free_i32(fp1);
}
VAR_6 = "puu.ps";
break;
case FOP(48, 22):
case FOP(49, 22):
case FOP(50, 22):
case FOP(51, 22):
case FOP(52, 22):
case FOP(53, 22):
case FOP(54, 22):
case FOP(55, 22):
case FOP(56, 22):
case FOP(57, 22):
case FOP(58, 22):
case FOP(59, 22):
case FOP(60, 22):
case FOP(61, 22):
case FOP(62, 22):
case FOP(63, 22):
check_cp1_64bitmode(VAR_0);
{
TCGv_i64 fp0 = tcg_temp_new_i64();
TCGv_i64 fp1 = tcg_temp_new_i64();
gen_load_fpr64(VAR_0, fp0, VAR_3);
gen_load_fpr64(VAR_0, fp1, VAR_2);
if (VAR_0->opcode & (1 << 6)) {
gen_cmpabs_ps(func-48, fp0, fp1, VAR_5);
VAR_6 = VAR_8[func-48];
} else {
gen_cmp_ps(func-48, fp0, fp1, VAR_5);
VAR_6 = VAR_7[func-48];
}
tcg_temp_free_i64(fp0);
tcg_temp_free_i64(fp1);
}
break;
default:
MIPS_INVAL(VAR_6);
generate_exception (VAR_0, EXCP_RI);
return;
}
switch (VAR_9) {
case BINOP:
MIPS_DEBUG("%s %s, %s, %s", VAR_6, fregnames[VAR_4], fregnames[VAR_3], fregnames[VAR_2]);
break;
case CMPOP:
MIPS_DEBUG("%s %s,%s", VAR_6, fregnames[VAR_3], fregnames[VAR_2]);
break;
default:
MIPS_DEBUG("%s %s,%s", VAR_6, fregnames[VAR_4], fregnames[VAR_3]);
break;
}
}
| [
"static void FUNC_0 (DisasContext *VAR_0, uint32_t VAR_1,\nint VAR_2, int VAR_3, int VAR_4, int VAR_5)\n{",
"const char *VAR_6 = \"farith\";",
"const char *VAR_7[] = {",
"\"c.f\",\n\"c.un\",\n\"c.eq\",\n\"c.ueq\",\n\"c.olt\",\n\"c.ult\",\n\"c.ole\",\n\"c.ule\",\n\"c.sf\",\n\"c.ngle\",\n\"c.seq\",\n\"c.ngl\",\n\"c.lt\",\n\"c.nge\",\n\"c.le\",\n\"c.ngt\",\n};",
"const char *VAR_8[] = {",
"\"cabs.f\",\n\"cabs.un\",\n\"cabs.eq\",\n\"cabs.ueq\",\n\"cabs.olt\",\n\"cabs.ult\",\n\"cabs.ole\",\n\"cabs.ule\",\n\"cabs.sf\",\n\"cabs.ngle\",\n\"cabs.seq\",\n\"cabs.ngl\",\n\"cabs.lt\",\n\"cabs.nge\",\n\"cabs.le\",\n\"cabs.ngt\",\n};",
"enum { BINOP, CMPOP, OTHEROP } VAR_9 = OTHEROP;",
"uint32_t func = VAR_0->opcode & 0x3f;",
"switch (VAR_0->opcode & FOP(0x3f, 0x1f)) {",
"case FOP(0, 16):\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_load_fpr32(fp1, VAR_2);",
"gen_helper_float_add_s(fp0, fp0, fp1);",
"tcg_temp_free_i32(fp1);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"add.s\";",
"VAR_9 = BINOP;",
"break;",
"case FOP(1, 16):\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_load_fpr32(fp1, VAR_2);",
"gen_helper_float_sub_s(fp0, fp0, fp1);",
"tcg_temp_free_i32(fp1);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"sub.s\";",
"VAR_9 = BINOP;",
"break;",
"case FOP(2, 16):\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_load_fpr32(fp1, VAR_2);",
"gen_helper_float_mul_s(fp0, fp0, fp1);",
"tcg_temp_free_i32(fp1);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"mul.s\";",
"VAR_9 = BINOP;",
"break;",
"case FOP(3, 16):\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_load_fpr32(fp1, VAR_2);",
"gen_helper_float_div_s(fp0, fp0, fp1);",
"tcg_temp_free_i32(fp1);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"div.s\";",
"VAR_9 = BINOP;",
"break;",
"case FOP(4, 16):\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_sqrt_s(fp0, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"sqrt.s\";",
"break;",
"case FOP(5, 16):\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_abs_s(fp0, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"abs.s\";",
"break;",
"case FOP(6, 16):\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"mov.s\";",
"break;",
"case FOP(7, 16):\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_chs_s(fp0, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"neg.s\";",
"break;",
"case FOP(8, 16):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr32(fp32, VAR_3);",
"gen_helper_float_roundl_s(fp64, fp32);",
"tcg_temp_free_i32(fp32);",
"gen_store_fpr64(VAR_0, fp64, VAR_4);",
"tcg_temp_free_i64(fp64);",
"}",
"VAR_6 = \"round.l.s\";",
"break;",
"case FOP(9, 16):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr32(fp32, VAR_3);",
"gen_helper_float_truncl_s(fp64, fp32);",
"tcg_temp_free_i32(fp32);",
"gen_store_fpr64(VAR_0, fp64, VAR_4);",
"tcg_temp_free_i64(fp64);",
"}",
"VAR_6 = \"trunc.l.s\";",
"break;",
"case FOP(10, 16):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr32(fp32, VAR_3);",
"gen_helper_float_ceill_s(fp64, fp32);",
"tcg_temp_free_i32(fp32);",
"gen_store_fpr64(VAR_0, fp64, VAR_4);",
"tcg_temp_free_i64(fp64);",
"}",
"VAR_6 = \"ceil.l.s\";",
"break;",
"case FOP(11, 16):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr32(fp32, VAR_3);",
"gen_helper_float_floorl_s(fp64, fp32);",
"tcg_temp_free_i32(fp32);",
"gen_store_fpr64(VAR_0, fp64, VAR_4);",
"tcg_temp_free_i64(fp64);",
"}",
"VAR_6 = \"floor.l.s\";",
"break;",
"case FOP(12, 16):\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_roundw_s(fp0, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"round.w.s\";",
"break;",
"case FOP(13, 16):\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_truncw_s(fp0, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"trunc.w.s\";",
"break;",
"case FOP(14, 16):\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_ceilw_s(fp0, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"ceil.w.s\";",
"break;",
"case FOP(15, 16):\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_floorw_s(fp0, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"floor.w.s\";",
"break;",
"case FOP(17, 16):\ngen_movcf_s(VAR_3, VAR_4, (VAR_2 >> 2) & 0x7, VAR_2 & 0x1);",
"VAR_6 = \"movcf.s\";",
"break;",
"case FOP(18, 16):\n{",
"int VAR_11 = gen_new_label();",
"TCGv_i32 fp0;",
"if (VAR_2 != 0) {",
"tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[VAR_2], 0, VAR_11);",
"}",
"fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"gen_set_label(VAR_11);",
"}",
"VAR_6 = \"movz.s\";",
"break;",
"case FOP(19, 16):\n{",
"int VAR_11 = gen_new_label();",
"TCGv_i32 fp0;",
"if (VAR_2 != 0) {",
"tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[VAR_2], 0, VAR_11);",
"fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"gen_set_label(VAR_11);",
"}",
"}",
"VAR_6 = \"movn.s\";",
"break;",
"case FOP(21, 16):\ncheck_cop1x(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_recip_s(fp0, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"recip.s\";",
"break;",
"case FOP(22, 16):\ncheck_cop1x(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_rsqrt_s(fp0, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"rsqrt.s\";",
"break;",
"case FOP(28, 16):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_load_fpr32(fp1, VAR_4);",
"gen_helper_float_recip2_s(fp0, fp0, fp1);",
"tcg_temp_free_i32(fp1);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"recip2.s\";",
"break;",
"case FOP(29, 16):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_recip1_s(fp0, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"recip1.s\";",
"break;",
"case FOP(30, 16):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_rsqrt1_s(fp0, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"rsqrt1.s\";",
"break;",
"case FOP(31, 16):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_load_fpr32(fp1, VAR_2);",
"gen_helper_float_rsqrt2_s(fp0, fp0, fp1);",
"tcg_temp_free_i32(fp1);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"rsqrt2.s\";",
"break;",
"case FOP(33, 16):\ncheck_cp1_registers(VAR_0, VAR_4);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr32(fp32, VAR_3);",
"gen_helper_float_cvtd_s(fp64, fp32);",
"tcg_temp_free_i32(fp32);",
"gen_store_fpr64(VAR_0, fp64, VAR_4);",
"tcg_temp_free_i64(fp64);",
"}",
"VAR_6 = \"cvt.d.s\";",
"break;",
"case FOP(36, 16):\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_cvtw_s(fp0, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"cvt.w.s\";",
"break;",
"case FOP(37, 16):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr32(fp32, VAR_3);",
"gen_helper_float_cvtl_s(fp64, fp32);",
"tcg_temp_free_i32(fp32);",
"gen_store_fpr64(VAR_0, fp64, VAR_4);",
"tcg_temp_free_i64(fp64);",
"}",
"VAR_6 = \"cvt.l.s\";",
"break;",
"case FOP(38, 16):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"TCGv_i32 fp32_0 = tcg_temp_new_i32();",
"TCGv_i32 fp32_1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp32_0, VAR_3);",
"gen_load_fpr32(fp32_1, VAR_2);",
"tcg_gen_concat_i32_i64(fp64, fp32_0, fp32_1);",
"tcg_temp_free_i32(fp32_1);",
"tcg_temp_free_i32(fp32_0);",
"gen_store_fpr64(VAR_0, fp64, VAR_4);",
"tcg_temp_free_i64(fp64);",
"}",
"VAR_6 = \"cvt.ps.s\";",
"break;",
"case FOP(48, 16):\ncase FOP(49, 16):\ncase FOP(50, 16):\ncase FOP(51, 16):\ncase FOP(52, 16):\ncase FOP(53, 16):\ncase FOP(54, 16):\ncase FOP(55, 16):\ncase FOP(56, 16):\ncase FOP(57, 16):\ncase FOP(58, 16):\ncase FOP(59, 16):\ncase FOP(60, 16):\ncase FOP(61, 16):\ncase FOP(62, 16):\ncase FOP(63, 16):\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_load_fpr32(fp1, VAR_2);",
"if (VAR_0->opcode & (1 << 6)) {",
"check_cop1x(VAR_0);",
"gen_cmpabs_s(func-48, fp0, fp1, VAR_5);",
"VAR_6 = VAR_8[func-48];",
"} else {",
"gen_cmp_s(func-48, fp0, fp1, VAR_5);",
"VAR_6 = VAR_7[func-48];",
"}",
"tcg_temp_free_i32(fp0);",
"tcg_temp_free_i32(fp1);",
"}",
"break;",
"case FOP(0, 17):\ncheck_cp1_registers(VAR_0, VAR_3 | VAR_2 | VAR_4);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_add_d(fp0, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"add.d\";",
"VAR_9 = BINOP;",
"break;",
"case FOP(1, 17):\ncheck_cp1_registers(VAR_0, VAR_3 | VAR_2 | VAR_4);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_sub_d(fp0, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"sub.d\";",
"VAR_9 = BINOP;",
"break;",
"case FOP(2, 17):\ncheck_cp1_registers(VAR_0, VAR_3 | VAR_2 | VAR_4);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_mul_d(fp0, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"mul.d\";",
"VAR_9 = BINOP;",
"break;",
"case FOP(3, 17):\ncheck_cp1_registers(VAR_0, VAR_3 | VAR_2 | VAR_4);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_div_d(fp0, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"div.d\";",
"VAR_9 = BINOP;",
"break;",
"case FOP(4, 17):\ncheck_cp1_registers(VAR_0, VAR_3 | VAR_4);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_sqrt_d(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"sqrt.d\";",
"break;",
"case FOP(5, 17):\ncheck_cp1_registers(VAR_0, VAR_3 | VAR_4);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_abs_d(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"abs.d\";",
"break;",
"case FOP(6, 17):\ncheck_cp1_registers(VAR_0, VAR_3 | VAR_4);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"mov.d\";",
"break;",
"case FOP(7, 17):\ncheck_cp1_registers(VAR_0, VAR_3 | VAR_4);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_chs_d(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"neg.d\";",
"break;",
"case FOP(8, 17):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_roundl_d(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"round.l.d\";",
"break;",
"case FOP(9, 17):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_truncl_d(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"trunc.l.d\";",
"break;",
"case FOP(10, 17):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_ceill_d(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"ceil.l.d\";",
"break;",
"case FOP(11, 17):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_floorl_d(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"floor.l.d\";",
"break;",
"case FOP(12, 17):\ncheck_cp1_registers(VAR_0, VAR_3);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp64, VAR_3);",
"gen_helper_float_roundw_d(fp32, fp64);",
"tcg_temp_free_i64(fp64);",
"gen_store_fpr32(fp32, VAR_4);",
"tcg_temp_free_i32(fp32);",
"}",
"VAR_6 = \"round.w.d\";",
"break;",
"case FOP(13, 17):\ncheck_cp1_registers(VAR_0, VAR_3);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp64, VAR_3);",
"gen_helper_float_truncw_d(fp32, fp64);",
"tcg_temp_free_i64(fp64);",
"gen_store_fpr32(fp32, VAR_4);",
"tcg_temp_free_i32(fp32);",
"}",
"VAR_6 = \"trunc.w.d\";",
"break;",
"case FOP(14, 17):\ncheck_cp1_registers(VAR_0, VAR_3);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp64, VAR_3);",
"gen_helper_float_ceilw_d(fp32, fp64);",
"tcg_temp_free_i64(fp64);",
"gen_store_fpr32(fp32, VAR_4);",
"tcg_temp_free_i32(fp32);",
"}",
"VAR_6 = \"ceil.w.d\";",
"break;",
"case FOP(15, 17):\ncheck_cp1_registers(VAR_0, VAR_3);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp64, VAR_3);",
"gen_helper_float_floorw_d(fp32, fp64);",
"tcg_temp_free_i64(fp64);",
"gen_store_fpr32(fp32, VAR_4);",
"tcg_temp_free_i32(fp32);",
"}",
"VAR_6 = \"floor.w.d\";",
"break;",
"case FOP(17, 17):\ngen_movcf_d(VAR_0, VAR_3, VAR_4, (VAR_2 >> 2) & 0x7, VAR_2 & 0x1);",
"VAR_6 = \"movcf.d\";",
"break;",
"case FOP(18, 17):\n{",
"int VAR_11 = gen_new_label();",
"TCGv_i64 fp0;",
"if (VAR_2 != 0) {",
"tcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[VAR_2], 0, VAR_11);",
"}",
"fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"gen_set_label(VAR_11);",
"}",
"VAR_6 = \"movz.d\";",
"break;",
"case FOP(19, 17):\n{",
"int VAR_11 = gen_new_label();",
"TCGv_i64 fp0;",
"if (VAR_2 != 0) {",
"tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[VAR_2], 0, VAR_11);",
"fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"gen_set_label(VAR_11);",
"}",
"}",
"VAR_6 = \"movn.d\";",
"break;",
"case FOP(21, 17):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_recip_d(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"recip.d\";",
"break;",
"case FOP(22, 17):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_rsqrt_d(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"rsqrt.d\";",
"break;",
"case FOP(28, 17):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_recip2_d(fp0, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"recip2.d\";",
"break;",
"case FOP(29, 17):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_recip1_d(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"recip1.d\";",
"break;",
"case FOP(30, 17):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_rsqrt1_d(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"rsqrt1.d\";",
"break;",
"case FOP(31, 17):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_rsqrt2_d(fp0, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"rsqrt2.d\";",
"break;",
"case FOP(48, 17):\ncase FOP(49, 17):\ncase FOP(50, 17):\ncase FOP(51, 17):\ncase FOP(52, 17):\ncase FOP(53, 17):\ncase FOP(54, 17):\ncase FOP(55, 17):\ncase FOP(56, 17):\ncase FOP(57, 17):\ncase FOP(58, 17):\ncase FOP(59, 17):\ncase FOP(60, 17):\ncase FOP(61, 17):\ncase FOP(62, 17):\ncase FOP(63, 17):\n{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"if (VAR_0->opcode & (1 << 6)) {",
"check_cop1x(VAR_0);",
"check_cp1_registers(VAR_0, VAR_3 | VAR_2);",
"gen_cmpabs_d(func-48, fp0, fp1, VAR_5);",
"VAR_6 = VAR_8[func-48];",
"} else {",
"check_cp1_registers(VAR_0, VAR_3 | VAR_2);",
"gen_cmp_d(func-48, fp0, fp1, VAR_5);",
"VAR_6 = VAR_7[func-48];",
"}",
"tcg_temp_free_i64(fp0);",
"tcg_temp_free_i64(fp1);",
"}",
"break;",
"case FOP(32, 17):\ncheck_cp1_registers(VAR_0, VAR_3);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp64, VAR_3);",
"gen_helper_float_cvts_d(fp32, fp64);",
"tcg_temp_free_i64(fp64);",
"gen_store_fpr32(fp32, VAR_4);",
"tcg_temp_free_i32(fp32);",
"}",
"VAR_6 = \"cvt.s.d\";",
"break;",
"case FOP(36, 17):\ncheck_cp1_registers(VAR_0, VAR_3);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp64, VAR_3);",
"gen_helper_float_cvtw_d(fp32, fp64);",
"tcg_temp_free_i64(fp64);",
"gen_store_fpr32(fp32, VAR_4);",
"tcg_temp_free_i32(fp32);",
"}",
"VAR_6 = \"cvt.w.d\";",
"break;",
"case FOP(37, 17):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_cvtl_d(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"cvt.l.d\";",
"break;",
"case FOP(32, 20):\n{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_cvts_w(fp0, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"cvt.s.w\";",
"break;",
"case FOP(33, 20):\ncheck_cp1_registers(VAR_0, VAR_4);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr32(fp32, VAR_3);",
"gen_helper_float_cvtd_w(fp64, fp32);",
"tcg_temp_free_i32(fp32);",
"gen_store_fpr64(VAR_0, fp64, VAR_4);",
"tcg_temp_free_i64(fp64);",
"}",
"VAR_6 = \"cvt.d.w\";",
"break;",
"case FOP(32, 21):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp32 = tcg_temp_new_i32();",
"TCGv_i64 fp64 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp64, VAR_3);",
"gen_helper_float_cvts_l(fp32, fp64);",
"tcg_temp_free_i64(fp64);",
"gen_store_fpr32(fp32, VAR_4);",
"tcg_temp_free_i32(fp32);",
"}",
"VAR_6 = \"cvt.s.l\";",
"break;",
"case FOP(33, 21):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_cvtd_l(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"cvt.d.l\";",
"break;",
"case FOP(38, 20):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_cvtps_pw(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"cvt.ps.pw\";",
"break;",
"case FOP(0, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_add_ps(fp0, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"add.ps\";",
"break;",
"case FOP(1, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_sub_ps(fp0, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"sub.ps\";",
"break;",
"case FOP(2, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_mul_ps(fp0, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"mul.ps\";",
"break;",
"case FOP(5, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_abs_ps(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"abs.ps\";",
"break;",
"case FOP(6, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"mov.ps\";",
"break;",
"case FOP(7, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_chs_ps(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"neg.ps\";",
"break;",
"case FOP(17, 22):\ncheck_cp1_64bitmode(VAR_0);",
"gen_movcf_ps(VAR_3, VAR_4, (VAR_2 >> 2) & 0x7, VAR_2 & 0x1);",
"VAR_6 = \"movcf.ps\";",
"break;",
"case FOP(18, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"int VAR_11 = gen_new_label();",
"TCGv_i64 fp0;",
"if (VAR_2 != 0)\ntcg_gen_brcondi_tl(TCG_COND_NE, cpu_gpr[VAR_2], 0, VAR_11);",
"fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"gen_set_label(VAR_11);",
"}",
"VAR_6 = \"movz.ps\";",
"break;",
"case FOP(19, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"int VAR_11 = gen_new_label();",
"TCGv_i64 fp0;",
"if (VAR_2 != 0) {",
"tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[VAR_2], 0, VAR_11);",
"fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"gen_set_label(VAR_11);",
"}",
"}",
"VAR_6 = \"movn.ps\";",
"break;",
"case FOP(24, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_2);",
"gen_load_fpr64(VAR_0, fp1, VAR_3);",
"gen_helper_float_addr_ps(fp0, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"addr.ps\";",
"break;",
"case FOP(26, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_2);",
"gen_load_fpr64(VAR_0, fp1, VAR_3);",
"gen_helper_float_mulr_ps(fp0, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"mulr.ps\";",
"break;",
"case FOP(28, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_4);",
"gen_helper_float_recip2_ps(fp0, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"recip2.ps\";",
"break;",
"case FOP(29, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_recip1_ps(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"recip1.ps\";",
"break;",
"case FOP(30, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_rsqrt1_ps(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"rsqrt1.ps\";",
"break;",
"case FOP(31, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"gen_helper_float_rsqrt2_ps(fp0, fp0, fp1);",
"tcg_temp_free_i64(fp1);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"rsqrt2.ps\";",
"break;",
"case FOP(32, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32h(fp0, VAR_3);",
"gen_helper_float_cvts_pu(fp0, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"cvt.s.pu\";",
"break;",
"case FOP(36, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_helper_float_cvtpw_ps(fp0, fp0);",
"gen_store_fpr64(VAR_0, fp0, VAR_4);",
"tcg_temp_free_i64(fp0);",
"}",
"VAR_6 = \"cvt.pw.ps\";",
"break;",
"case FOP(40, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_helper_float_cvts_pl(fp0, fp0);",
"gen_store_fpr32(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"}",
"VAR_6 = \"cvt.s.pl\";",
"break;",
"case FOP(44, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_load_fpr32(fp1, VAR_2);",
"gen_store_fpr32h(fp0, VAR_4);",
"gen_store_fpr32(fp1, VAR_4);",
"tcg_temp_free_i32(fp0);",
"tcg_temp_free_i32(fp1);",
"}",
"VAR_6 = \"pll.ps\";",
"break;",
"case FOP(45, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32(fp0, VAR_3);",
"gen_load_fpr32h(fp1, VAR_2);",
"gen_store_fpr32(fp1, VAR_4);",
"gen_store_fpr32h(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"tcg_temp_free_i32(fp1);",
"}",
"VAR_6 = \"plu.ps\";",
"break;",
"case FOP(46, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32h(fp0, VAR_3);",
"gen_load_fpr32(fp1, VAR_2);",
"gen_store_fpr32(fp1, VAR_4);",
"gen_store_fpr32h(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"tcg_temp_free_i32(fp1);",
"}",
"VAR_6 = \"pul.ps\";",
"break;",
"case FOP(47, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i32 fp0 = tcg_temp_new_i32();",
"TCGv_i32 fp1 = tcg_temp_new_i32();",
"gen_load_fpr32h(fp0, VAR_3);",
"gen_load_fpr32h(fp1, VAR_2);",
"gen_store_fpr32(fp1, VAR_4);",
"gen_store_fpr32h(fp0, VAR_4);",
"tcg_temp_free_i32(fp0);",
"tcg_temp_free_i32(fp1);",
"}",
"VAR_6 = \"puu.ps\";",
"break;",
"case FOP(48, 22):\ncase FOP(49, 22):\ncase FOP(50, 22):\ncase FOP(51, 22):\ncase FOP(52, 22):\ncase FOP(53, 22):\ncase FOP(54, 22):\ncase FOP(55, 22):\ncase FOP(56, 22):\ncase FOP(57, 22):\ncase FOP(58, 22):\ncase FOP(59, 22):\ncase FOP(60, 22):\ncase FOP(61, 22):\ncase FOP(62, 22):\ncase FOP(63, 22):\ncheck_cp1_64bitmode(VAR_0);",
"{",
"TCGv_i64 fp0 = tcg_temp_new_i64();",
"TCGv_i64 fp1 = tcg_temp_new_i64();",
"gen_load_fpr64(VAR_0, fp0, VAR_3);",
"gen_load_fpr64(VAR_0, fp1, VAR_2);",
"if (VAR_0->opcode & (1 << 6)) {",
"gen_cmpabs_ps(func-48, fp0, fp1, VAR_5);",
"VAR_6 = VAR_8[func-48];",
"} else {",
"gen_cmp_ps(func-48, fp0, fp1, VAR_5);",
"VAR_6 = VAR_7[func-48];",
"}",
"tcg_temp_free_i64(fp0);",
"tcg_temp_free_i64(fp1);",
"}",
"break;",
"default:\nMIPS_INVAL(VAR_6);",
"generate_exception (VAR_0, EXCP_RI);",
"return;",
"}",
"switch (VAR_9) {",
"case BINOP:\nMIPS_DEBUG(\"%s %s, %s, %s\", VAR_6, fregnames[VAR_4], fregnames[VAR_3], fregnames[VAR_2]);",
"break;",
"case CMPOP:\nMIPS_DEBUG(\"%s %s,%s\", VAR_6, fregnames[VAR_3], fregnames[VAR_2]);",
"break;",
"default:\nMIPS_DEBUG(\"%s %s,%s\", VAR_6, fregnames[VAR_4], fregnames[VAR_3]);",
"break;",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11,
13,
15,
17,
19,
21,
23,
25,
27,
29,
31,
33,
35,
37,
39,
41,
43
],
[
45
],
[
47,
49,
51,
53,
55,
57,
59,
61,
63,
65,
67,
69,
71,
73,
75,
77,
79
],
[
81
],
[
83
],
[
87
],
[
89,
91
],
[
93
],
[
95
],
[
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119,
121
],
[
123
],
[
125
],
[
129
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149,
151
],
[
153
],
[
155
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179,
181
],
[
183
],
[
185
],
[
189
],
[
191
],
[
193
],
[
195
],
[
197
],
[
199
],
[
201
],
[
203
],
[
205
],
[
207
],
[
209,
211
],
[
213
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
231,
233
],
[
235
],
[
239
],
[
241
],
[
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
253,
255
],
[
257
],
[
261
],
[
263
],
[
265
],
[
267
],
[
269
],
[
271
],
[
273,
275
],
[
277
],
[
281
],
[
283
],
[
285
],
[
287
],
[
289
],
[
291
],
[
293
],
[
295,
297
],
[
299
],
[
301
],
[
303
],
[
307
],
[
309
],
[
311
],
[
313
],
[
315
],
[
317
],
[
319
],
[
321
],
[
323,
325
],
[
327
],
[
329
],
[
331
],
[
335
],
[
337
],
[
339
],
[
341
],
[
343
],
[
345
],
[
347
],
[
349
],
[
351,
353
],
[
355
],
[
357
],
[
359
],
[
363
],
[
365
],
[
367
],
[
369
],
[
371
],
[
373
],
[
375
],
[
377
],
[
379,
381
],
[
383
],
[
385
],
[
387
],
[
391
],
[
393
],
[
395
],
[
397
],
[
399
],
[
401
],
[
403
],
[
405
],
[
407,
409
],
[
411
],
[
415
],
[
417
],
[
419
],
[
421
],
[
423
],
[
425
],
[
427
],
[
429,
431
],
[
433
],
[
437
],
[
439
],
[
441
],
[
443
],
[
445
],
[
447
],
[
449
],
[
451,
453
],
[
455
],
[
459
],
[
461
],
[
463
],
[
465
],
[
467
],
[
469
],
[
471
],
[
473,
475
],
[
477
],
[
481
],
[
483
],
[
485
],
[
487
],
[
489
],
[
491
],
[
493
],
[
495,
497
],
[
499
],
[
501
],
[
503,
505
],
[
507
],
[
509
],
[
513
],
[
515
],
[
517
],
[
519
],
[
521
],
[
523
],
[
525
],
[
527
],
[
529
],
[
531
],
[
533
],
[
535,
537
],
[
539
],
[
541
],
[
545
],
[
547
],
[
549
],
[
551
],
[
553
],
[
555
],
[
557
],
[
559
],
[
561
],
[
563
],
[
565
],
[
567,
569
],
[
571
],
[
573
],
[
577
],
[
579
],
[
581
],
[
583
],
[
585
],
[
587
],
[
589
],
[
591,
593
],
[
595
],
[
597
],
[
601
],
[
603
],
[
605
],
[
607
],
[
609
],
[
611
],
[
613
],
[
615,
617
],
[
619
],
[
621
],
[
623
],
[
627
],
[
629
],
[
631
],
[
633
],
[
635
],
[
637
],
[
639
],
[
641
],
[
643
],
[
645,
647
],
[
649
],
[
651
],
[
655
],
[
657
],
[
659
],
[
661
],
[
663
],
[
665
],
[
667
],
[
669,
671
],
[
673
],
[
675
],
[
679
],
[
681
],
[
683
],
[
685
],
[
687
],
[
689
],
[
691
],
[
693,
695
],
[
697
],
[
699
],
[
701
],
[
705
],
[
707
],
[
709
],
[
711
],
[
713
],
[
715
],
[
717
],
[
719
],
[
721
],
[
723,
725
],
[
727
],
[
729
],
[
731
],
[
735
],
[
737
],
[
739
],
[
741
],
[
743
],
[
745
],
[
747
],
[
749
],
[
751,
753
],
[
755
],
[
759
],
[
761
],
[
763
],
[
765
],
[
767
],
[
769
],
[
771
],
[
773,
775
],
[
777
],
[
779
],
[
781
],
[
785
],
[
787
],
[
789
],
[
791
],
[
793
],
[
795
],
[
797
],
[
799
],
[
801,
803
],
[
805
],
[
807
],
[
809
],
[
811
],
[
815
],
[
817
],
[
819
],
[
821
],
[
823
],
[
825
],
[
827
],
[
829
],
[
831
],
[
833
],
[
835,
837,
839,
841,
843,
845,
847,
849,
851,
853,
855,
857,
859,
861,
863,
865,
867
],
[
869
],
[
871
],
[
875
],
[
877
],
[
879
],
[
881
],
[
883
],
[
885
],
[
887
],
[
889
],
[
891
],
[
893
],
[
895
],
[
897
],
[
899
],
[
901
],
[
903,
905
],
[
907
],
[
909
],
[
911
],
[
915
],
[
917
],
[
919
],
[
921
],
[
923
],
[
925
],
[
927
],
[
929
],
[
931
],
[
933
],
[
935,
937
],
[
939
],
[
941
],
[
943
],
[
947
],
[
949
],
[
951
],
[
953
],
[
955
],
[
957
],
[
959
],
[
961
],
[
963
],
[
965
],
[
967,
969
],
[
971
],
[
973
],
[
975
],
[
979
],
[
981
],
[
983
],
[
985
],
[
987
],
[
989
],
[
991
],
[
993
],
[
995
],
[
997
],
[
999,
1001
],
[
1003
],
[
1005
],
[
1007
],
[
1011
],
[
1013
],
[
1015
],
[
1017
],
[
1019
],
[
1021
],
[
1023
],
[
1025
],
[
1027
],
[
1029
],
[
1031,
1033
],
[
1035
],
[
1037
],
[
1041
],
[
1043
],
[
1045
],
[
1047
],
[
1049
],
[
1051
],
[
1053
],
[
1055,
1057
],
[
1059
],
[
1061
],
[
1065
],
[
1067
],
[
1069
],
[
1071
],
[
1073
],
[
1075
],
[
1077
],
[
1079,
1081
],
[
1083
],
[
1085
],
[
1089
],
[
1091
],
[
1093
],
[
1095
],
[
1097
],
[
1099
],
[
1101,
1103
],
[
1105
],
[
1107
],
[
1111
],
[
1113
],
[
1115
],
[
1117
],
[
1119
],
[
1121
],
[
1123
],
[
1125,
1127
],
[
1129
],
[
1131
],
[
1135
],
[
1137
],
[
1139
],
[
1141
],
[
1143
],
[
1145
],
[
1147
],
[
1149,
1151
],
[
1153
],
[
1155
],
[
1159
],
[
1161
],
[
1163
],
[
1165
],
[
1167
],
[
1169
],
[
1171
],
[
1173,
1175
],
[
1177
],
[
1179
],
[
1183
],
[
1185
],
[
1187
],
[
1189
],
[
1191
],
[
1193
],
[
1195
],
[
1197,
1199
],
[
1201
],
[
1203
],
[
1207
],
[
1209
],
[
1211
],
[
1213
],
[
1215
],
[
1217
],
[
1219
],
[
1221,
1223
],
[
1225
],
[
1227
],
[
1229
],
[
1233
],
[
1235
],
[
1237
],
[
1239
],
[
1241
],
[
1243
],
[
1245
],
[
1247
],
[
1249,
1251
],
[
1253
],
[
1255
],
[
1257
],
[
1261
],
[
1263
],
[
1265
],
[
1267
],
[
1269
],
[
1271
],
[
1273
],
[
1275
],
[
1277,
1279
],
[
1281
],
[
1283
],
[
1285
],
[
1289
],
[
1291
],
[
1293
],
[
1295
],
[
1297
],
[
1299
],
[
1301
],
[
1303
],
[
1305,
1307
],
[
1309
],
[
1311
],
[
1313
],
[
1317
],
[
1319
],
[
1321
],
[
1323
],
[
1325
],
[
1327
],
[
1329
],
[
1331
],
[
1333,
1335
],
[
1337
],
[
1339
],
[
1341,
1343
],
[
1345
],
[
1347
],
[
1351
],
[
1353
],
[
1355
],
[
1357
],
[
1359
],
[
1361
],
[
1363
],
[
1365
],
[
1367
],
[
1369
],
[
1371
],
[
1373,
1375
],
[
1377
],
[
1379
],
[
1383
],
[
1385
],
[
1387
],
[
1389
],
[
1391
],
[
1393
],
[
1395
],
[
1397
],
[
1399
],
[
1401
],
[
1403
],
[
1405,
1407
],
[
1409
],
[
1411
],
[
1415
],
[
1417
],
[
1419
],
[
1421
],
[
1423
],
[
1425
],
[
1427
],
[
1429,
1431
],
[
1433
],
[
1435
],
[
1439
],
[
1441
],
[
1443
],
[
1445
],
[
1447
],
[
1449
],
[
1451
],
[
1453,
1455
],
[
1457
],
[
1459
],
[
1461
],
[
1465
],
[
1467
],
[
1469
],
[
1471
],
[
1473
],
[
1475
],
[
1477
],
[
1479
],
[
1481
],
[
1483,
1485
],
[
1487
],
[
1489
],
[
1493
],
[
1495
],
[
1497
],
[
1499
],
[
1501
],
[
1503
],
[
1505
],
[
1507,
1509
],
[
1511
],
[
1513
],
[
1517
],
[
1519
],
[
1521
],
[
1523
],
[
1525
],
[
1527
],
[
1529
],
[
1531,
1533
],
[
1535
],
[
1537
],
[
1539
],
[
1543
],
[
1545
],
[
1547
],
[
1549
],
[
1551
],
[
1553
],
[
1555
],
[
1557
],
[
1559
],
[
1561,
1563,
1565,
1567,
1569,
1571,
1573,
1575,
1577,
1579,
1581,
1583,
1585,
1587,
1589,
1591,
1593
],
[
1595
],
[
1597
],
[
1601
],
[
1603
],
[
1605
],
[
1607
],
[
1609
],
[
1611
],
[
1613
],
[
1615
],
[
1617
],
[
1619
],
[
1621
],
[
1623
],
[
1625
],
[
1627
],
[
1629
],
[
1631
],
[
1633,
1635
],
[
1637
],
[
1639
],
[
1641
],
[
1645
],
[
1647
],
[
1649
],
[
1651
],
[
1653
],
[
1655
],
[
1657
],
[
1659
],
[
1661,
1663
],
[
1665
],
[
1667
],
[
1669
],
[
1673
],
[
1675
],
[
1677
],
[
1679
],
[
1681
],
[
1683
],
[
1685
],
[
1687
],
[
1689,
1691
],
[
1693
],
[
1695
],
[
1699
],
[
1701
],
[
1703
],
[
1705
],
[
1707
],
[
1709
],
[
1711
],
[
1713,
1715
],
[
1717
],
[
1721
],
[
1723
],
[
1725
],
[
1727
],
[
1729
],
[
1731
],
[
1733
],
[
1735,
1737
],
[
1739
],
[
1741
],
[
1743
],
[
1747
],
[
1749
],
[
1751
],
[
1753
],
[
1755
],
[
1757
],
[
1759
],
[
1761
],
[
1763,
1765
],
[
1767
],
[
1769
],
[
1771
],
[
1775
],
[
1777
],
[
1779
],
[
1781
],
[
1783
],
[
1785
],
[
1787
],
[
1789
],
[
1791,
1793
],
[
1795
],
[
1797
],
[
1801
],
[
1803
],
[
1805
],
[
1807
],
[
1809
],
[
1811
],
[
1813
],
[
1815,
1817
],
[
1819
],
[
1821
],
[
1825
],
[
1827
],
[
1829
],
[
1831
],
[
1833
],
[
1835
],
[
1837
],
[
1839,
1841
],
[
1843
],
[
1845
],
[
1847
],
[
1851
],
[
1853
],
[
1855
],
[
1857
],
[
1859
],
[
1861
],
[
1863
],
[
1865
],
[
1867
],
[
1869,
1871
],
[
1873
],
[
1875
],
[
1877
],
[
1881
],
[
1883
],
[
1885
],
[
1887
],
[
1889
],
[
1891
],
[
1893
],
[
1895
],
[
1897
],
[
1899,
1901
],
[
1903
],
[
1905
],
[
1907
],
[
1911
],
[
1913
],
[
1915
],
[
1917
],
[
1919
],
[
1921
],
[
1923
],
[
1925
],
[
1927
],
[
1929,
1931
],
[
1933
],
[
1935
],
[
1939
],
[
1941
],
[
1943
],
[
1945
],
[
1947
],
[
1949
],
[
1951
],
[
1953,
1955
],
[
1957
],
[
1959
],
[
1963
],
[
1965
],
[
1967
],
[
1969
],
[
1971
],
[
1973
],
[
1975,
1977
],
[
1979
],
[
1981
],
[
1985
],
[
1987
],
[
1989
],
[
1991
],
[
1993
],
[
1995
],
[
1997
],
[
1999,
2001
],
[
2003
],
[
2005
],
[
2007
],
[
2009,
2011
],
[
2013
],
[
2015
],
[
2017
],
[
2021,
2023
],
[
2025
],
[
2027
],
[
2029
],
[
2031
],
[
2033
],
[
2035
],
[
2037
],
[
2039
],
[
2041,
2043
],
[
2045
],
[
2047
],
[
2049
],
[
2053
],
[
2055
],
[
2057
],
[
2059
],
[
2061
],
[
2063
],
[
2065
],
[
2067
],
[
2069
],
[
2071
],
[
2073
],
[
2075,
2077
],
[
2079
],
[
2081
],
[
2083
],
[
2087
],
[
2089
],
[
2091
],
[
2093
],
[
2095
],
[
2097
],
[
2099
],
[
2101
],
[
2103
],
[
2105,
2107
],
[
2109
],
[
2111
],
[
2113
],
[
2117
],
[
2119
],
[
2121
],
[
2123
],
[
2125
],
[
2127
],
[
2129
],
[
2131
],
[
2133
],
[
2135,
2137
],
[
2139
],
[
2141
],
[
2143
],
[
2147
],
[
2149
],
[
2151
],
[
2153
],
[
2155
],
[
2157
],
[
2159
],
[
2161
],
[
2163
],
[
2165,
2167
],
[
2169
],
[
2171
],
[
2175
],
[
2177
],
[
2179
],
[
2181
],
[
2183
],
[
2185
],
[
2187
],
[
2189,
2191
],
[
2193
],
[
2195
],
[
2199
],
[
2201
],
[
2203
],
[
2205
],
[
2207
],
[
2209
],
[
2211
],
[
2213,
2215
],
[
2217
],
[
2219
],
[
2221
],
[
2225
],
[
2227
],
[
2229
],
[
2231
],
[
2233
],
[
2235
],
[
2237
],
[
2239
],
[
2241
],
[
2243,
2245
],
[
2247
],
[
2249
],
[
2253
],
[
2255
],
[
2257
],
[
2259
],
[
2261
],
[
2263
],
[
2265
],
[
2267,
2269
],
[
2271
],
[
2273
],
[
2277
],
[
2279
],
[
2281
],
[
2283
],
[
2285
],
[
2287
],
[
2289
],
[
2291,
2293
],
[
2295
],
[
2297
],
[
2301
],
[
2303
],
[
2305
],
[
2307
],
[
2309
],
[
2311
],
[
2313
],
[
2315,
2317
],
[
2319
],
[
2321
],
[
2323
],
[
2327
],
[
2329
],
[
2331
],
[
2333
],
[
2335
],
[
2337
],
[
2339
],
[
2341
],
[
2343
],
[
2345,
2347
],
[
2349
],
[
2351
],
[
2353
],
[
2357
],
[
2359
],
[
2361
],
[
2363
],
[
2365
],
[
2367
],
[
2369
],
[
2371
],
[
2373
],
[
2375,
2377
],
[
2379
],
[
2381
],
[
2383
],
[
2387
],
[
2389
],
[
2391
],
[
2393
],
[
2395
],
[
2397
],
[
2399
],
[
2401
],
[
2403
],
[
2405,
2407
],
[
2409
],
[
2411
],
[
2413
],
[
2417
],
[
2419
],
[
2421
],
[
2423
],
[
2425
],
[
2427
],
[
2429
],
[
2431
],
[
2433
],
[
2435,
2437,
2439,
2441,
2443,
2445,
2447,
2449,
2451,
2453,
2455,
2457,
2459,
2461,
2463,
2465,
2467
],
[
2469
],
[
2471
],
[
2473
],
[
2477
],
[
2479
],
[
2481
],
[
2483
],
[
2485
],
[
2487
],
[
2489
],
[
2491
],
[
2493
],
[
2495
],
[
2497
],
[
2499
],
[
2501
],
[
2503,
2505
],
[
2507
],
[
2509
],
[
2511
],
[
2513
],
[
2515,
2517
],
[
2519
],
[
2521,
2523
],
[
2525
],
[
2527,
2529
],
[
2531
],
[
2533
],
[
2535
]
] |
1,560 | static void mkv_write_block(AVFormatContext *s, AVIOContext *pb,
unsigned int blockid, AVPacket *pkt, int flags)
{
MatroskaMuxContext *mkv = s->priv_data;
AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
uint8_t *data = NULL, *side_data = NULL;
int offset = 0, size = pkt->size, side_data_size = 0;
int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts;
uint64_t additional_id = 0;
int64_t discard_padding = 0;
ebml_master block_group, block_additions, block_more;
av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, "
"pts %" PRId64 ", dts %" PRId64 ", duration %d, flags %d\n",
avio_tell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags);
if (codec->codec_id == AV_CODEC_ID_H264 && codec->extradata_size > 0 &&
(AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))
ff_avc_parse_nal_units_buf(pkt->data, &data, &size);
else if (codec->codec_id == AV_CODEC_ID_HEVC && codec->extradata_size > 6 &&
(AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))
/* extradata is Annex B, assume the bitstream is too and convert it */
ff_hevc_annexb2mp4_buf(pkt->data, &data, &size, 0, NULL);
else if (codec->codec_id == AV_CODEC_ID_WAVPACK) {
int ret = mkv_strip_wavpack(pkt->data, &data, &size);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "Error stripping a WavPack packet.\n");
return;
}
} else
data = pkt->data;
if (codec->codec_id == AV_CODEC_ID_PRORES) {
/* Matroska specification requires to remove the first QuickTime atom
*/
size -= 8;
offset = 8;
}
side_data = av_packet_get_side_data(pkt,
AV_PKT_DATA_SKIP_SAMPLES,
&side_data_size);
if (side_data && side_data_size >= 10) {
discard_padding = av_rescale_q(AV_RL32(side_data + 4),
(AVRational){1, codec->sample_rate},
(AVRational){1, 1000000000});
}
side_data = av_packet_get_side_data(pkt,
AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
&side_data_size);
if (side_data) {
additional_id = AV_RB64(side_data);
side_data += 8;
side_data_size -= 8;
}
if ((side_data_size && additional_id == 1) || discard_padding) {
block_group = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, 0);
blockid = MATROSKA_ID_BLOCK;
}
put_ebml_id(pb, blockid);
put_ebml_num(pb, size + 4, 0);
// this assumes stream_index is less than 126
avio_w8(pb, 0x80 | (mkv->is_dash ? mkv->dash_track_number : (pkt->stream_index + 1)));
avio_wb16(pb, ts - mkv->cluster_pts);
avio_w8(pb, flags);
avio_write(pb, data + offset, size);
if (data != pkt->data)
av_free(data);
if (discard_padding) {
put_ebml_sint(pb, MATROSKA_ID_DISCARDPADDING, discard_padding);
}
if (side_data_size && additional_id == 1) {
block_additions = start_ebml_master(pb, MATROSKA_ID_BLOCKADDITIONS, 0);
block_more = start_ebml_master(pb, MATROSKA_ID_BLOCKMORE, 0);
put_ebml_uint(pb, MATROSKA_ID_BLOCKADDID, 1);
put_ebml_id(pb, MATROSKA_ID_BLOCKADDITIONAL);
put_ebml_num(pb, side_data_size, 0);
avio_write(pb, side_data, side_data_size);
end_ebml_master(pb, block_more);
end_ebml_master(pb, block_additions);
}
if ((side_data_size && additional_id == 1) || discard_padding) {
end_ebml_master(pb, block_group);
}
}
| false | FFmpeg | 8f6b919d99687416deaedb2df6b8b5f49645a291 | static void mkv_write_block(AVFormatContext *s, AVIOContext *pb,
unsigned int blockid, AVPacket *pkt, int flags)
{
MatroskaMuxContext *mkv = s->priv_data;
AVCodecContext *codec = s->streams[pkt->stream_index]->codec;
uint8_t *data = NULL, *side_data = NULL;
int offset = 0, size = pkt->size, side_data_size = 0;
int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts;
uint64_t additional_id = 0;
int64_t discard_padding = 0;
ebml_master block_group, block_additions, block_more;
av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, "
"pts %" PRId64 ", dts %" PRId64 ", duration %d, flags %d\n",
avio_tell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags);
if (codec->codec_id == AV_CODEC_ID_H264 && codec->extradata_size > 0 &&
(AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))
ff_avc_parse_nal_units_buf(pkt->data, &data, &size);
else if (codec->codec_id == AV_CODEC_ID_HEVC && codec->extradata_size > 6 &&
(AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))
ff_hevc_annexb2mp4_buf(pkt->data, &data, &size, 0, NULL);
else if (codec->codec_id == AV_CODEC_ID_WAVPACK) {
int ret = mkv_strip_wavpack(pkt->data, &data, &size);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "Error stripping a WavPack packet.\n");
return;
}
} else
data = pkt->data;
if (codec->codec_id == AV_CODEC_ID_PRORES) {
size -= 8;
offset = 8;
}
side_data = av_packet_get_side_data(pkt,
AV_PKT_DATA_SKIP_SAMPLES,
&side_data_size);
if (side_data && side_data_size >= 10) {
discard_padding = av_rescale_q(AV_RL32(side_data + 4),
(AVRational){1, codec->sample_rate},
(AVRational){1, 1000000000});
}
side_data = av_packet_get_side_data(pkt,
AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
&side_data_size);
if (side_data) {
additional_id = AV_RB64(side_data);
side_data += 8;
side_data_size -= 8;
}
if ((side_data_size && additional_id == 1) || discard_padding) {
block_group = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, 0);
blockid = MATROSKA_ID_BLOCK;
}
put_ebml_id(pb, blockid);
put_ebml_num(pb, size + 4, 0);
avio_w8(pb, 0x80 | (mkv->is_dash ? mkv->dash_track_number : (pkt->stream_index + 1)));
avio_wb16(pb, ts - mkv->cluster_pts);
avio_w8(pb, flags);
avio_write(pb, data + offset, size);
if (data != pkt->data)
av_free(data);
if (discard_padding) {
put_ebml_sint(pb, MATROSKA_ID_DISCARDPADDING, discard_padding);
}
if (side_data_size && additional_id == 1) {
block_additions = start_ebml_master(pb, MATROSKA_ID_BLOCKADDITIONS, 0);
block_more = start_ebml_master(pb, MATROSKA_ID_BLOCKMORE, 0);
put_ebml_uint(pb, MATROSKA_ID_BLOCKADDID, 1);
put_ebml_id(pb, MATROSKA_ID_BLOCKADDITIONAL);
put_ebml_num(pb, side_data_size, 0);
avio_write(pb, side_data, side_data_size);
end_ebml_master(pb, block_more);
end_ebml_master(pb, block_additions);
}
if ((side_data_size && additional_id == 1) || discard_padding) {
end_ebml_master(pb, block_group);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(AVFormatContext *VAR_0, AVIOContext *VAR_1,
unsigned int VAR_2, AVPacket *VAR_3, int VAR_4)
{
MatroskaMuxContext *mkv = VAR_0->priv_data;
AVCodecContext *codec = VAR_0->streams[VAR_3->stream_index]->codec;
uint8_t *data = NULL, *side_data = NULL;
int VAR_5 = 0, VAR_6 = VAR_3->VAR_6, VAR_7 = 0;
int64_t ts = mkv->tracks[VAR_3->stream_index].write_dts ? VAR_3->dts : VAR_3->pts;
uint64_t additional_id = 0;
int64_t discard_padding = 0;
ebml_master block_group, block_additions, block_more;
av_log(VAR_0, AV_LOG_DEBUG, "Writing block at VAR_5 %" PRIu64 ", VAR_6 %d, "
"pts %" PRId64 ", dts %" PRId64 ", duration %d, VAR_4 %d\n",
avio_tell(VAR_1), VAR_3->VAR_6, VAR_3->pts, VAR_3->dts, VAR_3->duration, VAR_4);
if (codec->codec_id == AV_CODEC_ID_H264 && codec->extradata_size > 0 &&
(AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))
ff_avc_parse_nal_units_buf(VAR_3->data, &data, &VAR_6);
else if (codec->codec_id == AV_CODEC_ID_HEVC && codec->extradata_size > 6 &&
(AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))
ff_hevc_annexb2mp4_buf(VAR_3->data, &data, &VAR_6, 0, NULL);
else if (codec->codec_id == AV_CODEC_ID_WAVPACK) {
int VAR_8 = mkv_strip_wavpack(VAR_3->data, &data, &VAR_6);
if (VAR_8 < 0) {
av_log(VAR_0, AV_LOG_ERROR, "Error stripping a WavPack packet.\n");
return;
}
} else
data = VAR_3->data;
if (codec->codec_id == AV_CODEC_ID_PRORES) {
VAR_6 -= 8;
VAR_5 = 8;
}
side_data = av_packet_get_side_data(VAR_3,
AV_PKT_DATA_SKIP_SAMPLES,
&VAR_7);
if (side_data && VAR_7 >= 10) {
discard_padding = av_rescale_q(AV_RL32(side_data + 4),
(AVRational){1, codec->sample_rate},
(AVRational){1, 1000000000});
}
side_data = av_packet_get_side_data(VAR_3,
AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,
&VAR_7);
if (side_data) {
additional_id = AV_RB64(side_data);
side_data += 8;
VAR_7 -= 8;
}
if ((VAR_7 && additional_id == 1) || discard_padding) {
block_group = start_ebml_master(VAR_1, MATROSKA_ID_BLOCKGROUP, 0);
VAR_2 = MATROSKA_ID_BLOCK;
}
put_ebml_id(VAR_1, VAR_2);
put_ebml_num(VAR_1, VAR_6 + 4, 0);
avio_w8(VAR_1, 0x80 | (mkv->is_dash ? mkv->dash_track_number : (VAR_3->stream_index + 1)));
avio_wb16(VAR_1, ts - mkv->cluster_pts);
avio_w8(VAR_1, VAR_4);
avio_write(VAR_1, data + VAR_5, VAR_6);
if (data != VAR_3->data)
av_free(data);
if (discard_padding) {
put_ebml_sint(VAR_1, MATROSKA_ID_DISCARDPADDING, discard_padding);
}
if (VAR_7 && additional_id == 1) {
block_additions = start_ebml_master(VAR_1, MATROSKA_ID_BLOCKADDITIONS, 0);
block_more = start_ebml_master(VAR_1, MATROSKA_ID_BLOCKMORE, 0);
put_ebml_uint(VAR_1, MATROSKA_ID_BLOCKADDID, 1);
put_ebml_id(VAR_1, MATROSKA_ID_BLOCKADDITIONAL);
put_ebml_num(VAR_1, VAR_7, 0);
avio_write(VAR_1, side_data, VAR_7);
end_ebml_master(VAR_1, block_more);
end_ebml_master(VAR_1, block_additions);
}
if ((VAR_7 && additional_id == 1) || discard_padding) {
end_ebml_master(VAR_1, block_group);
}
}
| [
"static void FUNC_0(AVFormatContext *VAR_0, AVIOContext *VAR_1,\nunsigned int VAR_2, AVPacket *VAR_3, int VAR_4)\n{",
"MatroskaMuxContext *mkv = VAR_0->priv_data;",
"AVCodecContext *codec = VAR_0->streams[VAR_3->stream_index]->codec;",
"uint8_t *data = NULL, *side_data = NULL;",
"int VAR_5 = 0, VAR_6 = VAR_3->VAR_6, VAR_7 = 0;",
"int64_t ts = mkv->tracks[VAR_3->stream_index].write_dts ? VAR_3->dts : VAR_3->pts;",
"uint64_t additional_id = 0;",
"int64_t discard_padding = 0;",
"ebml_master block_group, block_additions, block_more;",
"av_log(VAR_0, AV_LOG_DEBUG, \"Writing block at VAR_5 %\" PRIu64 \", VAR_6 %d, \"\n\"pts %\" PRId64 \", dts %\" PRId64 \", duration %d, VAR_4 %d\\n\",\navio_tell(VAR_1), VAR_3->VAR_6, VAR_3->pts, VAR_3->dts, VAR_3->duration, VAR_4);",
"if (codec->codec_id == AV_CODEC_ID_H264 && codec->extradata_size > 0 &&\n(AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))\nff_avc_parse_nal_units_buf(VAR_3->data, &data, &VAR_6);",
"else if (codec->codec_id == AV_CODEC_ID_HEVC && codec->extradata_size > 6 &&\n(AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1))\nff_hevc_annexb2mp4_buf(VAR_3->data, &data, &VAR_6, 0, NULL);",
"else if (codec->codec_id == AV_CODEC_ID_WAVPACK) {",
"int VAR_8 = mkv_strip_wavpack(VAR_3->data, &data, &VAR_6);",
"if (VAR_8 < 0) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Error stripping a WavPack packet.\\n\");",
"return;",
"}",
"} else",
"data = VAR_3->data;",
"if (codec->codec_id == AV_CODEC_ID_PRORES) {",
"VAR_6 -= 8;",
"VAR_5 = 8;",
"}",
"side_data = av_packet_get_side_data(VAR_3,\nAV_PKT_DATA_SKIP_SAMPLES,\n&VAR_7);",
"if (side_data && VAR_7 >= 10) {",
"discard_padding = av_rescale_q(AV_RL32(side_data + 4),\n(AVRational){1, codec->sample_rate},",
"(AVRational){1, 1000000000});",
"}",
"side_data = av_packet_get_side_data(VAR_3,\nAV_PKT_DATA_MATROSKA_BLOCKADDITIONAL,\n&VAR_7);",
"if (side_data) {",
"additional_id = AV_RB64(side_data);",
"side_data += 8;",
"VAR_7 -= 8;",
"}",
"if ((VAR_7 && additional_id == 1) || discard_padding) {",
"block_group = start_ebml_master(VAR_1, MATROSKA_ID_BLOCKGROUP, 0);",
"VAR_2 = MATROSKA_ID_BLOCK;",
"}",
"put_ebml_id(VAR_1, VAR_2);",
"put_ebml_num(VAR_1, VAR_6 + 4, 0);",
"avio_w8(VAR_1, 0x80 | (mkv->is_dash ? mkv->dash_track_number : (VAR_3->stream_index + 1)));",
"avio_wb16(VAR_1, ts - mkv->cluster_pts);",
"avio_w8(VAR_1, VAR_4);",
"avio_write(VAR_1, data + VAR_5, VAR_6);",
"if (data != VAR_3->data)\nav_free(data);",
"if (discard_padding) {",
"put_ebml_sint(VAR_1, MATROSKA_ID_DISCARDPADDING, discard_padding);",
"}",
"if (VAR_7 && additional_id == 1) {",
"block_additions = start_ebml_master(VAR_1, MATROSKA_ID_BLOCKADDITIONS, 0);",
"block_more = start_ebml_master(VAR_1, MATROSKA_ID_BLOCKMORE, 0);",
"put_ebml_uint(VAR_1, MATROSKA_ID_BLOCKADDID, 1);",
"put_ebml_id(VAR_1, MATROSKA_ID_BLOCKADDITIONAL);",
"put_ebml_num(VAR_1, VAR_7, 0);",
"avio_write(VAR_1, side_data, VAR_7);",
"end_ebml_master(VAR_1, block_more);",
"end_ebml_master(VAR_1, block_additions);",
"}",
"if ((VAR_7 && additional_id == 1) || discard_padding) {",
"end_ebml_master(VAR_1, block_group);",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25,
27,
29
],
[
31,
33,
35
],
[
37,
39,
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
63
],
[
69
],
[
71
],
[
73
],
[
77,
79,
81
],
[
85
],
[
87,
89
],
[
91
],
[
93
],
[
97,
99,
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
115
],
[
117
],
[
119
],
[
121
],
[
125
],
[
127
],
[
131
],
[
133
],
[
135
],
[
137
],
[
139,
141
],
[
145
],
[
147
],
[
149
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177
],
[
179
]
] |
1,561 | static void omap2_mpu_reset(void *opaque)
{
struct omap_mpu_state_s *mpu = (struct omap_mpu_state_s *) opaque;
omap_inth_reset(mpu->ih[0]);
omap_dma_reset(mpu->dma);
omap_prcm_reset(mpu->prcm);
omap_sysctl_reset(mpu->sysc);
omap_gp_timer_reset(mpu->gptimer[0]);
omap_gp_timer_reset(mpu->gptimer[1]);
omap_gp_timer_reset(mpu->gptimer[2]);
omap_gp_timer_reset(mpu->gptimer[3]);
omap_gp_timer_reset(mpu->gptimer[4]);
omap_gp_timer_reset(mpu->gptimer[5]);
omap_gp_timer_reset(mpu->gptimer[6]);
omap_gp_timer_reset(mpu->gptimer[7]);
omap_gp_timer_reset(mpu->gptimer[8]);
omap_gp_timer_reset(mpu->gptimer[9]);
omap_gp_timer_reset(mpu->gptimer[10]);
omap_gp_timer_reset(mpu->gptimer[11]);
omap_synctimer_reset(mpu->synctimer);
omap_sdrc_reset(mpu->sdrc);
omap_gpmc_reset(mpu->gpmc);
omap_dss_reset(mpu->dss);
omap_uart_reset(mpu->uart[0]);
omap_uart_reset(mpu->uart[1]);
omap_uart_reset(mpu->uart[2]);
omap_mmc_reset(mpu->mmc);
omap_mcspi_reset(mpu->mcspi[0]);
omap_mcspi_reset(mpu->mcspi[1]);
omap_i2c_reset(mpu->i2c[0]);
omap_i2c_reset(mpu->i2c[1]);
cpu_reset(mpu->env);
}
| false | qemu | 0919ac787641db11024912651f3bc5764d4f1286 | static void omap2_mpu_reset(void *opaque)
{
struct omap_mpu_state_s *mpu = (struct omap_mpu_state_s *) opaque;
omap_inth_reset(mpu->ih[0]);
omap_dma_reset(mpu->dma);
omap_prcm_reset(mpu->prcm);
omap_sysctl_reset(mpu->sysc);
omap_gp_timer_reset(mpu->gptimer[0]);
omap_gp_timer_reset(mpu->gptimer[1]);
omap_gp_timer_reset(mpu->gptimer[2]);
omap_gp_timer_reset(mpu->gptimer[3]);
omap_gp_timer_reset(mpu->gptimer[4]);
omap_gp_timer_reset(mpu->gptimer[5]);
omap_gp_timer_reset(mpu->gptimer[6]);
omap_gp_timer_reset(mpu->gptimer[7]);
omap_gp_timer_reset(mpu->gptimer[8]);
omap_gp_timer_reset(mpu->gptimer[9]);
omap_gp_timer_reset(mpu->gptimer[10]);
omap_gp_timer_reset(mpu->gptimer[11]);
omap_synctimer_reset(mpu->synctimer);
omap_sdrc_reset(mpu->sdrc);
omap_gpmc_reset(mpu->gpmc);
omap_dss_reset(mpu->dss);
omap_uart_reset(mpu->uart[0]);
omap_uart_reset(mpu->uart[1]);
omap_uart_reset(mpu->uart[2]);
omap_mmc_reset(mpu->mmc);
omap_mcspi_reset(mpu->mcspi[0]);
omap_mcspi_reset(mpu->mcspi[1]);
omap_i2c_reset(mpu->i2c[0]);
omap_i2c_reset(mpu->i2c[1]);
cpu_reset(mpu->env);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(void *VAR_0)
{
struct omap_mpu_state_s *VAR_1 = (struct omap_mpu_state_s *) VAR_0;
omap_inth_reset(VAR_1->ih[0]);
omap_dma_reset(VAR_1->dma);
omap_prcm_reset(VAR_1->prcm);
omap_sysctl_reset(VAR_1->sysc);
omap_gp_timer_reset(VAR_1->gptimer[0]);
omap_gp_timer_reset(VAR_1->gptimer[1]);
omap_gp_timer_reset(VAR_1->gptimer[2]);
omap_gp_timer_reset(VAR_1->gptimer[3]);
omap_gp_timer_reset(VAR_1->gptimer[4]);
omap_gp_timer_reset(VAR_1->gptimer[5]);
omap_gp_timer_reset(VAR_1->gptimer[6]);
omap_gp_timer_reset(VAR_1->gptimer[7]);
omap_gp_timer_reset(VAR_1->gptimer[8]);
omap_gp_timer_reset(VAR_1->gptimer[9]);
omap_gp_timer_reset(VAR_1->gptimer[10]);
omap_gp_timer_reset(VAR_1->gptimer[11]);
omap_synctimer_reset(VAR_1->synctimer);
omap_sdrc_reset(VAR_1->sdrc);
omap_gpmc_reset(VAR_1->gpmc);
omap_dss_reset(VAR_1->dss);
omap_uart_reset(VAR_1->uart[0]);
omap_uart_reset(VAR_1->uart[1]);
omap_uart_reset(VAR_1->uart[2]);
omap_mmc_reset(VAR_1->mmc);
omap_mcspi_reset(VAR_1->mcspi[0]);
omap_mcspi_reset(VAR_1->mcspi[1]);
omap_i2c_reset(VAR_1->i2c[0]);
omap_i2c_reset(VAR_1->i2c[1]);
cpu_reset(VAR_1->env);
}
| [
"static void FUNC_0(void *VAR_0)\n{",
"struct omap_mpu_state_s *VAR_1 = (struct omap_mpu_state_s *) VAR_0;",
"omap_inth_reset(VAR_1->ih[0]);",
"omap_dma_reset(VAR_1->dma);",
"omap_prcm_reset(VAR_1->prcm);",
"omap_sysctl_reset(VAR_1->sysc);",
"omap_gp_timer_reset(VAR_1->gptimer[0]);",
"omap_gp_timer_reset(VAR_1->gptimer[1]);",
"omap_gp_timer_reset(VAR_1->gptimer[2]);",
"omap_gp_timer_reset(VAR_1->gptimer[3]);",
"omap_gp_timer_reset(VAR_1->gptimer[4]);",
"omap_gp_timer_reset(VAR_1->gptimer[5]);",
"omap_gp_timer_reset(VAR_1->gptimer[6]);",
"omap_gp_timer_reset(VAR_1->gptimer[7]);",
"omap_gp_timer_reset(VAR_1->gptimer[8]);",
"omap_gp_timer_reset(VAR_1->gptimer[9]);",
"omap_gp_timer_reset(VAR_1->gptimer[10]);",
"omap_gp_timer_reset(VAR_1->gptimer[11]);",
"omap_synctimer_reset(VAR_1->synctimer);",
"omap_sdrc_reset(VAR_1->sdrc);",
"omap_gpmc_reset(VAR_1->gpmc);",
"omap_dss_reset(VAR_1->dss);",
"omap_uart_reset(VAR_1->uart[0]);",
"omap_uart_reset(VAR_1->uart[1]);",
"omap_uart_reset(VAR_1->uart[2]);",
"omap_mmc_reset(VAR_1->mmc);",
"omap_mcspi_reset(VAR_1->mcspi[0]);",
"omap_mcspi_reset(VAR_1->mcspi[1]);",
"omap_i2c_reset(VAR_1->i2c[0]);",
"omap_i2c_reset(VAR_1->i2c[1]);",
"cpu_reset(VAR_1->env);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
],
[
65
],
[
67
]
] |
1,562 | void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict)
{
pci_device_hot_remove(mon, qdict_get_str(qdict, "pci_addr"));
}
| false | qemu | 79ca616f291124d166ca173e512c4ace1c2fe8b2 | void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict)
{
pci_device_hot_remove(mon, qdict_get_str(qdict, "pci_addr"));
}
| {
"code": [],
"line_no": []
} | void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)
{
pci_device_hot_remove(VAR_0, qdict_get_str(VAR_1, "pci_addr"));
}
| [
"void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)\n{",
"pci_device_hot_remove(VAR_0, qdict_get_str(VAR_1, \"pci_addr\"));",
"}"
] | [
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
]
] |
1,564 | static void register_multipage(AddressSpaceDispatch *d,
MemoryRegionSection *section)
{
hwaddr start_addr = section->offset_within_address_space;
uint16_t section_index = phys_section_add(section);
uint64_t num_pages = int128_get64(int128_rshift(section->size,
TARGET_PAGE_BITS));
assert(num_pages);
phys_page_set(d, start_addr >> TARGET_PAGE_BITS, num_pages, section_index);
}
| false | qemu | 53cb28cbfea038f8ad50132dc8a684e638c7d48b | static void register_multipage(AddressSpaceDispatch *d,
MemoryRegionSection *section)
{
hwaddr start_addr = section->offset_within_address_space;
uint16_t section_index = phys_section_add(section);
uint64_t num_pages = int128_get64(int128_rshift(section->size,
TARGET_PAGE_BITS));
assert(num_pages);
phys_page_set(d, start_addr >> TARGET_PAGE_BITS, num_pages, section_index);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(AddressSpaceDispatch *VAR_0,
MemoryRegionSection *VAR_1)
{
hwaddr start_addr = VAR_1->offset_within_address_space;
uint16_t section_index = phys_section_add(VAR_1);
uint64_t num_pages = int128_get64(int128_rshift(VAR_1->size,
TARGET_PAGE_BITS));
assert(num_pages);
phys_page_set(VAR_0, start_addr >> TARGET_PAGE_BITS, num_pages, section_index);
}
| [
"static void FUNC_0(AddressSpaceDispatch *VAR_0,\nMemoryRegionSection *VAR_1)\n{",
"hwaddr start_addr = VAR_1->offset_within_address_space;",
"uint16_t section_index = phys_section_add(VAR_1);",
"uint64_t num_pages = int128_get64(int128_rshift(VAR_1->size,\nTARGET_PAGE_BITS));",
"assert(num_pages);",
"phys_page_set(VAR_0, start_addr >> TARGET_PAGE_BITS, num_pages, section_index);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11,
13
],
[
17
],
[
19
],
[
21
]
] |
1,566 | static void test_visitor_in_errors(TestInputVisitorData *data,
const void *unused)
{
TestStruct *p = NULL;
Error *err = NULL;
Visitor *v;
strList *q = NULL;
UserDefTwo *r = NULL;
WrapAlternate *s = NULL;
v = visitor_input_test_init(data, "{ 'integer': false, 'boolean': 'foo', "
"'string': -42 }");
visit_type_TestStruct(v, NULL, &p, &err);
error_free_or_abort(&err);
g_assert(!p);
v = visitor_input_test_init(data, "[ '1', '2', false, '3' ]");
visit_type_strList(v, NULL, &q, &err);
error_free_or_abort(&err);
assert(!q);
v = visitor_input_test_init(data, "{ 'str':'hi' }");
visit_type_UserDefTwo(v, NULL, &r, &err);
error_free_or_abort(&err);
assert(!r);
v = visitor_input_test_init(data, "{ }");
visit_type_WrapAlternate(v, NULL, &s, &err);
error_free_or_abort(&err);
assert(!s);
}
| false | qemu | b3db211f3c80bb996a704d665fe275619f728bd4 | static void test_visitor_in_errors(TestInputVisitorData *data,
const void *unused)
{
TestStruct *p = NULL;
Error *err = NULL;
Visitor *v;
strList *q = NULL;
UserDefTwo *r = NULL;
WrapAlternate *s = NULL;
v = visitor_input_test_init(data, "{ 'integer': false, 'boolean': 'foo', "
"'string': -42 }");
visit_type_TestStruct(v, NULL, &p, &err);
error_free_or_abort(&err);
g_assert(!p);
v = visitor_input_test_init(data, "[ '1', '2', false, '3' ]");
visit_type_strList(v, NULL, &q, &err);
error_free_or_abort(&err);
assert(!q);
v = visitor_input_test_init(data, "{ 'str':'hi' }");
visit_type_UserDefTwo(v, NULL, &r, &err);
error_free_or_abort(&err);
assert(!r);
v = visitor_input_test_init(data, "{ }");
visit_type_WrapAlternate(v, NULL, &s, &err);
error_free_or_abort(&err);
assert(!s);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(TestInputVisitorData *VAR_0,
const void *VAR_1)
{
TestStruct *p = NULL;
Error *err = NULL;
Visitor *v;
strList *q = NULL;
UserDefTwo *r = NULL;
WrapAlternate *s = NULL;
v = visitor_input_test_init(VAR_0, "{ 'integer': false, 'boolean': 'foo', "
"'string': -42 }");
visit_type_TestStruct(v, NULL, &p, &err);
error_free_or_abort(&err);
g_assert(!p);
v = visitor_input_test_init(VAR_0, "[ '1', '2', false, '3' ]");
visit_type_strList(v, NULL, &q, &err);
error_free_or_abort(&err);
assert(!q);
v = visitor_input_test_init(VAR_0, "{ 'str':'hi' }");
visit_type_UserDefTwo(v, NULL, &r, &err);
error_free_or_abort(&err);
assert(!r);
v = visitor_input_test_init(VAR_0, "{ }");
visit_type_WrapAlternate(v, NULL, &s, &err);
error_free_or_abort(&err);
assert(!s);
}
| [
"static void FUNC_0(TestInputVisitorData *VAR_0,\nconst void *VAR_1)\n{",
"TestStruct *p = NULL;",
"Error *err = NULL;",
"Visitor *v;",
"strList *q = NULL;",
"UserDefTwo *r = NULL;",
"WrapAlternate *s = NULL;",
"v = visitor_input_test_init(VAR_0, \"{ 'integer': false, 'boolean': 'foo', \"",
"\"'string': -42 }\");",
"visit_type_TestStruct(v, NULL, &p, &err);",
"error_free_or_abort(&err);",
"g_assert(!p);",
"v = visitor_input_test_init(VAR_0, \"[ '1', '2', false, '3' ]\");",
"visit_type_strList(v, NULL, &q, &err);",
"error_free_or_abort(&err);",
"assert(!q);",
"v = visitor_input_test_init(VAR_0, \"{ 'str':'hi' }\");",
"visit_type_UserDefTwo(v, NULL, &r, &err);",
"error_free_or_abort(&err);",
"assert(!r);",
"v = visitor_input_test_init(VAR_0, \"{ }\");",
"visit_type_WrapAlternate(v, NULL, &s, &err);",
"error_free_or_abort(&err);",
"assert(!s);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37
],
[
39
],
[
41
],
[
45
],
[
47
],
[
49
],
[
51
],
[
55
],
[
57
],
[
59
],
[
61
],
[
63
]
] |
1,567 | static void acpi_pcihp_update_hotplug_bus(AcpiPciHpState *s, int bsel)
{
BusChild *kid, *next;
PCIBus *bus = acpi_pcihp_find_hotplug_bus(s, bsel);
/* Execute any pending removes during reset */
while (s->acpi_pcihp_pci_status[bsel].down) {
acpi_pcihp_eject_slot(s, bsel, s->acpi_pcihp_pci_status[bsel].down);
}
s->acpi_pcihp_pci_status[bsel].hotplug_enable = ~0;
s->acpi_pcihp_pci_status[bsel].device_present = 0;
if (!bus) {
return;
}
QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) {
DeviceState *qdev = kid->child;
PCIDevice *pdev = PCI_DEVICE(qdev);
int slot = PCI_SLOT(pdev->devfn);
if (acpi_pcihp_pc_no_hotplug(s, pdev)) {
s->acpi_pcihp_pci_status[bsel].hotplug_enable &= ~(1U << slot);
}
s->acpi_pcihp_pci_status[bsel].device_present |= (1U << slot);
}
}
| false | qemu | 5a2223ca26b1a34e131b5b9a63599d9426d2c25c | static void acpi_pcihp_update_hotplug_bus(AcpiPciHpState *s, int bsel)
{
BusChild *kid, *next;
PCIBus *bus = acpi_pcihp_find_hotplug_bus(s, bsel);
while (s->acpi_pcihp_pci_status[bsel].down) {
acpi_pcihp_eject_slot(s, bsel, s->acpi_pcihp_pci_status[bsel].down);
}
s->acpi_pcihp_pci_status[bsel].hotplug_enable = ~0;
s->acpi_pcihp_pci_status[bsel].device_present = 0;
if (!bus) {
return;
}
QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) {
DeviceState *qdev = kid->child;
PCIDevice *pdev = PCI_DEVICE(qdev);
int slot = PCI_SLOT(pdev->devfn);
if (acpi_pcihp_pc_no_hotplug(s, pdev)) {
s->acpi_pcihp_pci_status[bsel].hotplug_enable &= ~(1U << slot);
}
s->acpi_pcihp_pci_status[bsel].device_present |= (1U << slot);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(AcpiPciHpState *VAR_0, int VAR_1)
{
BusChild *kid, *next;
PCIBus *bus = acpi_pcihp_find_hotplug_bus(VAR_0, VAR_1);
while (VAR_0->acpi_pcihp_pci_status[VAR_1].down) {
acpi_pcihp_eject_slot(VAR_0, VAR_1, VAR_0->acpi_pcihp_pci_status[VAR_1].down);
}
VAR_0->acpi_pcihp_pci_status[VAR_1].hotplug_enable = ~0;
VAR_0->acpi_pcihp_pci_status[VAR_1].device_present = 0;
if (!bus) {
return;
}
QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) {
DeviceState *qdev = kid->child;
PCIDevice *pdev = PCI_DEVICE(qdev);
int slot = PCI_SLOT(pdev->devfn);
if (acpi_pcihp_pc_no_hotplug(VAR_0, pdev)) {
VAR_0->acpi_pcihp_pci_status[VAR_1].hotplug_enable &= ~(1U << slot);
}
VAR_0->acpi_pcihp_pci_status[VAR_1].device_present |= (1U << slot);
}
}
| [
"static void FUNC_0(AcpiPciHpState *VAR_0, int VAR_1)\n{",
"BusChild *kid, *next;",
"PCIBus *bus = acpi_pcihp_find_hotplug_bus(VAR_0, VAR_1);",
"while (VAR_0->acpi_pcihp_pci_status[VAR_1].down) {",
"acpi_pcihp_eject_slot(VAR_0, VAR_1, VAR_0->acpi_pcihp_pci_status[VAR_1].down);",
"}",
"VAR_0->acpi_pcihp_pci_status[VAR_1].hotplug_enable = ~0;",
"VAR_0->acpi_pcihp_pci_status[VAR_1].device_present = 0;",
"if (!bus) {",
"return;",
"}",
"QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) {",
"DeviceState *qdev = kid->child;",
"PCIDevice *pdev = PCI_DEVICE(qdev);",
"int slot = PCI_SLOT(pdev->devfn);",
"if (acpi_pcihp_pc_no_hotplug(VAR_0, pdev)) {",
"VAR_0->acpi_pcihp_pci_status[VAR_1].hotplug_enable &= ~(1U << slot);",
"}",
"VAR_0->acpi_pcihp_pci_status[VAR_1].device_present |= (1U << slot);",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
13
],
[
15
],
[
17
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53
],
[
55
]
] |
1,568 | static void ahci_idp_write(void *opaque, target_phys_addr_t addr,
uint64_t val, unsigned size)
{
AHCIState *s = opaque;
if (addr == s->idp_offset) {
/* index register - mask off reserved bits */
s->idp_index = (uint32_t)val & ((AHCI_MEM_BAR_SIZE - 1) & ~3);
} else if (addr == s->idp_offset + 4) {
/* data register - do memory write at location selected by index */
ahci_mem_write(opaque, s->idp_index, val, size);
}
}
| false | qemu | a8170e5e97ad17ca169c64ba87ae2f53850dab4c | static void ahci_idp_write(void *opaque, target_phys_addr_t addr,
uint64_t val, unsigned size)
{
AHCIState *s = opaque;
if (addr == s->idp_offset) {
s->idp_index = (uint32_t)val & ((AHCI_MEM_BAR_SIZE - 1) & ~3);
} else if (addr == s->idp_offset + 4) {
ahci_mem_write(opaque, s->idp_index, val, size);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,
uint64_t VAR_2, unsigned VAR_3)
{
AHCIState *s = VAR_0;
if (VAR_1 == s->idp_offset) {
s->idp_index = (uint32_t)VAR_2 & ((AHCI_MEM_BAR_SIZE - 1) & ~3);
} else if (VAR_1 == s->idp_offset + 4) {
ahci_mem_write(VAR_0, s->idp_index, VAR_2, VAR_3);
}
}
| [
"static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{",
"AHCIState *s = VAR_0;",
"if (VAR_1 == s->idp_offset) {",
"s->idp_index = (uint32_t)VAR_2 & ((AHCI_MEM_BAR_SIZE - 1) & ~3);",
"} else if (VAR_1 == s->idp_offset + 4) {",
"ahci_mem_write(VAR_0, s->idp_index, VAR_2, VAR_3);",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7
],
[
11
],
[
15
],
[
17
],
[
21
],
[
23
],
[
25
]
] |
1,569 | static void nbd_refresh_filename(BlockDriverState *bs, QDict *options)
{
BDRVNBDState *s = bs->opaque;
QDict *opts = qdict_new();
QObject *saddr_qdict;
Visitor *ov;
const char *host = NULL, *port = NULL, *path = NULL;
if (s->saddr->type == SOCKET_ADDRESS_KIND_INET) {
const InetSocketAddress *inet = s->saddr->u.inet.data;
if (!inet->has_ipv4 && !inet->has_ipv6 && !inet->has_to) {
host = inet->host;
port = inet->port;
}
} else if (s->saddr->type == SOCKET_ADDRESS_KIND_UNIX) {
path = s->saddr->u.q_unix.data->path;
}
qdict_put(opts, "driver", qstring_from_str("nbd"));
if (path && s->export) {
snprintf(bs->exact_filename, sizeof(bs->exact_filename),
"nbd+unix:///%s?socket=%s", s->export, path);
} else if (path && !s->export) {
snprintf(bs->exact_filename, sizeof(bs->exact_filename),
"nbd+unix://?socket=%s", path);
} else if (host && s->export) {
snprintf(bs->exact_filename, sizeof(bs->exact_filename),
"nbd://%s:%s/%s", host, port, s->export);
} else if (host && !s->export) {
snprintf(bs->exact_filename, sizeof(bs->exact_filename),
"nbd://%s:%s", host, port);
}
ov = qobject_output_visitor_new(&saddr_qdict);
visit_type_SocketAddress(ov, NULL, &s->saddr, &error_abort);
visit_complete(ov, &saddr_qdict);
visit_free(ov);
qdict_put_obj(opts, "server", saddr_qdict);
if (s->export) {
qdict_put(opts, "export", qstring_from_str(s->export));
}
if (s->tlscredsid) {
qdict_put(opts, "tls-creds", qstring_from_str(s->tlscredsid));
}
qdict_flatten(opts);
bs->full_open_options = opts;
}
| false | qemu | 9445673ea67c272616b9f718396e267caa6446b7 | static void nbd_refresh_filename(BlockDriverState *bs, QDict *options)
{
BDRVNBDState *s = bs->opaque;
QDict *opts = qdict_new();
QObject *saddr_qdict;
Visitor *ov;
const char *host = NULL, *port = NULL, *path = NULL;
if (s->saddr->type == SOCKET_ADDRESS_KIND_INET) {
const InetSocketAddress *inet = s->saddr->u.inet.data;
if (!inet->has_ipv4 && !inet->has_ipv6 && !inet->has_to) {
host = inet->host;
port = inet->port;
}
} else if (s->saddr->type == SOCKET_ADDRESS_KIND_UNIX) {
path = s->saddr->u.q_unix.data->path;
}
qdict_put(opts, "driver", qstring_from_str("nbd"));
if (path && s->export) {
snprintf(bs->exact_filename, sizeof(bs->exact_filename),
"nbd+unix:
} else if (path && !s->export) {
snprintf(bs->exact_filename, sizeof(bs->exact_filename),
"nbd+unix:
} else if (host && s->export) {
snprintf(bs->exact_filename, sizeof(bs->exact_filename),
"nbd:
} else if (host && !s->export) {
snprintf(bs->exact_filename, sizeof(bs->exact_filename),
"nbd:
}
ov = qobject_output_visitor_new(&saddr_qdict);
visit_type_SocketAddress(ov, NULL, &s->saddr, &error_abort);
visit_complete(ov, &saddr_qdict);
visit_free(ov);
qdict_put_obj(opts, "server", saddr_qdict);
if (s->export) {
qdict_put(opts, "export", qstring_from_str(s->export));
}
if (s->tlscredsid) {
qdict_put(opts, "tls-creds", qstring_from_str(s->tlscredsid));
}
qdict_flatten(opts);
bs->full_open_options = opts;
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1)
{
BDRVNBDState *s = VAR_0->opaque;
QDict *opts = qdict_new();
QObject *saddr_qdict;
Visitor *ov;
const char *VAR_2 = NULL, *VAR_3 = NULL, *VAR_4 = NULL;
if (s->saddr->type == SOCKET_ADDRESS_KIND_INET) {
const InetSocketAddress *VAR_5 = s->saddr->u.VAR_5.data;
if (!VAR_5->has_ipv4 && !VAR_5->has_ipv6 && !VAR_5->has_to) {
VAR_2 = VAR_5->VAR_2;
VAR_3 = VAR_5->VAR_3;
}
} else if (s->saddr->type == SOCKET_ADDRESS_KIND_UNIX) {
VAR_4 = s->saddr->u.q_unix.data->VAR_4;
}
qdict_put(opts, "driver", qstring_from_str("nbd"));
if (VAR_4 && s->export) {
snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),
"nbd+unix:
} else if (VAR_4 && !s->export) {
snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),
"nbd+unix:
} else if (VAR_2 && s->export) {
snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),
"nbd:
} else if (VAR_2 && !s->export) {
snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),
"nbd:
}
ov = qobject_output_visitor_new(&saddr_qdict);
visit_type_SocketAddress(ov, NULL, &s->saddr, &error_abort);
visit_complete(ov, &saddr_qdict);
visit_free(ov);
qdict_put_obj(opts, "server", saddr_qdict);
if (s->export) {
qdict_put(opts, "export", qstring_from_str(s->export));
}
if (s->tlscredsid) {
qdict_put(opts, "tls-creds", qstring_from_str(s->tlscredsid));
}
qdict_flatten(opts);
VAR_0->full_open_options = opts;
}
| [
"static void FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1)\n{",
"BDRVNBDState *s = VAR_0->opaque;",
"QDict *opts = qdict_new();",
"QObject *saddr_qdict;",
"Visitor *ov;",
"const char *VAR_2 = NULL, *VAR_3 = NULL, *VAR_4 = NULL;",
"if (s->saddr->type == SOCKET_ADDRESS_KIND_INET) {",
"const InetSocketAddress *VAR_5 = s->saddr->u.VAR_5.data;",
"if (!VAR_5->has_ipv4 && !VAR_5->has_ipv6 && !VAR_5->has_to) {",
"VAR_2 = VAR_5->VAR_2;",
"VAR_3 = VAR_5->VAR_3;",
"}",
"} else if (s->saddr->type == SOCKET_ADDRESS_KIND_UNIX) {",
"VAR_4 = s->saddr->u.q_unix.data->VAR_4;",
"}",
"qdict_put(opts, \"driver\", qstring_from_str(\"nbd\"));",
"if (VAR_4 && s->export) {",
"snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),\n\"nbd+unix:\n} else if (VAR_4 && !s->export) {",
"snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),\n\"nbd+unix:\n} else if (VAR_2 && s->export) {",
"snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),\n\"nbd:\n} else if (VAR_2 && !s->export) {",
"snprintf(VAR_0->exact_filename, sizeof(VAR_0->exact_filename),\n\"nbd:\n}",
"ov = qobject_output_visitor_new(&saddr_qdict);",
"visit_type_SocketAddress(ov, NULL, &s->saddr, &error_abort);",
"visit_complete(ov, &saddr_qdict);",
"visit_free(ov);",
"qdict_put_obj(opts, \"server\", saddr_qdict);",
"if (s->export) {",
"qdict_put(opts, \"export\", qstring_from_str(s->export));",
"}",
"if (s->tlscredsid) {",
"qdict_put(opts, \"tls-creds\", qstring_from_str(s->tlscredsid));",
"}",
"qdict_flatten(opts);",
"VAR_0->full_open_options = opts;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
37
],
[
41
],
[
43,
45,
47
],
[
49,
51,
53
],
[
55,
57,
59
],
[
61,
63,
65
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
95
],
[
97
],
[
99
]
] |
1,570 | static void virtio_balloon_receive_stats(VirtIODevice *vdev, VirtQueue *vq)
{
VirtIOBalloon *s = VIRTIO_BALLOON(vdev);
VirtQueueElement *elem = &s->stats_vq_elem;
VirtIOBalloonStat stat;
size_t offset = 0;
qemu_timeval tv;
if (!virtqueue_pop(vq, elem)) {
goto out;
}
/* Initialize the stats to get rid of any stale values. This is only
* needed to handle the case where a guest supports fewer stats than it
* used to (ie. it has booted into an old kernel).
*/
reset_stats(s);
while (iov_to_buf(elem->out_sg, elem->out_num, offset, &stat, sizeof(stat))
== sizeof(stat)) {
uint16_t tag = virtio_tswap16(vdev, stat.tag);
uint64_t val = virtio_tswap64(vdev, stat.val);
offset += sizeof(stat);
if (tag < VIRTIO_BALLOON_S_NR)
s->stats[tag] = val;
}
s->stats_vq_offset = offset;
if (qemu_gettimeofday(&tv) < 0) {
fprintf(stderr, "warning: %s: failed to get time of day\n", __func__);
goto out;
}
s->stats_last_update = tv.tv_sec;
out:
if (balloon_stats_enabled(s)) {
balloon_stats_change_timer(s, s->stats_poll_interval);
}
}
| false | qemu | 51b19ebe4320f3dcd93cea71235c1219318ddfd2 | static void virtio_balloon_receive_stats(VirtIODevice *vdev, VirtQueue *vq)
{
VirtIOBalloon *s = VIRTIO_BALLOON(vdev);
VirtQueueElement *elem = &s->stats_vq_elem;
VirtIOBalloonStat stat;
size_t offset = 0;
qemu_timeval tv;
if (!virtqueue_pop(vq, elem)) {
goto out;
}
reset_stats(s);
while (iov_to_buf(elem->out_sg, elem->out_num, offset, &stat, sizeof(stat))
== sizeof(stat)) {
uint16_t tag = virtio_tswap16(vdev, stat.tag);
uint64_t val = virtio_tswap64(vdev, stat.val);
offset += sizeof(stat);
if (tag < VIRTIO_BALLOON_S_NR)
s->stats[tag] = val;
}
s->stats_vq_offset = offset;
if (qemu_gettimeofday(&tv) < 0) {
fprintf(stderr, "warning: %s: failed to get time of day\n", __func__);
goto out;
}
s->stats_last_update = tv.tv_sec;
out:
if (balloon_stats_enabled(s)) {
balloon_stats_change_timer(s, s->stats_poll_interval);
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(VirtIODevice *VAR_0, VirtQueue *VAR_1)
{
VirtIOBalloon *s = VIRTIO_BALLOON(VAR_0);
VirtQueueElement *elem = &s->stats_vq_elem;
VirtIOBalloonStat stat;
size_t offset = 0;
qemu_timeval tv;
if (!virtqueue_pop(VAR_1, elem)) {
goto out;
}
reset_stats(s);
while (iov_to_buf(elem->out_sg, elem->out_num, offset, &stat, sizeof(stat))
== sizeof(stat)) {
uint16_t tag = virtio_tswap16(VAR_0, stat.tag);
uint64_t val = virtio_tswap64(VAR_0, stat.val);
offset += sizeof(stat);
if (tag < VIRTIO_BALLOON_S_NR)
s->stats[tag] = val;
}
s->stats_vq_offset = offset;
if (qemu_gettimeofday(&tv) < 0) {
fprintf(stderr, "warning: %s: failed to get time of day\n", __func__);
goto out;
}
s->stats_last_update = tv.tv_sec;
out:
if (balloon_stats_enabled(s)) {
balloon_stats_change_timer(s, s->stats_poll_interval);
}
}
| [
"static void FUNC_0(VirtIODevice *VAR_0, VirtQueue *VAR_1)\n{",
"VirtIOBalloon *s = VIRTIO_BALLOON(VAR_0);",
"VirtQueueElement *elem = &s->stats_vq_elem;",
"VirtIOBalloonStat stat;",
"size_t offset = 0;",
"qemu_timeval tv;",
"if (!virtqueue_pop(VAR_1, elem)) {",
"goto out;",
"}",
"reset_stats(s);",
"while (iov_to_buf(elem->out_sg, elem->out_num, offset, &stat, sizeof(stat))\n== sizeof(stat)) {",
"uint16_t tag = virtio_tswap16(VAR_0, stat.tag);",
"uint64_t val = virtio_tswap64(VAR_0, stat.val);",
"offset += sizeof(stat);",
"if (tag < VIRTIO_BALLOON_S_NR)\ns->stats[tag] = val;",
"}",
"s->stats_vq_offset = offset;",
"if (qemu_gettimeofday(&tv) < 0) {",
"fprintf(stderr, \"warning: %s: failed to get time of day\\n\", __func__);",
"goto out;",
"}",
"s->stats_last_update = tv.tv_sec;",
"out:\nif (balloon_stats_enabled(s)) {",
"balloon_stats_change_timer(s, s->stats_poll_interval);",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
33
],
[
37,
39
],
[
41
],
[
43
],
[
47
],
[
49,
51
],
[
53
],
[
55
],
[
59
],
[
61
],
[
63
],
[
65
],
[
69
],
[
73,
75
],
[
77
],
[
79
],
[
81
]
] |
1,574 | ISABus *isa_bus_new(DeviceState *dev)
{
if (isabus) {
fprintf(stderr, "Can't create a second ISA bus\n");
return NULL;
}
if (NULL == dev) {
dev = qdev_create(NULL, "isabus-bridge");
qdev_init(dev);
}
isabus = FROM_QBUS(ISABus, qbus_create(&isa_bus_info, dev, NULL));
return isabus;
}
| true | qemu | e23a1b33b53d25510320b26d9f154e19c6c99725 | ISABus *isa_bus_new(DeviceState *dev)
{
if (isabus) {
fprintf(stderr, "Can't create a second ISA bus\n");
return NULL;
}
if (NULL == dev) {
dev = qdev_create(NULL, "isabus-bridge");
qdev_init(dev);
}
isabus = FROM_QBUS(ISABus, qbus_create(&isa_bus_info, dev, NULL));
return isabus;
}
| {
"code": [
" return NULL;",
" return NULL;",
" qdev_init(dev);",
" qdev_init(dev);"
],
"line_no": [
9,
9,
17,
17
]
} | ISABus *FUNC_0(DeviceState *dev)
{
if (isabus) {
fprintf(stderr, "Can't create a second ISA bus\n");
return NULL;
}
if (NULL == dev) {
dev = qdev_create(NULL, "isabus-bridge");
qdev_init(dev);
}
isabus = FROM_QBUS(ISABus, qbus_create(&isa_bus_info, dev, NULL));
return isabus;
}
| [
"ISABus *FUNC_0(DeviceState *dev)\n{",
"if (isabus) {",
"fprintf(stderr, \"Can't create a second ISA bus\\n\");",
"return NULL;",
"}",
"if (NULL == dev) {",
"dev = qdev_create(NULL, \"isabus-bridge\");",
"qdev_init(dev);",
"}",
"isabus = FROM_QBUS(ISABus, qbus_create(&isa_bus_info, dev, NULL));",
"return isabus;",
"}"
] | [
0,
0,
0,
1,
0,
0,
0,
1,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
]
] |
1,575 | void os_set_proc_name(const char *s)
{
#if defined(PR_SET_NAME)
char name[16];
if (!s)
return;
name[sizeof(name) - 1] = 0;
strncpy(name, s, sizeof(name));
/* Could rewrite argv[0] too, but that's a bit more complicated.
This simple way is enough for `top'. */
if (prctl(PR_SET_NAME, name)) {
perror("unable to change process name");
exit(1);
}
#else
fprintf(stderr, "Change of process name not supported by your OS\n");
exit(1);
#endif
}
| true | qemu | 3eadc68ebd174f5bad51fe6e0bbcf6d6651c784c | void os_set_proc_name(const char *s)
{
#if defined(PR_SET_NAME)
char name[16];
if (!s)
return;
name[sizeof(name) - 1] = 0;
strncpy(name, s, sizeof(name));
if (prctl(PR_SET_NAME, name)) {
perror("unable to change process name");
exit(1);
}
#else
fprintf(stderr, "Change of process name not supported by your OS\n");
exit(1);
#endif
}
| {
"code": [
" name[sizeof(name) - 1] = 0;",
" strncpy(name, s, sizeof(name));"
],
"line_no": [
13,
15
]
} | void FUNC_0(const char *VAR_0)
{
#if defined(PR_SET_NAME)
char name[16];
if (!VAR_0)
return;
name[sizeof(name) - 1] = 0;
strncpy(name, VAR_0, sizeof(name));
if (prctl(PR_SET_NAME, name)) {
perror("unable to change process name");
exit(1);
}
#else
fprintf(stderr, "Change of process name not supported by your OS\n");
exit(1);
#endif
}
| [
"void FUNC_0(const char *VAR_0)\n{",
"#if defined(PR_SET_NAME)\nchar name[16];",
"if (!VAR_0)\nreturn;",
"name[sizeof(name) - 1] = 0;",
"strncpy(name, VAR_0, sizeof(name));",
"if (prctl(PR_SET_NAME, name)) {",
"perror(\"unable to change process name\");",
"exit(1);",
"}",
"#else\nfprintf(stderr, \"Change of process name not supported by your OS\\n\");",
"exit(1);",
"#endif\n}"
] | [
0,
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5,
7
],
[
9,
11
],
[
13
],
[
15
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29,
31
],
[
33
],
[
35,
37
]
] |
1,576 | static int oss_poll_out (HWVoiceOut *hw)
{
OSSVoiceOut *oss = (OSSVoiceOut *) hw;
return qemu_set_fd_handler (oss->fd, NULL, oss_helper_poll_out, NULL);
}
| true | qemu | b027a538c6790bcfc93ef7f4819fe3e581445959 | static int oss_poll_out (HWVoiceOut *hw)
{
OSSVoiceOut *oss = (OSSVoiceOut *) hw;
return qemu_set_fd_handler (oss->fd, NULL, oss_helper_poll_out, NULL);
}
| {
"code": [
"static int oss_poll_out (HWVoiceOut *hw)",
" return qemu_set_fd_handler (oss->fd, NULL, oss_helper_poll_out, NULL);"
],
"line_no": [
1,
9
]
} | static int FUNC_0 (HWVoiceOut *VAR_0)
{
OSSVoiceOut *oss = (OSSVoiceOut *) VAR_0;
return qemu_set_fd_handler (oss->fd, NULL, oss_helper_poll_out, NULL);
}
| [
"static int FUNC_0 (HWVoiceOut *VAR_0)\n{",
"OSSVoiceOut *oss = (OSSVoiceOut *) VAR_0;",
"return qemu_set_fd_handler (oss->fd, NULL, oss_helper_poll_out, NULL);",
"}"
] | [
1,
0,
1,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
]
] |
1,577 | void OPPROTO op_addzeo (void)
{
do_addzeo();
RETURN();
}
| true | qemu | d9bce9d99f4656ae0b0127f7472db9067b8f84ab | void OPPROTO op_addzeo (void)
{
do_addzeo();
RETURN();
}
| {
"code": [
" RETURN();",
"void OPPROTO op_addzeo (void)",
" do_addzeo();",
" RETURN();"
],
"line_no": [
7,
1,
5,
7
]
} | void VAR_0 op_addzeo (void)
{
do_addzeo();
RETURN();
}
| [
"void VAR_0 op_addzeo (void)\n{",
"do_addzeo();",
"RETURN();",
"}"
] | [
1,
1,
1,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
]
] |
1,579 | static void avc_loopfilter_cb_or_cr_inter_edge_hor_msa(uint8_t *data,
uint8_t bs0, uint8_t bs1,
uint8_t bs2, uint8_t bs3,
uint8_t tc0, uint8_t tc1,
uint8_t tc2, uint8_t tc3,
uint8_t alpha_in,
uint8_t beta_in,
uint32_t img_width)
{
v16u8 alpha, beta;
v8i16 tmp_vec;
v8i16 bs = { 0 };
v8i16 tc = { 0 };
v16u8 p0, q0, p0_asub_q0, p1_asub_p0, q1_asub_q0;
v16u8 is_less_than;
v16u8 is_less_than_beta, is_less_than_alpha, is_bs_greater_than0;
v8i16 p0_r, q0_r;
v16u8 p1_org, p0_org, q0_org, q1_org;
v8i16 p1_org_r, p0_org_r, q0_org_r, q1_org_r;
v16i8 negate_tc, sign_negate_tc;
v8i16 tc_r, negate_tc_r;
v16i8 zero = { 0 };
tmp_vec = (v8i16) __msa_fill_b(bs0);
bs = __msa_insve_h(bs, 0, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(bs1);
bs = __msa_insve_h(bs, 1, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(bs2);
bs = __msa_insve_h(bs, 2, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(bs3);
bs = __msa_insve_h(bs, 3, tmp_vec);
if (!__msa_test_bz_v((v16u8) bs)) {
tmp_vec = (v8i16) __msa_fill_b(tc0);
tc = __msa_insve_h(tc, 0, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(tc1);
tc = __msa_insve_h(tc, 1, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(tc2);
tc = __msa_insve_h(tc, 2, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(tc3);
tc = __msa_insve_h(tc, 3, tmp_vec);
is_bs_greater_than0 = (v16u8) (zero < (v16i8) bs);
alpha = (v16u8) __msa_fill_b(alpha_in);
beta = (v16u8) __msa_fill_b(beta_in);
p1_org = LOAD_UB(data - (img_width << 1));
p0_org = LOAD_UB(data - img_width);
q0_org = LOAD_UB(data);
q1_org = LOAD_UB(data + img_width);
p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org);
p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org);
q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org);
is_less_than_alpha = (p0_asub_q0 < alpha);
is_less_than_beta = (p1_asub_p0 < beta);
is_less_than = is_less_than_beta & is_less_than_alpha;
is_less_than_beta = (q1_asub_q0 < beta);
is_less_than = is_less_than_beta & is_less_than;
is_less_than = is_less_than & is_bs_greater_than0;
is_less_than = (v16u8) __msa_ilvr_d((v2i64) zero, (v2i64) is_less_than);
if (!__msa_test_bz_v(is_less_than)) {
negate_tc = zero - (v16i8) tc;
sign_negate_tc = __msa_clti_s_b(negate_tc, 0);
negate_tc_r = (v8i16) __msa_ilvr_b(sign_negate_tc, negate_tc);
tc_r = (v8i16) __msa_ilvr_b(zero, (v16i8) tc);
p1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p1_org);
p0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p0_org);
q0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q0_org);
q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org);
AVC_LOOP_FILTER_P0Q0(q0_org_r, p0_org_r, p1_org_r, q1_org_r,
negate_tc_r, tc_r, p0_r, q0_r);
p0 = (v16u8) __msa_pckev_b(zero, (v16i8) p0_r);
q0 = (v16u8) __msa_pckev_b(zero, (v16i8) q0_r);
p0_org = __msa_bmnz_v(p0_org, p0, is_less_than);
q0_org = __msa_bmnz_v(q0_org, q0, is_less_than);
STORE_UB(q0_org, data);
STORE_UB(p0_org, (data - img_width));
}
}
}
| false | FFmpeg | bcd7bf7eeb09a395cc01698842d1b8be9af483fc | static void avc_loopfilter_cb_or_cr_inter_edge_hor_msa(uint8_t *data,
uint8_t bs0, uint8_t bs1,
uint8_t bs2, uint8_t bs3,
uint8_t tc0, uint8_t tc1,
uint8_t tc2, uint8_t tc3,
uint8_t alpha_in,
uint8_t beta_in,
uint32_t img_width)
{
v16u8 alpha, beta;
v8i16 tmp_vec;
v8i16 bs = { 0 };
v8i16 tc = { 0 };
v16u8 p0, q0, p0_asub_q0, p1_asub_p0, q1_asub_q0;
v16u8 is_less_than;
v16u8 is_less_than_beta, is_less_than_alpha, is_bs_greater_than0;
v8i16 p0_r, q0_r;
v16u8 p1_org, p0_org, q0_org, q1_org;
v8i16 p1_org_r, p0_org_r, q0_org_r, q1_org_r;
v16i8 negate_tc, sign_negate_tc;
v8i16 tc_r, negate_tc_r;
v16i8 zero = { 0 };
tmp_vec = (v8i16) __msa_fill_b(bs0);
bs = __msa_insve_h(bs, 0, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(bs1);
bs = __msa_insve_h(bs, 1, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(bs2);
bs = __msa_insve_h(bs, 2, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(bs3);
bs = __msa_insve_h(bs, 3, tmp_vec);
if (!__msa_test_bz_v((v16u8) bs)) {
tmp_vec = (v8i16) __msa_fill_b(tc0);
tc = __msa_insve_h(tc, 0, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(tc1);
tc = __msa_insve_h(tc, 1, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(tc2);
tc = __msa_insve_h(tc, 2, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(tc3);
tc = __msa_insve_h(tc, 3, tmp_vec);
is_bs_greater_than0 = (v16u8) (zero < (v16i8) bs);
alpha = (v16u8) __msa_fill_b(alpha_in);
beta = (v16u8) __msa_fill_b(beta_in);
p1_org = LOAD_UB(data - (img_width << 1));
p0_org = LOAD_UB(data - img_width);
q0_org = LOAD_UB(data);
q1_org = LOAD_UB(data + img_width);
p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org);
p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org);
q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org);
is_less_than_alpha = (p0_asub_q0 < alpha);
is_less_than_beta = (p1_asub_p0 < beta);
is_less_than = is_less_than_beta & is_less_than_alpha;
is_less_than_beta = (q1_asub_q0 < beta);
is_less_than = is_less_than_beta & is_less_than;
is_less_than = is_less_than & is_bs_greater_than0;
is_less_than = (v16u8) __msa_ilvr_d((v2i64) zero, (v2i64) is_less_than);
if (!__msa_test_bz_v(is_less_than)) {
negate_tc = zero - (v16i8) tc;
sign_negate_tc = __msa_clti_s_b(negate_tc, 0);
negate_tc_r = (v8i16) __msa_ilvr_b(sign_negate_tc, negate_tc);
tc_r = (v8i16) __msa_ilvr_b(zero, (v16i8) tc);
p1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p1_org);
p0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p0_org);
q0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q0_org);
q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org);
AVC_LOOP_FILTER_P0Q0(q0_org_r, p0_org_r, p1_org_r, q1_org_r,
negate_tc_r, tc_r, p0_r, q0_r);
p0 = (v16u8) __msa_pckev_b(zero, (v16i8) p0_r);
q0 = (v16u8) __msa_pckev_b(zero, (v16i8) q0_r);
p0_org = __msa_bmnz_v(p0_org, p0, is_less_than);
q0_org = __msa_bmnz_v(q0_org, q0, is_less_than);
STORE_UB(q0_org, data);
STORE_UB(p0_org, (data - img_width));
}
}
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(uint8_t *VAR_0,
uint8_t VAR_1, uint8_t VAR_2,
uint8_t VAR_3, uint8_t VAR_4,
uint8_t VAR_5, uint8_t VAR_6,
uint8_t VAR_7, uint8_t VAR_8,
uint8_t VAR_9,
uint8_t VAR_10,
uint32_t VAR_11)
{
v16u8 alpha, beta;
v8i16 tmp_vec;
v8i16 bs = { 0 };
v8i16 tc = { 0 };
v16u8 p0, q0, p0_asub_q0, p1_asub_p0, q1_asub_q0;
v16u8 is_less_than;
v16u8 is_less_than_beta, is_less_than_alpha, is_bs_greater_than0;
v8i16 p0_r, q0_r;
v16u8 p1_org, p0_org, q0_org, q1_org;
v8i16 p1_org_r, p0_org_r, q0_org_r, q1_org_r;
v16i8 negate_tc, sign_negate_tc;
v8i16 tc_r, negate_tc_r;
v16i8 zero = { 0 };
tmp_vec = (v8i16) __msa_fill_b(VAR_1);
bs = __msa_insve_h(bs, 0, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(VAR_2);
bs = __msa_insve_h(bs, 1, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(VAR_3);
bs = __msa_insve_h(bs, 2, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(VAR_4);
bs = __msa_insve_h(bs, 3, tmp_vec);
if (!__msa_test_bz_v((v16u8) bs)) {
tmp_vec = (v8i16) __msa_fill_b(VAR_5);
tc = __msa_insve_h(tc, 0, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(VAR_6);
tc = __msa_insve_h(tc, 1, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(VAR_7);
tc = __msa_insve_h(tc, 2, tmp_vec);
tmp_vec = (v8i16) __msa_fill_b(VAR_8);
tc = __msa_insve_h(tc, 3, tmp_vec);
is_bs_greater_than0 = (v16u8) (zero < (v16i8) bs);
alpha = (v16u8) __msa_fill_b(VAR_9);
beta = (v16u8) __msa_fill_b(VAR_10);
p1_org = LOAD_UB(VAR_0 - (VAR_11 << 1));
p0_org = LOAD_UB(VAR_0 - VAR_11);
q0_org = LOAD_UB(VAR_0);
q1_org = LOAD_UB(VAR_0 + VAR_11);
p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org);
p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org);
q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org);
is_less_than_alpha = (p0_asub_q0 < alpha);
is_less_than_beta = (p1_asub_p0 < beta);
is_less_than = is_less_than_beta & is_less_than_alpha;
is_less_than_beta = (q1_asub_q0 < beta);
is_less_than = is_less_than_beta & is_less_than;
is_less_than = is_less_than & is_bs_greater_than0;
is_less_than = (v16u8) __msa_ilvr_d((v2i64) zero, (v2i64) is_less_than);
if (!__msa_test_bz_v(is_less_than)) {
negate_tc = zero - (v16i8) tc;
sign_negate_tc = __msa_clti_s_b(negate_tc, 0);
negate_tc_r = (v8i16) __msa_ilvr_b(sign_negate_tc, negate_tc);
tc_r = (v8i16) __msa_ilvr_b(zero, (v16i8) tc);
p1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p1_org);
p0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p0_org);
q0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q0_org);
q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org);
AVC_LOOP_FILTER_P0Q0(q0_org_r, p0_org_r, p1_org_r, q1_org_r,
negate_tc_r, tc_r, p0_r, q0_r);
p0 = (v16u8) __msa_pckev_b(zero, (v16i8) p0_r);
q0 = (v16u8) __msa_pckev_b(zero, (v16i8) q0_r);
p0_org = __msa_bmnz_v(p0_org, p0, is_less_than);
q0_org = __msa_bmnz_v(q0_org, q0, is_less_than);
STORE_UB(q0_org, VAR_0);
STORE_UB(p0_org, (VAR_0 - VAR_11));
}
}
}
| [
"static void FUNC_0(uint8_t *VAR_0,\nuint8_t VAR_1, uint8_t VAR_2,\nuint8_t VAR_3, uint8_t VAR_4,\nuint8_t VAR_5, uint8_t VAR_6,\nuint8_t VAR_7, uint8_t VAR_8,\nuint8_t VAR_9,\nuint8_t VAR_10,\nuint32_t VAR_11)\n{",
"v16u8 alpha, beta;",
"v8i16 tmp_vec;",
"v8i16 bs = { 0 };",
"v8i16 tc = { 0 };",
"v16u8 p0, q0, p0_asub_q0, p1_asub_p0, q1_asub_q0;",
"v16u8 is_less_than;",
"v16u8 is_less_than_beta, is_less_than_alpha, is_bs_greater_than0;",
"v8i16 p0_r, q0_r;",
"v16u8 p1_org, p0_org, q0_org, q1_org;",
"v8i16 p1_org_r, p0_org_r, q0_org_r, q1_org_r;",
"v16i8 negate_tc, sign_negate_tc;",
"v8i16 tc_r, negate_tc_r;",
"v16i8 zero = { 0 };",
"tmp_vec = (v8i16) __msa_fill_b(VAR_1);",
"bs = __msa_insve_h(bs, 0, tmp_vec);",
"tmp_vec = (v8i16) __msa_fill_b(VAR_2);",
"bs = __msa_insve_h(bs, 1, tmp_vec);",
"tmp_vec = (v8i16) __msa_fill_b(VAR_3);",
"bs = __msa_insve_h(bs, 2, tmp_vec);",
"tmp_vec = (v8i16) __msa_fill_b(VAR_4);",
"bs = __msa_insve_h(bs, 3, tmp_vec);",
"if (!__msa_test_bz_v((v16u8) bs)) {",
"tmp_vec = (v8i16) __msa_fill_b(VAR_5);",
"tc = __msa_insve_h(tc, 0, tmp_vec);",
"tmp_vec = (v8i16) __msa_fill_b(VAR_6);",
"tc = __msa_insve_h(tc, 1, tmp_vec);",
"tmp_vec = (v8i16) __msa_fill_b(VAR_7);",
"tc = __msa_insve_h(tc, 2, tmp_vec);",
"tmp_vec = (v8i16) __msa_fill_b(VAR_8);",
"tc = __msa_insve_h(tc, 3, tmp_vec);",
"is_bs_greater_than0 = (v16u8) (zero < (v16i8) bs);",
"alpha = (v16u8) __msa_fill_b(VAR_9);",
"beta = (v16u8) __msa_fill_b(VAR_10);",
"p1_org = LOAD_UB(VAR_0 - (VAR_11 << 1));",
"p0_org = LOAD_UB(VAR_0 - VAR_11);",
"q0_org = LOAD_UB(VAR_0);",
"q1_org = LOAD_UB(VAR_0 + VAR_11);",
"p0_asub_q0 = __msa_asub_u_b(p0_org, q0_org);",
"p1_asub_p0 = __msa_asub_u_b(p1_org, p0_org);",
"q1_asub_q0 = __msa_asub_u_b(q1_org, q0_org);",
"is_less_than_alpha = (p0_asub_q0 < alpha);",
"is_less_than_beta = (p1_asub_p0 < beta);",
"is_less_than = is_less_than_beta & is_less_than_alpha;",
"is_less_than_beta = (q1_asub_q0 < beta);",
"is_less_than = is_less_than_beta & is_less_than;",
"is_less_than = is_less_than & is_bs_greater_than0;",
"is_less_than = (v16u8) __msa_ilvr_d((v2i64) zero, (v2i64) is_less_than);",
"if (!__msa_test_bz_v(is_less_than)) {",
"negate_tc = zero - (v16i8) tc;",
"sign_negate_tc = __msa_clti_s_b(negate_tc, 0);",
"negate_tc_r = (v8i16) __msa_ilvr_b(sign_negate_tc, negate_tc);",
"tc_r = (v8i16) __msa_ilvr_b(zero, (v16i8) tc);",
"p1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p1_org);",
"p0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) p0_org);",
"q0_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q0_org);",
"q1_org_r = (v8i16) __msa_ilvr_b(zero, (v16i8) q1_org);",
"AVC_LOOP_FILTER_P0Q0(q0_org_r, p0_org_r, p1_org_r, q1_org_r,\nnegate_tc_r, tc_r, p0_r, q0_r);",
"p0 = (v16u8) __msa_pckev_b(zero, (v16i8) p0_r);",
"q0 = (v16u8) __msa_pckev_b(zero, (v16i8) q0_r);",
"p0_org = __msa_bmnz_v(p0_org, p0, is_less_than);",
"q0_org = __msa_bmnz_v(q0_org, q0, is_less_than);",
"STORE_UB(q0_org, VAR_0);",
"STORE_UB(p0_org, (VAR_0 - VAR_11));",
"}",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7,
9,
11,
13,
15,
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
61
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
81
],
[
85
],
[
89
],
[
91
],
[
95
],
[
97
],
[
99
],
[
101
],
[
105
],
[
107
],
[
109
],
[
113
],
[
115
],
[
117
],
[
119
],
[
121
],
[
123
],
[
127
],
[
131
],
[
133
],
[
135
],
[
139
],
[
143
],
[
147
],
[
149
],
[
151
],
[
153
],
[
157,
159
],
[
163
],
[
165
],
[
169
],
[
171
],
[
175
],
[
177
],
[
179
],
[
181
],
[
183
]
] |
1,580 | static int64_t truehd_layout(int chanmap)
{
int layout = 0, i;
for (i = 0; i < 13; i++)
layout |= thd_layout[i] * ((chanmap >> i) & 1);
return layout;
}
| false | FFmpeg | cc276c85d15272df6e44fb3252657a43cbd49555 | static int64_t truehd_layout(int chanmap)
{
int layout = 0, i;
for (i = 0; i < 13; i++)
layout |= thd_layout[i] * ((chanmap >> i) & 1);
return layout;
}
| {
"code": [],
"line_no": []
} | static int64_t FUNC_0(int chanmap)
{
int VAR_0 = 0, VAR_1;
for (VAR_1 = 0; VAR_1 < 13; VAR_1++)
VAR_0 |= thd_layout[VAR_1] * ((chanmap >> VAR_1) & 1);
return VAR_0;
}
| [
"static int64_t FUNC_0(int chanmap)\n{",
"int VAR_0 = 0, VAR_1;",
"for (VAR_1 = 0; VAR_1 < 13; VAR_1++)",
"VAR_0 |= thd_layout[VAR_1] * ((chanmap >> VAR_1) & 1);",
"return VAR_0;",
"}"
] | [
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11
],
[
15
],
[
17
]
] |
1,581 | void copy_picture_field(TInterlaceContext *tinterlace,
uint8_t *dst[4], int dst_linesize[4],
const uint8_t *src[4], int src_linesize[4],
enum AVPixelFormat format, int w, int src_h,
int src_field, int interleave, int dst_field,
int flags)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
int hsub = desc->log2_chroma_w;
int plane, vsub = desc->log2_chroma_h;
int k = src_field == FIELD_UPPER_AND_LOWER ? 1 : 2;
int h;
for (plane = 0; plane < desc->nb_components; plane++) {
int lines = plane == 1 || plane == 2 ? AV_CEIL_RSHIFT(src_h, vsub) : src_h;
int cols = plane == 1 || plane == 2 ? AV_CEIL_RSHIFT( w, hsub) : w;
uint8_t *dstp = dst[plane];
const uint8_t *srcp = src[plane];
int srcp_linesize = src_linesize[plane] * k;
int dstp_linesize = dst_linesize[plane] * (interleave ? 2 : 1);
lines = (lines + (src_field == FIELD_UPPER)) / k;
if (src_field == FIELD_LOWER)
srcp += src_linesize[plane];
if (interleave && dst_field == FIELD_LOWER)
dstp += dst_linesize[plane];
// Low-pass filtering is required when creating an interlaced destination from
// a progressive source which contains high-frequency vertical detail.
// Filtering will reduce interlace 'twitter' and Moire patterning.
if (flags & TINTERLACE_FLAG_VLPF || flags & TINTERLACE_FLAG_CVLPF) {
int x = 0;
if (flags & TINTERLACE_FLAG_CVLPF)
x = 1;
for (h = lines; h > 0; h--) {
ptrdiff_t pref = src_linesize[plane];
ptrdiff_t mref = -pref;
if (h >= (lines - x)) mref = 0; // there is no line above
else if (h <= (1 + x)) pref = 0; // there is no line below
tinterlace->lowpass_line(dstp, cols, srcp, mref, pref);
dstp += dstp_linesize;
srcp += srcp_linesize;
}
} else {
av_image_copy_plane(dstp, dstp_linesize, srcp, srcp_linesize, cols, lines);
}
}
}
| false | FFmpeg | 3af1060319b46005dbfb3b01f9104539caf30146 | void copy_picture_field(TInterlaceContext *tinterlace,
uint8_t *dst[4], int dst_linesize[4],
const uint8_t *src[4], int src_linesize[4],
enum AVPixelFormat format, int w, int src_h,
int src_field, int interleave, int dst_field,
int flags)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
int hsub = desc->log2_chroma_w;
int plane, vsub = desc->log2_chroma_h;
int k = src_field == FIELD_UPPER_AND_LOWER ? 1 : 2;
int h;
for (plane = 0; plane < desc->nb_components; plane++) {
int lines = plane == 1 || plane == 2 ? AV_CEIL_RSHIFT(src_h, vsub) : src_h;
int cols = plane == 1 || plane == 2 ? AV_CEIL_RSHIFT( w, hsub) : w;
uint8_t *dstp = dst[plane];
const uint8_t *srcp = src[plane];
int srcp_linesize = src_linesize[plane] * k;
int dstp_linesize = dst_linesize[plane] * (interleave ? 2 : 1);
lines = (lines + (src_field == FIELD_UPPER)) / k;
if (src_field == FIELD_LOWER)
srcp += src_linesize[plane];
if (interleave && dst_field == FIELD_LOWER)
dstp += dst_linesize[plane];
if (flags & TINTERLACE_FLAG_VLPF || flags & TINTERLACE_FLAG_CVLPF) {
int x = 0;
if (flags & TINTERLACE_FLAG_CVLPF)
x = 1;
for (h = lines; h > 0; h--) {
ptrdiff_t pref = src_linesize[plane];
ptrdiff_t mref = -pref;
if (h >= (lines - x)) mref = 0;
else if (h <= (1 + x)) pref = 0;
tinterlace->lowpass_line(dstp, cols, srcp, mref, pref);
dstp += dstp_linesize;
srcp += srcp_linesize;
}
} else {
av_image_copy_plane(dstp, dstp_linesize, srcp, srcp_linesize, cols, lines);
}
}
}
| {
"code": [],
"line_no": []
} | void FUNC_0(TInterlaceContext *VAR_0,
uint8_t *VAR_1[4], int VAR_2[4],
const uint8_t *VAR_3[4], int VAR_4[4],
enum AVPixelFormat VAR_5, int VAR_6, int VAR_7,
int VAR_8, int VAR_9, int VAR_10,
int VAR_11)
{
const AVPixFmtDescriptor *VAR_12 = av_pix_fmt_desc_get(VAR_5);
int VAR_13 = VAR_12->log2_chroma_w;
int VAR_14, VAR_15 = VAR_12->log2_chroma_h;
int VAR_16 = VAR_8 == FIELD_UPPER_AND_LOWER ? 1 : 2;
int VAR_17;
for (VAR_14 = 0; VAR_14 < VAR_12->nb_components; VAR_14++) {
int lines = VAR_14 == 1 || VAR_14 == 2 ? AV_CEIL_RSHIFT(VAR_7, VAR_15) : VAR_7;
int cols = VAR_14 == 1 || VAR_14 == 2 ? AV_CEIL_RSHIFT( VAR_6, VAR_13) : VAR_6;
uint8_t *dstp = VAR_1[VAR_14];
const uint8_t *srcp = VAR_3[VAR_14];
int srcp_linesize = VAR_4[VAR_14] * VAR_16;
int dstp_linesize = VAR_2[VAR_14] * (VAR_9 ? 2 : 1);
lines = (lines + (VAR_8 == FIELD_UPPER)) / VAR_16;
if (VAR_8 == FIELD_LOWER)
srcp += VAR_4[VAR_14];
if (VAR_9 && VAR_10 == FIELD_LOWER)
dstp += VAR_2[VAR_14];
if (VAR_11 & TINTERLACE_FLAG_VLPF || VAR_11 & TINTERLACE_FLAG_CVLPF) {
int x = 0;
if (VAR_11 & TINTERLACE_FLAG_CVLPF)
x = 1;
for (VAR_17 = lines; VAR_17 > 0; VAR_17--) {
ptrdiff_t pref = VAR_4[VAR_14];
ptrdiff_t mref = -pref;
if (VAR_17 >= (lines - x)) mref = 0;
else if (VAR_17 <= (1 + x)) pref = 0;
VAR_0->lowpass_line(dstp, cols, srcp, mref, pref);
dstp += dstp_linesize;
srcp += srcp_linesize;
}
} else {
av_image_copy_plane(dstp, dstp_linesize, srcp, srcp_linesize, cols, lines);
}
}
}
| [
"void FUNC_0(TInterlaceContext *VAR_0,\nuint8_t *VAR_1[4], int VAR_2[4],\nconst uint8_t *VAR_3[4], int VAR_4[4],\nenum AVPixelFormat VAR_5, int VAR_6, int VAR_7,\nint VAR_8, int VAR_9, int VAR_10,\nint VAR_11)\n{",
"const AVPixFmtDescriptor *VAR_12 = av_pix_fmt_desc_get(VAR_5);",
"int VAR_13 = VAR_12->log2_chroma_w;",
"int VAR_14, VAR_15 = VAR_12->log2_chroma_h;",
"int VAR_16 = VAR_8 == FIELD_UPPER_AND_LOWER ? 1 : 2;",
"int VAR_17;",
"for (VAR_14 = 0; VAR_14 < VAR_12->nb_components; VAR_14++) {",
"int lines = VAR_14 == 1 || VAR_14 == 2 ? AV_CEIL_RSHIFT(VAR_7, VAR_15) : VAR_7;",
"int cols = VAR_14 == 1 || VAR_14 == 2 ? AV_CEIL_RSHIFT( VAR_6, VAR_13) : VAR_6;",
"uint8_t *dstp = VAR_1[VAR_14];",
"const uint8_t *srcp = VAR_3[VAR_14];",
"int srcp_linesize = VAR_4[VAR_14] * VAR_16;",
"int dstp_linesize = VAR_2[VAR_14] * (VAR_9 ? 2 : 1);",
"lines = (lines + (VAR_8 == FIELD_UPPER)) / VAR_16;",
"if (VAR_8 == FIELD_LOWER)\nsrcp += VAR_4[VAR_14];",
"if (VAR_9 && VAR_10 == FIELD_LOWER)\ndstp += VAR_2[VAR_14];",
"if (VAR_11 & TINTERLACE_FLAG_VLPF || VAR_11 & TINTERLACE_FLAG_CVLPF) {",
"int x = 0;",
"if (VAR_11 & TINTERLACE_FLAG_CVLPF)\nx = 1;",
"for (VAR_17 = lines; VAR_17 > 0; VAR_17--) {",
"ptrdiff_t pref = VAR_4[VAR_14];",
"ptrdiff_t mref = -pref;",
"if (VAR_17 >= (lines - x)) mref = 0;",
"else if (VAR_17 <= (1 + x)) pref = 0;",
"VAR_0->lowpass_line(dstp, cols, srcp, mref, pref);",
"dstp += dstp_linesize;",
"srcp += srcp_linesize;",
"}",
"} else {",
"av_image_copy_plane(dstp, dstp_linesize, srcp, srcp_linesize, cols, lines);",
"}",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7,
9,
11,
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
27
],
[
29
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
43
],
[
45,
47
],
[
49,
51
],
[
59
],
[
61
],
[
63,
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
79
],
[
81
],
[
83
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
]
] |
1,582 | static double bessel(double x){
double lastv=0;
double t, v;
int i;
static const double inv[100]={
1.0/( 1* 1), 1.0/( 2* 2), 1.0/( 3* 3), 1.0/( 4* 4), 1.0/( 5* 5), 1.0/( 6* 6), 1.0/( 7* 7), 1.0/( 8* 8), 1.0/( 9* 9), 1.0/(10*10),
1.0/(11*11), 1.0/(12*12), 1.0/(13*13), 1.0/(14*14), 1.0/(15*15), 1.0/(16*16), 1.0/(17*17), 1.0/(18*18), 1.0/(19*19), 1.0/(20*20),
1.0/(21*21), 1.0/(22*22), 1.0/(23*23), 1.0/(24*24), 1.0/(25*25), 1.0/(26*26), 1.0/(27*27), 1.0/(28*28), 1.0/(29*29), 1.0/(30*30),
1.0/(31*31), 1.0/(32*32), 1.0/(33*33), 1.0/(34*34), 1.0/(35*35), 1.0/(36*36), 1.0/(37*37), 1.0/(38*38), 1.0/(39*39), 1.0/(40*40),
1.0/(41*41), 1.0/(42*42), 1.0/(43*43), 1.0/(44*44), 1.0/(45*45), 1.0/(46*46), 1.0/(47*47), 1.0/(48*48), 1.0/(49*49), 1.0/(50*50),
1.0/(51*51), 1.0/(52*52), 1.0/(53*53), 1.0/(54*54), 1.0/(55*55), 1.0/(56*56), 1.0/(57*57), 1.0/(58*58), 1.0/(59*59), 1.0/(60*60),
1.0/(61*61), 1.0/(62*62), 1.0/(63*63), 1.0/(64*64), 1.0/(65*65), 1.0/(66*66), 1.0/(67*67), 1.0/(68*68), 1.0/(69*69), 1.0/(70*70),
1.0/(71*71), 1.0/(72*72), 1.0/(73*73), 1.0/(74*74), 1.0/(75*75), 1.0/(76*76), 1.0/(77*77), 1.0/(78*78), 1.0/(79*79), 1.0/(80*80),
1.0/(81*81), 1.0/(82*82), 1.0/(83*83), 1.0/(84*84), 1.0/(85*85), 1.0/(86*86), 1.0/(87*87), 1.0/(88*88), 1.0/(89*89), 1.0/(90*90),
1.0/(91*91), 1.0/(92*92), 1.0/(93*93), 1.0/(94*94), 1.0/(95*95), 1.0/(96*96), 1.0/(97*97), 1.0/(98*98), 1.0/(99*99), 1.0/(10000)
};
x= x*x/4;
t = x;
v = 1 + x;
for(i=1; v != lastv; i+=2){
t *= x*inv[i];
v += t;
lastv=v;
t *= x*inv[i + 1];
v += t;
av_assert2(i<98);
}
return v;
}
| false | FFmpeg | a5202bc968cf3ca5b64c623b9271f76e8fa02211 | static double bessel(double x){
double lastv=0;
double t, v;
int i;
static const double inv[100]={
1.0/( 1* 1), 1.0/( 2* 2), 1.0/( 3* 3), 1.0/( 4* 4), 1.0/( 5* 5), 1.0/( 6* 6), 1.0/( 7* 7), 1.0/( 8* 8), 1.0/( 9* 9), 1.0/(10*10),
1.0/(11*11), 1.0/(12*12), 1.0/(13*13), 1.0/(14*14), 1.0/(15*15), 1.0/(16*16), 1.0/(17*17), 1.0/(18*18), 1.0/(19*19), 1.0/(20*20),
1.0/(21*21), 1.0/(22*22), 1.0/(23*23), 1.0/(24*24), 1.0/(25*25), 1.0/(26*26), 1.0/(27*27), 1.0/(28*28), 1.0/(29*29), 1.0/(30*30),
1.0/(31*31), 1.0/(32*32), 1.0/(33*33), 1.0/(34*34), 1.0/(35*35), 1.0/(36*36), 1.0/(37*37), 1.0/(38*38), 1.0/(39*39), 1.0/(40*40),
1.0/(41*41), 1.0/(42*42), 1.0/(43*43), 1.0/(44*44), 1.0/(45*45), 1.0/(46*46), 1.0/(47*47), 1.0/(48*48), 1.0/(49*49), 1.0/(50*50),
1.0/(51*51), 1.0/(52*52), 1.0/(53*53), 1.0/(54*54), 1.0/(55*55), 1.0/(56*56), 1.0/(57*57), 1.0/(58*58), 1.0/(59*59), 1.0/(60*60),
1.0/(61*61), 1.0/(62*62), 1.0/(63*63), 1.0/(64*64), 1.0/(65*65), 1.0/(66*66), 1.0/(67*67), 1.0/(68*68), 1.0/(69*69), 1.0/(70*70),
1.0/(71*71), 1.0/(72*72), 1.0/(73*73), 1.0/(74*74), 1.0/(75*75), 1.0/(76*76), 1.0/(77*77), 1.0/(78*78), 1.0/(79*79), 1.0/(80*80),
1.0/(81*81), 1.0/(82*82), 1.0/(83*83), 1.0/(84*84), 1.0/(85*85), 1.0/(86*86), 1.0/(87*87), 1.0/(88*88), 1.0/(89*89), 1.0/(90*90),
1.0/(91*91), 1.0/(92*92), 1.0/(93*93), 1.0/(94*94), 1.0/(95*95), 1.0/(96*96), 1.0/(97*97), 1.0/(98*98), 1.0/(99*99), 1.0/(10000)
};
x= x*x/4;
t = x;
v = 1 + x;
for(i=1; v != lastv; i+=2){
t *= x*inv[i];
v += t;
lastv=v;
t *= x*inv[i + 1];
v += t;
av_assert2(i<98);
}
return v;
}
| {
"code": [],
"line_no": []
} | static double FUNC_0(double VAR_0){
double VAR_1=0;
double VAR_2, VAR_3;
int VAR_4;
static const double VAR_5[100]={
1.0/( 1* 1), 1.0/( 2* 2), 1.0/( 3* 3), 1.0/( 4* 4), 1.0/( 5* 5), 1.0/( 6* 6), 1.0/( 7* 7), 1.0/( 8* 8), 1.0/( 9* 9), 1.0/(10*10),
1.0/(11*11), 1.0/(12*12), 1.0/(13*13), 1.0/(14*14), 1.0/(15*15), 1.0/(16*16), 1.0/(17*17), 1.0/(18*18), 1.0/(19*19), 1.0/(20*20),
1.0/(21*21), 1.0/(22*22), 1.0/(23*23), 1.0/(24*24), 1.0/(25*25), 1.0/(26*26), 1.0/(27*27), 1.0/(28*28), 1.0/(29*29), 1.0/(30*30),
1.0/(31*31), 1.0/(32*32), 1.0/(33*33), 1.0/(34*34), 1.0/(35*35), 1.0/(36*36), 1.0/(37*37), 1.0/(38*38), 1.0/(39*39), 1.0/(40*40),
1.0/(41*41), 1.0/(42*42), 1.0/(43*43), 1.0/(44*44), 1.0/(45*45), 1.0/(46*46), 1.0/(47*47), 1.0/(48*48), 1.0/(49*49), 1.0/(50*50),
1.0/(51*51), 1.0/(52*52), 1.0/(53*53), 1.0/(54*54), 1.0/(55*55), 1.0/(56*56), 1.0/(57*57), 1.0/(58*58), 1.0/(59*59), 1.0/(60*60),
1.0/(61*61), 1.0/(62*62), 1.0/(63*63), 1.0/(64*64), 1.0/(65*65), 1.0/(66*66), 1.0/(67*67), 1.0/(68*68), 1.0/(69*69), 1.0/(70*70),
1.0/(71*71), 1.0/(72*72), 1.0/(73*73), 1.0/(74*74), 1.0/(75*75), 1.0/(76*76), 1.0/(77*77), 1.0/(78*78), 1.0/(79*79), 1.0/(80*80),
1.0/(81*81), 1.0/(82*82), 1.0/(83*83), 1.0/(84*84), 1.0/(85*85), 1.0/(86*86), 1.0/(87*87), 1.0/(88*88), 1.0/(89*89), 1.0/(90*90),
1.0/(91*91), 1.0/(92*92), 1.0/(93*93), 1.0/(94*94), 1.0/(95*95), 1.0/(96*96), 1.0/(97*97), 1.0/(98*98), 1.0/(99*99), 1.0/(10000)
};
VAR_0= VAR_0*VAR_0/4;
VAR_2 = VAR_0;
VAR_3 = 1 + VAR_0;
for(VAR_4=1; VAR_3 != VAR_1; VAR_4+=2){
VAR_2 *= VAR_0*VAR_5[VAR_4];
VAR_3 += VAR_2;
VAR_1=VAR_3;
VAR_2 *= VAR_0*VAR_5[VAR_4 + 1];
VAR_3 += VAR_2;
av_assert2(VAR_4<98);
}
return VAR_3;
}
| [
"static double FUNC_0(double VAR_0){",
"double VAR_1=0;",
"double VAR_2, VAR_3;",
"int VAR_4;",
"static const double VAR_5[100]={",
"1.0/( 1* 1), 1.0/( 2* 2), 1.0/( 3* 3), 1.0/( 4* 4), 1.0/( 5* 5), 1.0/( 6* 6), 1.0/( 7* 7), 1.0/( 8* 8), 1.0/( 9* 9), 1.0/(10*10),\n1.0/(11*11), 1.0/(12*12), 1.0/(13*13), 1.0/(14*14), 1.0/(15*15), 1.0/(16*16), 1.0/(17*17), 1.0/(18*18), 1.0/(19*19), 1.0/(20*20),\n1.0/(21*21), 1.0/(22*22), 1.0/(23*23), 1.0/(24*24), 1.0/(25*25), 1.0/(26*26), 1.0/(27*27), 1.0/(28*28), 1.0/(29*29), 1.0/(30*30),\n1.0/(31*31), 1.0/(32*32), 1.0/(33*33), 1.0/(34*34), 1.0/(35*35), 1.0/(36*36), 1.0/(37*37), 1.0/(38*38), 1.0/(39*39), 1.0/(40*40),\n1.0/(41*41), 1.0/(42*42), 1.0/(43*43), 1.0/(44*44), 1.0/(45*45), 1.0/(46*46), 1.0/(47*47), 1.0/(48*48), 1.0/(49*49), 1.0/(50*50),\n1.0/(51*51), 1.0/(52*52), 1.0/(53*53), 1.0/(54*54), 1.0/(55*55), 1.0/(56*56), 1.0/(57*57), 1.0/(58*58), 1.0/(59*59), 1.0/(60*60),\n1.0/(61*61), 1.0/(62*62), 1.0/(63*63), 1.0/(64*64), 1.0/(65*65), 1.0/(66*66), 1.0/(67*67), 1.0/(68*68), 1.0/(69*69), 1.0/(70*70),\n1.0/(71*71), 1.0/(72*72), 1.0/(73*73), 1.0/(74*74), 1.0/(75*75), 1.0/(76*76), 1.0/(77*77), 1.0/(78*78), 1.0/(79*79), 1.0/(80*80),\n1.0/(81*81), 1.0/(82*82), 1.0/(83*83), 1.0/(84*84), 1.0/(85*85), 1.0/(86*86), 1.0/(87*87), 1.0/(88*88), 1.0/(89*89), 1.0/(90*90),\n1.0/(91*91), 1.0/(92*92), 1.0/(93*93), 1.0/(94*94), 1.0/(95*95), 1.0/(96*96), 1.0/(97*97), 1.0/(98*98), 1.0/(99*99), 1.0/(10000)\n};",
"VAR_0= VAR_0*VAR_0/4;",
"VAR_2 = VAR_0;",
"VAR_3 = 1 + VAR_0;",
"for(VAR_4=1; VAR_3 != VAR_1; VAR_4+=2){",
"VAR_2 *= VAR_0*VAR_5[VAR_4];",
"VAR_3 += VAR_2;",
"VAR_1=VAR_3;",
"VAR_2 *= VAR_0*VAR_5[VAR_4 + 1];",
"VAR_3 += VAR_2;",
"av_assert2(VAR_4<98);",
"}",
"return VAR_3;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1
],
[
3
],
[
5
],
[
7
],
[
9
],
[
11,
13,
15,
17,
19,
21,
23,
25,
27,
29,
31
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
]
] |
1,583 | static int check_jni_invocation(void *log_ctx)
{
int ret = AVERROR_EXTERNAL;
void *handle = NULL;
void **jni_invocation = NULL;
handle = dlopen(NULL, RTLD_LOCAL);
if (!handle) {
goto done;
}
jni_invocation = (void **)dlsym(handle, "_ZN13JniInvocation15jni_invocation_E");
if (!jni_invocation) {
av_log(log_ctx, AV_LOG_ERROR, "Could not find JniInvocation::jni_invocation_ symbol\n");
goto done;
}
ret = !(jni_invocation != NULL && *jni_invocation != NULL);
done:
if (handle) {
dlclose(handle);
}
return ret;
}
| false | FFmpeg | 33d69a90085d30af8a292d9364b835a26565d6b9 | static int check_jni_invocation(void *log_ctx)
{
int ret = AVERROR_EXTERNAL;
void *handle = NULL;
void **jni_invocation = NULL;
handle = dlopen(NULL, RTLD_LOCAL);
if (!handle) {
goto done;
}
jni_invocation = (void **)dlsym(handle, "_ZN13JniInvocation15jni_invocation_E");
if (!jni_invocation) {
av_log(log_ctx, AV_LOG_ERROR, "Could not find JniInvocation::jni_invocation_ symbol\n");
goto done;
}
ret = !(jni_invocation != NULL && *jni_invocation != NULL);
done:
if (handle) {
dlclose(handle);
}
return ret;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(void *VAR_0)
{
int VAR_1 = AVERROR_EXTERNAL;
void *VAR_2 = NULL;
void **VAR_3 = NULL;
VAR_2 = dlopen(NULL, RTLD_LOCAL);
if (!VAR_2) {
goto done;
}
VAR_3 = (void **)dlsym(VAR_2, "_ZN13JniInvocation15jni_invocation_E");
if (!VAR_3) {
av_log(VAR_0, AV_LOG_ERROR, "Could not find JniInvocation::jni_invocation_ symbol\n");
goto done;
}
VAR_1 = !(VAR_3 != NULL && *VAR_3 != NULL);
done:
if (VAR_2) {
dlclose(VAR_2);
}
return VAR_1;
}
| [
"static int FUNC_0(void *VAR_0)\n{",
"int VAR_1 = AVERROR_EXTERNAL;",
"void *VAR_2 = NULL;",
"void **VAR_3 = NULL;",
"VAR_2 = dlopen(NULL, RTLD_LOCAL);",
"if (!VAR_2) {",
"goto done;",
"}",
"VAR_3 = (void **)dlsym(VAR_2, \"_ZN13JniInvocation15jni_invocation_E\");",
"if (!VAR_3) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Could not find JniInvocation::jni_invocation_ symbol\\n\");",
"goto done;",
"}",
"VAR_1 = !(VAR_3 != NULL && *VAR_3 != NULL);",
"done:\nif (VAR_2) {",
"dlclose(VAR_2);",
"}",
"return VAR_1;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15
],
[
17
],
[
19
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
39,
41
],
[
43
],
[
45
],
[
49
],
[
51
]
] |
1,584 | static int gif_image_write_header(uint8_t **bytestream,
int width, int height, int loop_count,
uint32_t *palette)
{
int i;
unsigned int v;
bytestream_put_buffer(bytestream, "GIF", 3);
bytestream_put_buffer(bytestream, "89a", 3);
bytestream_put_le16(bytestream, width);
bytestream_put_le16(bytestream, height);
bytestream_put_byte(bytestream, 0xf7); /* flags: global clut, 256 entries */
bytestream_put_byte(bytestream, 0x1f); /* background color index */
bytestream_put_byte(bytestream, 0); /* aspect ratio */
/* the global palette */
if (!palette) {
bytestream_put_buffer(bytestream, (const unsigned char *)gif_clut, 216*3);
for(i=0;i<((256-216)*3);i++)
bytestream_put_byte(bytestream, 0);
} else {
for(i=0;i<256;i++) {
v = palette[i];
bytestream_put_be24(bytestream, v);
}
}
/* update: this is the 'NETSCAPE EXTENSION' that allows for looped animated gif
see http://members.aol.com/royalef/gifabout.htm#net-extension
byte 1 : 33 (hex 0x21) GIF Extension code
byte 2 : 255 (hex 0xFF) Application Extension Label
byte 3 : 11 (hex (0x0B) Length of Application Block
(eleven bytes of data to follow)
bytes 4 to 11 : "NETSCAPE"
bytes 12 to 14 : "2.0"
byte 15 : 3 (hex 0x03) Length of Data Sub-Block
(three bytes of data to follow)
byte 16 : 1 (hex 0x01)
bytes 17 to 18 : 0 to 65535, an unsigned integer in
lo-hi byte format. This indicate the
number of iterations the loop should
be executed.
bytes 19 : 0 (hex 0x00) a Data Sub-block Terminator
*/
/* application extension header */
#ifdef GIF_ADD_APP_HEADER
if (loop_count >= 0 && loop_count <= 65535) {
bytestream_put_byte(bytestream, 0x21);
bytestream_put_byte(bytestream, 0xff);
bytestream_put_byte(bytestream, 0x0b);
bytestream_put_buffer(bytestream, "NETSCAPE2.0", 11); // bytes 4 to 14
bytestream_put_byte(bytestream, 0x03); // byte 15
bytestream_put_byte(bytestream, 0x01); // byte 16
bytestream_put_le16(bytestream, (uint16_t)loop_count);
bytestream_put_byte(bytestream, 0x00); // byte 19
}
#endif
return 0;
}
| false | FFmpeg | c33030bd7b81f7ef7d7ff9da9bfa1a3b4bfbafa1 | static int gif_image_write_header(uint8_t **bytestream,
int width, int height, int loop_count,
uint32_t *palette)
{
int i;
unsigned int v;
bytestream_put_buffer(bytestream, "GIF", 3);
bytestream_put_buffer(bytestream, "89a", 3);
bytestream_put_le16(bytestream, width);
bytestream_put_le16(bytestream, height);
bytestream_put_byte(bytestream, 0xf7);
bytestream_put_byte(bytestream, 0x1f);
bytestream_put_byte(bytestream, 0);
if (!palette) {
bytestream_put_buffer(bytestream, (const unsigned char *)gif_clut, 216*3);
for(i=0;i<((256-216)*3);i++)
bytestream_put_byte(bytestream, 0);
} else {
for(i=0;i<256;i++) {
v = palette[i];
bytestream_put_be24(bytestream, v);
}
}
#ifdef GIF_ADD_APP_HEADER
if (loop_count >= 0 && loop_count <= 65535) {
bytestream_put_byte(bytestream, 0x21);
bytestream_put_byte(bytestream, 0xff);
bytestream_put_byte(bytestream, 0x0b);
bytestream_put_buffer(bytestream, "NETSCAPE2.0", 11);
bytestream_put_byte(bytestream, 0x03);
bytestream_put_byte(bytestream, 0x01);
bytestream_put_le16(bytestream, (uint16_t)loop_count);
bytestream_put_byte(bytestream, 0x00);
}
#endif
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(uint8_t **VAR_0,
int VAR_1, int VAR_2, int VAR_3,
uint32_t *VAR_4)
{
int VAR_5;
unsigned int VAR_6;
bytestream_put_buffer(VAR_0, "GIF", 3);
bytestream_put_buffer(VAR_0, "89a", 3);
bytestream_put_le16(VAR_0, VAR_1);
bytestream_put_le16(VAR_0, VAR_2);
bytestream_put_byte(VAR_0, 0xf7);
bytestream_put_byte(VAR_0, 0x1f);
bytestream_put_byte(VAR_0, 0);
if (!VAR_4) {
bytestream_put_buffer(VAR_0, (const unsigned char *)gif_clut, 216*3);
for(VAR_5=0;VAR_5<((256-216)*3);VAR_5++)
bytestream_put_byte(VAR_0, 0);
} else {
for(VAR_5=0;VAR_5<256;VAR_5++) {
VAR_6 = VAR_4[VAR_5];
bytestream_put_be24(VAR_0, VAR_6);
}
}
#ifdef GIF_ADD_APP_HEADER
if (VAR_3 >= 0 && VAR_3 <= 65535) {
bytestream_put_byte(VAR_0, 0x21);
bytestream_put_byte(VAR_0, 0xff);
bytestream_put_byte(VAR_0, 0x0b);
bytestream_put_buffer(VAR_0, "NETSCAPE2.0", 11);
bytestream_put_byte(VAR_0, 0x03);
bytestream_put_byte(VAR_0, 0x01);
bytestream_put_le16(VAR_0, (uint16_t)VAR_3);
bytestream_put_byte(VAR_0, 0x00);
}
#endif
return 0;
}
| [
"static int FUNC_0(uint8_t **VAR_0,\nint VAR_1, int VAR_2, int VAR_3,\nuint32_t *VAR_4)\n{",
"int VAR_5;",
"unsigned int VAR_6;",
"bytestream_put_buffer(VAR_0, \"GIF\", 3);",
"bytestream_put_buffer(VAR_0, \"89a\", 3);",
"bytestream_put_le16(VAR_0, VAR_1);",
"bytestream_put_le16(VAR_0, VAR_2);",
"bytestream_put_byte(VAR_0, 0xf7);",
"bytestream_put_byte(VAR_0, 0x1f);",
"bytestream_put_byte(VAR_0, 0);",
"if (!VAR_4) {",
"bytestream_put_buffer(VAR_0, (const unsigned char *)gif_clut, 216*3);",
"for(VAR_5=0;VAR_5<((256-216)*3);VAR_5++)",
"bytestream_put_byte(VAR_0, 0);",
"} else {",
"for(VAR_5=0;VAR_5<256;VAR_5++) {",
"VAR_6 = VAR_4[VAR_5];",
"bytestream_put_be24(VAR_0, VAR_6);",
"}",
"}",
"#ifdef GIF_ADD_APP_HEADER\nif (VAR_3 >= 0 && VAR_3 <= 65535) {",
"bytestream_put_byte(VAR_0, 0x21);",
"bytestream_put_byte(VAR_0, 0xff);",
"bytestream_put_byte(VAR_0, 0x0b);",
"bytestream_put_buffer(VAR_0, \"NETSCAPE2.0\", 11);",
"bytestream_put_byte(VAR_0, 0x03);",
"bytestream_put_byte(VAR_0, 0x01);",
"bytestream_put_le16(VAR_0, (uint16_t)VAR_3);",
"bytestream_put_byte(VAR_0, 0x00);",
"}",
"#endif\nreturn 0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
15
],
[
17
],
[
19
],
[
21
],
[
25
],
[
27
],
[
29
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
45
],
[
47
],
[
49
],
[
51
],
[
53
],
[
97,
99
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
117
],
[
119,
121
],
[
123
]
] |
1,585 | static int decode_p_mbs(VC9Context *v)
{
int x, y, current_mb = 0, i; /* MB/Block Position info */
int skip_mb_bit = 0, cbpcy; /* MB/B skip */
int hybrid_pred, ac_pred; /* Prediction types */
int mb_has_coeffs = 1 /* last_flag */, mb_is_intra;
int dmv_x, dmv_y; /* Differential MV components */
int mv_mode_bit = 0; /* mv_mode_bit: 1MV=0, 4MV=0 */
int mqdiff, mquant; /* MB quantization */
int tt_block; /* MB Transform type */
static const int size_table[6] = { 0, 2, 3, 4, 5, 8 },
offset_table[6] = { 0, 1, 3, 7, 15, 31 };
int k_x, k_y; /* Long MV fixed bitlength */
int hpel_flag, intra_flag; /* Some MB properties */
int index, index1; /* LUT indices */
int val, sign;
/* Select ttmb table depending on pq */
if (v->pq < 5) v->ttmb_vlc = &vc9_ttmb_vlc[0];
else if (v->pq < 13) v->ttmb_vlc = &vc9_ttmb_vlc[1];
else v->ttmb_vlc = &vc9_ttmb_vlc[2];
/* Select proper long MV range */
switch (v->mvrange)
{
case 1: k_x = 10; k_y = 9; break;
case 2: k_x = 12; k_y = 10; break;
case 3: k_x = 13; k_y = 11; break;
default: /*case 0 too */ k_x = 9; k_y = 8; break;
}
hpel_flag = v->mv_mode & 1; //MV_PMODE is HPEL
k_x -= hpel_flag;
k_y -= hpel_flag;
for (y=0; y<v->height_mb; y++)
{
for (x=0; x<v->width_mb; x++)
{
if (v->mv_type_mb_plane[current_mb])
mv_mode_bit = get_bits(&v->gb, 1);
if (0) //skipmb is rawmode
skip_mb_bit = get_bits(&v->gb, 1);
if (!mv_mode_bit) /* 1MV mode */
{
if (!v->skip_mb_plane[current_mb])
{
GET_MVDATA();
/* hybrid mv pred, 8.3.5.3.4 */
if (v->mv_mode == MV_PMODE_1MV ||
v->mv_mode == MV_PMODE_MIXED_MV)
hybrid_pred = get_bits(&v->gb, 1);
if (mb_is_intra && !mb_has_coeffs)
{
GET_MQUANT();
ac_pred = get_bits(&v->gb, 1);
}
else if (mb_has_coeffs)
{
if (mb_is_intra) ac_pred = get_bits(&v->gb, 1);
cbpcy = get_vlc2(&v->gb, v->cbpcy_vlc->table,
VC9_CBPCY_P_VLC_BITS, 2);
GET_MQUANT();
}
if (!v->ttmbf)
v->ttfrm = get_vlc2(&v->gb, v->ttmb_vlc->table,
VC9_TTMB_VLC_BITS, 2);
//Decode blocks from that mb wrt cbpcy
}
else //Skipped
{
/* hybrid mv pred, 8.3.5.3.4 */
if (v->mv_mode == MV_PMODE_1MV ||
v->mv_mode == MV_PMODE_MIXED_MV)
hybrid_pred = get_bits(&v->gb, 1);
}
} //1MV mode
else //4MV mode
{
if (!v->skip_mb_plane[current_mb] /* unskipped MB */)
{
cbpcy = get_vlc2(&v->gb, v->cbpcy_vlc->table,
VC9_CBPCY_P_VLC_BITS, 2);
for (i=0; i<4; i++) //For all 4 Y blocks
{
if (cbpcy & (1<<6) /* cbpcy set for this block */)
{
GET_MVDATA();
}
if (v->mv_mode == MV_PMODE_MIXED_MV /* Hybrid pred */)
hybrid_pred = get_bits(&v->gb, 1);
GET_MQUANT();
if (mb_is_intra /* One of the 4 blocks is intra */ &&
index /* non-zero pred for that block */)
ac_pred = get_bits(&v->gb, 1);
if (!v->ttmbf)
tt_block = get_vlc2(&v->gb, v->ttmb_vlc->table,
VC9_TTMB_VLC_BITS, 2);
/* TODO: Process blocks wrt cbpcy */
/* Prepare cbpcy for next block */
cbpcy <<= 1;
}
}
else //Skipped MB
{
for (i=0; i<4; i++) //All 4 Y blocks
{
if (v->mv_mode == MV_PMODE_MIXED_MV /* Hybrid pred */)
hybrid_pred = get_bits(&v->gb, 1);
/* FIXME: do something */
}
}
}
}
current_mb++;
}
return 0;
}
| false | FFmpeg | e5540b3fd30367ce3cc33b2f34a04b660dbc4b38 | static int decode_p_mbs(VC9Context *v)
{
int x, y, current_mb = 0, i;
int skip_mb_bit = 0, cbpcy;
int hybrid_pred, ac_pred;
int mb_has_coeffs = 1 , mb_is_intra;
int dmv_x, dmv_y;
int mv_mode_bit = 0;
int mqdiff, mquant;
int tt_block;
static const int size_table[6] = { 0, 2, 3, 4, 5, 8 },
offset_table[6] = { 0, 1, 3, 7, 15, 31 };
int k_x, k_y;
int hpel_flag, intra_flag;
int index, index1;
int val, sign;
if (v->pq < 5) v->ttmb_vlc = &vc9_ttmb_vlc[0];
else if (v->pq < 13) v->ttmb_vlc = &vc9_ttmb_vlc[1];
else v->ttmb_vlc = &vc9_ttmb_vlc[2];
switch (v->mvrange)
{
case 1: k_x = 10; k_y = 9; break;
case 2: k_x = 12; k_y = 10; break;
case 3: k_x = 13; k_y = 11; break;
default: k_x = 9; k_y = 8; break;
}
hpel_flag = v->mv_mode & 1;
k_x -= hpel_flag;
k_y -= hpel_flag;
for (y=0; y<v->height_mb; y++)
{
for (x=0; x<v->width_mb; x++)
{
if (v->mv_type_mb_plane[current_mb])
mv_mode_bit = get_bits(&v->gb, 1);
if (0)
skip_mb_bit = get_bits(&v->gb, 1);
if (!mv_mode_bit)
{
if (!v->skip_mb_plane[current_mb])
{
GET_MVDATA();
if (v->mv_mode == MV_PMODE_1MV ||
v->mv_mode == MV_PMODE_MIXED_MV)
hybrid_pred = get_bits(&v->gb, 1);
if (mb_is_intra && !mb_has_coeffs)
{
GET_MQUANT();
ac_pred = get_bits(&v->gb, 1);
}
else if (mb_has_coeffs)
{
if (mb_is_intra) ac_pred = get_bits(&v->gb, 1);
cbpcy = get_vlc2(&v->gb, v->cbpcy_vlc->table,
VC9_CBPCY_P_VLC_BITS, 2);
GET_MQUANT();
}
if (!v->ttmbf)
v->ttfrm = get_vlc2(&v->gb, v->ttmb_vlc->table,
VC9_TTMB_VLC_BITS, 2);
}
else
{
if (v->mv_mode == MV_PMODE_1MV ||
v->mv_mode == MV_PMODE_MIXED_MV)
hybrid_pred = get_bits(&v->gb, 1);
}
}
else
{
if (!v->skip_mb_plane[current_mb] )
{
cbpcy = get_vlc2(&v->gb, v->cbpcy_vlc->table,
VC9_CBPCY_P_VLC_BITS, 2);
for (i=0; i<4; i++)
{
if (cbpcy & (1<<6) )
{
GET_MVDATA();
}
if (v->mv_mode == MV_PMODE_MIXED_MV )
hybrid_pred = get_bits(&v->gb, 1);
GET_MQUANT();
if (mb_is_intra &&
index )
ac_pred = get_bits(&v->gb, 1);
if (!v->ttmbf)
tt_block = get_vlc2(&v->gb, v->ttmb_vlc->table,
VC9_TTMB_VLC_BITS, 2);
cbpcy <<= 1;
}
}
else MB
{
for (i=0; i<4; i++)
{
if (v->mv_mode == MV_PMODE_MIXED_MV )
hybrid_pred = get_bits(&v->gb, 1);
}
}
}
}
current_mb++;
}
return 0;
}
| {
"code": [],
"line_no": []
} | static int FUNC_0(VC9Context *VAR_0)
{
int VAR_1, VAR_2, VAR_3 = 0, VAR_4;
int VAR_5 = 0, VAR_6;
int VAR_7, VAR_8;
int VAR_9 = 1 , VAR_10;
int VAR_11, VAR_12;
int VAR_13 = 0;
int VAR_14, VAR_15;
int VAR_16;
static const int VAR_17[6] = { 0, 2, 3, 4, 5, 8 },
VAR_18[6] = { 0, 1, 3, 7, 15, 31 };
int VAR_19, VAR_20;
int VAR_21, VAR_22;
int VAR_23, VAR_24;
int VAR_25, VAR_26;
if (VAR_0->pq < 5) VAR_0->ttmb_vlc = &vc9_ttmb_vlc[0];
else if (VAR_0->pq < 13) VAR_0->ttmb_vlc = &vc9_ttmb_vlc[1];
else VAR_0->ttmb_vlc = &vc9_ttmb_vlc[2];
switch (VAR_0->mvrange)
{
case 1: VAR_19 = 10; VAR_20 = 9; break;
case 2: VAR_19 = 12; VAR_20 = 10; break;
case 3: VAR_19 = 13; VAR_20 = 11; break;
default: VAR_19 = 9; VAR_20 = 8; break;
}
VAR_21 = VAR_0->mv_mode & 1;
VAR_19 -= VAR_21;
VAR_20 -= VAR_21;
for (VAR_2=0; VAR_2<VAR_0->height_mb; VAR_2++)
{
for (VAR_1=0; VAR_1<VAR_0->width_mb; VAR_1++)
{
if (VAR_0->mv_type_mb_plane[VAR_3])
VAR_13 = get_bits(&VAR_0->gb, 1);
if (0)
VAR_5 = get_bits(&VAR_0->gb, 1);
if (!VAR_13)
{
if (!VAR_0->skip_mb_plane[VAR_3])
{
GET_MVDATA();
if (VAR_0->mv_mode == MV_PMODE_1MV ||
VAR_0->mv_mode == MV_PMODE_MIXED_MV)
VAR_7 = get_bits(&VAR_0->gb, 1);
if (VAR_10 && !VAR_9)
{
GET_MQUANT();
VAR_8 = get_bits(&VAR_0->gb, 1);
}
else if (VAR_9)
{
if (VAR_10) VAR_8 = get_bits(&VAR_0->gb, 1);
VAR_6 = get_vlc2(&VAR_0->gb, VAR_0->cbpcy_vlc->table,
VC9_CBPCY_P_VLC_BITS, 2);
GET_MQUANT();
}
if (!VAR_0->ttmbf)
VAR_0->ttfrm = get_vlc2(&VAR_0->gb, VAR_0->ttmb_vlc->table,
VC9_TTMB_VLC_BITS, 2);
}
else
{
if (VAR_0->mv_mode == MV_PMODE_1MV ||
VAR_0->mv_mode == MV_PMODE_MIXED_MV)
VAR_7 = get_bits(&VAR_0->gb, 1);
}
}
else
{
if (!VAR_0->skip_mb_plane[VAR_3] )
{
VAR_6 = get_vlc2(&VAR_0->gb, VAR_0->cbpcy_vlc->table,
VC9_CBPCY_P_VLC_BITS, 2);
for (VAR_4=0; VAR_4<4; VAR_4++)
{
if (VAR_6 & (1<<6) )
{
GET_MVDATA();
}
if (VAR_0->mv_mode == MV_PMODE_MIXED_MV )
VAR_7 = get_bits(&VAR_0->gb, 1);
GET_MQUANT();
if (VAR_10 &&
VAR_23 )
VAR_8 = get_bits(&VAR_0->gb, 1);
if (!VAR_0->ttmbf)
VAR_16 = get_vlc2(&VAR_0->gb, VAR_0->ttmb_vlc->table,
VC9_TTMB_VLC_BITS, 2);
VAR_6 <<= 1;
}
}
else MB
{
for (VAR_4=0; VAR_4<4; VAR_4++)
{
if (VAR_0->mv_mode == MV_PMODE_MIXED_MV )
VAR_7 = get_bits(&VAR_0->gb, 1);
}
}
}
}
VAR_3++;
}
return 0;
}
| [
"static int FUNC_0(VC9Context *VAR_0)\n{",
"int VAR_1, VAR_2, VAR_3 = 0, VAR_4;",
"int VAR_5 = 0, VAR_6;",
"int VAR_7, VAR_8;",
"int VAR_9 = 1 , VAR_10;",
"int VAR_11, VAR_12;",
"int VAR_13 = 0;",
"int VAR_14, VAR_15;",
"int VAR_16;",
"static const int VAR_17[6] = { 0, 2, 3, 4, 5, 8 },",
"VAR_18[6] = { 0, 1, 3, 7, 15, 31 };",
"int VAR_19, VAR_20;",
"int VAR_21, VAR_22;",
"int VAR_23, VAR_24;",
"int VAR_25, VAR_26;",
"if (VAR_0->pq < 5) VAR_0->ttmb_vlc = &vc9_ttmb_vlc[0];",
"else if (VAR_0->pq < 13) VAR_0->ttmb_vlc = &vc9_ttmb_vlc[1];",
"else VAR_0->ttmb_vlc = &vc9_ttmb_vlc[2];",
"switch (VAR_0->mvrange)\n{",
"case 1: VAR_19 = 10; VAR_20 = 9; break;",
"case 2: VAR_19 = 12; VAR_20 = 10; break;",
"case 3: VAR_19 = 13; VAR_20 = 11; break;",
"default: VAR_19 = 9; VAR_20 = 8; break;",
"}",
"VAR_21 = VAR_0->mv_mode & 1;",
"VAR_19 -= VAR_21;",
"VAR_20 -= VAR_21;",
"for (VAR_2=0; VAR_2<VAR_0->height_mb; VAR_2++)",
"{",
"for (VAR_1=0; VAR_1<VAR_0->width_mb; VAR_1++)",
"{",
"if (VAR_0->mv_type_mb_plane[VAR_3])\nVAR_13 = get_bits(&VAR_0->gb, 1);",
"if (0)\nVAR_5 = get_bits(&VAR_0->gb, 1);",
"if (!VAR_13)\n{",
"if (!VAR_0->skip_mb_plane[VAR_3])\n{",
"GET_MVDATA();",
"if (VAR_0->mv_mode == MV_PMODE_1MV ||\nVAR_0->mv_mode == MV_PMODE_MIXED_MV)\nVAR_7 = get_bits(&VAR_0->gb, 1);",
"if (VAR_10 && !VAR_9)\n{",
"GET_MQUANT();",
"VAR_8 = get_bits(&VAR_0->gb, 1);",
"}",
"else if (VAR_9)\n{",
"if (VAR_10) VAR_8 = get_bits(&VAR_0->gb, 1);",
"VAR_6 = get_vlc2(&VAR_0->gb, VAR_0->cbpcy_vlc->table,\nVC9_CBPCY_P_VLC_BITS, 2);",
"GET_MQUANT();",
"}",
"if (!VAR_0->ttmbf)\nVAR_0->ttfrm = get_vlc2(&VAR_0->gb, VAR_0->ttmb_vlc->table,\nVC9_TTMB_VLC_BITS, 2);",
"}",
"else\n{",
"if (VAR_0->mv_mode == MV_PMODE_1MV ||\nVAR_0->mv_mode == MV_PMODE_MIXED_MV)\nVAR_7 = get_bits(&VAR_0->gb, 1);",
"}",
"}",
"else\n{",
"if (!VAR_0->skip_mb_plane[VAR_3] )\n{",
"VAR_6 = get_vlc2(&VAR_0->gb, VAR_0->cbpcy_vlc->table,\nVC9_CBPCY_P_VLC_BITS, 2);",
"for (VAR_4=0; VAR_4<4; VAR_4++)",
"{",
"if (VAR_6 & (1<<6) )\n{",
"GET_MVDATA();",
"}",
"if (VAR_0->mv_mode == MV_PMODE_MIXED_MV )\nVAR_7 = get_bits(&VAR_0->gb, 1);",
"GET_MQUANT();",
"if (VAR_10 &&\nVAR_23 )\nVAR_8 = get_bits(&VAR_0->gb, 1);",
"if (!VAR_0->ttmbf)\nVAR_16 = get_vlc2(&VAR_0->gb, VAR_0->ttmb_vlc->table,\nVC9_TTMB_VLC_BITS, 2);",
"VAR_6 <<= 1;",
"}",
"}",
"else MB\n{",
"for (VAR_4=0; VAR_4<4; VAR_4++)",
"{",
"if (VAR_0->mv_mode == MV_PMODE_MIXED_MV )\nVAR_7 = get_bits(&VAR_0->gb, 1);",
"}",
"}",
"}",
"}",
"VAR_3++;",
"}",
"return 0;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
37
],
[
39
],
[
41
],
[
47,
49
],
[
51
],
[
53
],
[
55
],
[
57
],
[
59
],
[
63
],
[
65
],
[
67
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79,
81
],
[
83,
85
],
[
87,
89
],
[
91,
93
],
[
95
],
[
101,
103,
105
],
[
107,
109
],
[
111
],
[
113
],
[
115
],
[
117,
119
],
[
121
],
[
123,
125
],
[
127
],
[
129
],
[
131,
133,
135
],
[
139
],
[
141,
143
],
[
147,
149,
151
],
[
153
],
[
155
],
[
157,
159
],
[
161,
163
],
[
165,
167
],
[
169
],
[
171
],
[
173,
175
],
[
177
],
[
179
],
[
181,
183
],
[
185
],
[
187,
189,
191
],
[
193,
195,
197
],
[
207
],
[
209
],
[
211
],
[
213,
215
],
[
217
],
[
219
],
[
221,
223
],
[
229
],
[
231
],
[
233
],
[
235
],
[
237
],
[
239
],
[
241
],
[
243
]
] |
1,586 | matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size,
int64_t pos, uint64_t cluster_time, uint64_t duration,
int is_keyframe, int is_bframe)
{
int res = 0;
int track;
AVStream *st;
AVPacket *pkt;
uint8_t *origdata = data;
int16_t block_time;
uint32_t *lace_size = NULL;
int n, flags, laces = 0;
uint64_t num;
/* first byte(s): tracknum */
if ((n = matroska_ebmlnum_uint(data, size, &num)) < 0) {
av_log(matroska->ctx, AV_LOG_ERROR, "EBML block data error\n");
av_free(origdata);
return res;
}
data += n;
size -= n;
/* fetch track from num */
track = matroska_find_track_by_num(matroska, num);
if (size <= 3 || track < 0 || track >= matroska->num_tracks) {
av_log(matroska->ctx, AV_LOG_INFO,
"Invalid stream %d or size %u\n", track, size);
av_free(origdata);
return res;
}
if (matroska->tracks[track]->stream_index < 0)
return res;
st = matroska->ctx->streams[matroska->tracks[track]->stream_index];
if (st->discard >= AVDISCARD_ALL) {
av_free(origdata);
return res;
}
if (duration == AV_NOPTS_VALUE)
duration = matroska->tracks[track]->default_duration;
/* block_time (relative to cluster time) */
block_time = AV_RB16(data);
data += 2;
flags = *data++;
size -= 3;
if (is_keyframe == -1)
is_keyframe = flags & 1 ? PKT_FLAG_KEY : 0;
if (matroska->skip_to_keyframe) {
if (!is_keyframe || st != matroska->skip_to_stream)
return res;
matroska->skip_to_keyframe = 0;
}
switch ((flags & 0x06) >> 1) {
case 0x0: /* no lacing */
laces = 1;
lace_size = av_mallocz(sizeof(int));
lace_size[0] = size;
break;
case 0x1: /* xiph lacing */
case 0x2: /* fixed-size lacing */
case 0x3: /* EBML lacing */
if (size == 0) {
res = -1;
break;
}
laces = (*data) + 1;
data += 1;
size -= 1;
lace_size = av_mallocz(laces * sizeof(int));
switch ((flags & 0x06) >> 1) {
case 0x1: /* xiph lacing */ {
uint8_t temp;
uint32_t total = 0;
for (n = 0; res == 0 && n < laces - 1; n++) {
while (1) {
if (size == 0) {
res = -1;
break;
}
temp = *data;
lace_size[n] += temp;
data += 1;
size -= 1;
if (temp != 0xff)
break;
}
total += lace_size[n];
}
lace_size[n] = size - total;
break;
}
case 0x2: /* fixed-size lacing */
for (n = 0; n < laces; n++)
lace_size[n] = size / laces;
break;
case 0x3: /* EBML lacing */ {
uint32_t total;
n = matroska_ebmlnum_uint(data, size, &num);
if (n < 0) {
av_log(matroska->ctx, AV_LOG_INFO,
"EBML block data error\n");
break;
}
data += n;
size -= n;
total = lace_size[0] = num;
for (n = 1; res == 0 && n < laces - 1; n++) {
int64_t snum;
int r;
r = matroska_ebmlnum_sint (data, size, &snum);
if (r < 0) {
av_log(matroska->ctx, AV_LOG_INFO,
"EBML block data error\n");
break;
}
data += r;
size -= r;
lace_size[n] = lace_size[n - 1] + snum;
total += lace_size[n];
}
lace_size[n] = size - total;
break;
}
}
break;
}
if (res == 0) {
int real_v = matroska->tracks[track]->flags & MATROSKA_TRACK_REAL_V;
uint64_t timecode = AV_NOPTS_VALUE;
if (cluster_time != (uint64_t)-1 && cluster_time + block_time >= 0)
timecode = cluster_time + block_time;
for (n = 0; n < laces; n++) {
int slice, slices = 1;
if (real_v) {
slices = *data++ + 1;
lace_size[n]--;
}
for (slice=0; slice<slices; slice++) {
int slice_size, slice_offset = 0;
if (real_v)
slice_offset = rv_offset(data, slice, slices);
if (slice+1 == slices)
slice_size = lace_size[n] - slice_offset;
else
slice_size = rv_offset(data, slice+1, slices) - slice_offset;
if (st->codec->codec_id == CODEC_ID_RA_288 ||
st->codec->codec_id == CODEC_ID_COOK ||
st->codec->codec_id == CODEC_ID_ATRAC3) {
MatroskaAudioTrack *audiotrack = (MatroskaAudioTrack *)matroska->tracks[track];
int a = st->codec->block_align;
int sps = audiotrack->sub_packet_size;
int cfs = audiotrack->coded_framesize;
int h = audiotrack->sub_packet_h;
int y = audiotrack->sub_packet_cnt;
int w = audiotrack->frame_size;
int x;
if (!audiotrack->pkt_cnt) {
if (st->codec->codec_id == CODEC_ID_RA_288)
for (x=0; x<h/2; x++)
memcpy(audiotrack->buf+x*2*w+y*cfs,
data+x*cfs, cfs);
else
for (x=0; x<w/sps; x++)
memcpy(audiotrack->buf+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), data+x*sps, sps);
if (++audiotrack->sub_packet_cnt >= h) {
audiotrack->sub_packet_cnt = 0;
audiotrack->pkt_cnt = h*w / a;
}
}
while (audiotrack->pkt_cnt) {
pkt = av_mallocz(sizeof(AVPacket));
av_new_packet(pkt, a);
memcpy(pkt->data, audiotrack->buf
+ a * (h*w / a - audiotrack->pkt_cnt--), a);
pkt->pos = pos;
pkt->stream_index = matroska->tracks[track]->stream_index;
matroska_queue_packet(matroska, pkt);
}
} else {
int offset = 0;
if (st->codec->codec_id == CODEC_ID_TEXT
&& ((MatroskaSubtitleTrack *)(matroska->tracks[track]))->ass) {
int i;
for (i=0; i<8 && data[slice_offset+offset]; offset++)
if (data[slice_offset+offset] == ',')
i++;
}
pkt = av_mallocz(sizeof(AVPacket));
/* XXX: prevent data copy... */
if (av_new_packet(pkt, slice_size-offset) < 0) {
res = AVERROR(ENOMEM);
n = laces-1;
break;
}
memcpy (pkt->data, data+slice_offset+offset, slice_size-offset);
if (n == 0)
pkt->flags = is_keyframe;
pkt->stream_index = matroska->tracks[track]->stream_index;
pkt->pts = timecode;
pkt->pos = pos;
pkt->duration = duration;
matroska_queue_packet(matroska, pkt);
}
if (timecode != AV_NOPTS_VALUE)
timecode = duration ? timecode + duration : AV_NOPTS_VALUE;
}
data += lace_size[n];
}
}
av_free(lace_size);
av_free(origdata);
return res;
}
| false | FFmpeg | 9c3e2f78a04200e604add6139ba6f64078fa2274 | matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size,
int64_t pos, uint64_t cluster_time, uint64_t duration,
int is_keyframe, int is_bframe)
{
int res = 0;
int track;
AVStream *st;
AVPacket *pkt;
uint8_t *origdata = data;
int16_t block_time;
uint32_t *lace_size = NULL;
int n, flags, laces = 0;
uint64_t num;
if ((n = matroska_ebmlnum_uint(data, size, &num)) < 0) {
av_log(matroska->ctx, AV_LOG_ERROR, "EBML block data error\n");
av_free(origdata);
return res;
}
data += n;
size -= n;
track = matroska_find_track_by_num(matroska, num);
if (size <= 3 || track < 0 || track >= matroska->num_tracks) {
av_log(matroska->ctx, AV_LOG_INFO,
"Invalid stream %d or size %u\n", track, size);
av_free(origdata);
return res;
}
if (matroska->tracks[track]->stream_index < 0)
return res;
st = matroska->ctx->streams[matroska->tracks[track]->stream_index];
if (st->discard >= AVDISCARD_ALL) {
av_free(origdata);
return res;
}
if (duration == AV_NOPTS_VALUE)
duration = matroska->tracks[track]->default_duration;
block_time = AV_RB16(data);
data += 2;
flags = *data++;
size -= 3;
if (is_keyframe == -1)
is_keyframe = flags & 1 ? PKT_FLAG_KEY : 0;
if (matroska->skip_to_keyframe) {
if (!is_keyframe || st != matroska->skip_to_stream)
return res;
matroska->skip_to_keyframe = 0;
}
switch ((flags & 0x06) >> 1) {
case 0x0:
laces = 1;
lace_size = av_mallocz(sizeof(int));
lace_size[0] = size;
break;
case 0x1:
case 0x2:
case 0x3:
if (size == 0) {
res = -1;
break;
}
laces = (*data) + 1;
data += 1;
size -= 1;
lace_size = av_mallocz(laces * sizeof(int));
switch ((flags & 0x06) >> 1) {
case 0x1: {
uint8_t temp;
uint32_t total = 0;
for (n = 0; res == 0 && n < laces - 1; n++) {
while (1) {
if (size == 0) {
res = -1;
break;
}
temp = *data;
lace_size[n] += temp;
data += 1;
size -= 1;
if (temp != 0xff)
break;
}
total += lace_size[n];
}
lace_size[n] = size - total;
break;
}
case 0x2:
for (n = 0; n < laces; n++)
lace_size[n] = size / laces;
break;
case 0x3: {
uint32_t total;
n = matroska_ebmlnum_uint(data, size, &num);
if (n < 0) {
av_log(matroska->ctx, AV_LOG_INFO,
"EBML block data error\n");
break;
}
data += n;
size -= n;
total = lace_size[0] = num;
for (n = 1; res == 0 && n < laces - 1; n++) {
int64_t snum;
int r;
r = matroska_ebmlnum_sint (data, size, &snum);
if (r < 0) {
av_log(matroska->ctx, AV_LOG_INFO,
"EBML block data error\n");
break;
}
data += r;
size -= r;
lace_size[n] = lace_size[n - 1] + snum;
total += lace_size[n];
}
lace_size[n] = size - total;
break;
}
}
break;
}
if (res == 0) {
int real_v = matroska->tracks[track]->flags & MATROSKA_TRACK_REAL_V;
uint64_t timecode = AV_NOPTS_VALUE;
if (cluster_time != (uint64_t)-1 && cluster_time + block_time >= 0)
timecode = cluster_time + block_time;
for (n = 0; n < laces; n++) {
int slice, slices = 1;
if (real_v) {
slices = *data++ + 1;
lace_size[n]--;
}
for (slice=0; slice<slices; slice++) {
int slice_size, slice_offset = 0;
if (real_v)
slice_offset = rv_offset(data, slice, slices);
if (slice+1 == slices)
slice_size = lace_size[n] - slice_offset;
else
slice_size = rv_offset(data, slice+1, slices) - slice_offset;
if (st->codec->codec_id == CODEC_ID_RA_288 ||
st->codec->codec_id == CODEC_ID_COOK ||
st->codec->codec_id == CODEC_ID_ATRAC3) {
MatroskaAudioTrack *audiotrack = (MatroskaAudioTrack *)matroska->tracks[track];
int a = st->codec->block_align;
int sps = audiotrack->sub_packet_size;
int cfs = audiotrack->coded_framesize;
int h = audiotrack->sub_packet_h;
int y = audiotrack->sub_packet_cnt;
int w = audiotrack->frame_size;
int x;
if (!audiotrack->pkt_cnt) {
if (st->codec->codec_id == CODEC_ID_RA_288)
for (x=0; x<h/2; x++)
memcpy(audiotrack->buf+x*2*w+y*cfs,
data+x*cfs, cfs);
else
for (x=0; x<w/sps; x++)
memcpy(audiotrack->buf+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), data+x*sps, sps);
if (++audiotrack->sub_packet_cnt >= h) {
audiotrack->sub_packet_cnt = 0;
audiotrack->pkt_cnt = h*w / a;
}
}
while (audiotrack->pkt_cnt) {
pkt = av_mallocz(sizeof(AVPacket));
av_new_packet(pkt, a);
memcpy(pkt->data, audiotrack->buf
+ a * (h*w / a - audiotrack->pkt_cnt--), a);
pkt->pos = pos;
pkt->stream_index = matroska->tracks[track]->stream_index;
matroska_queue_packet(matroska, pkt);
}
} else {
int offset = 0;
if (st->codec->codec_id == CODEC_ID_TEXT
&& ((MatroskaSubtitleTrack *)(matroska->tracks[track]))->ass) {
int i;
for (i=0; i<8 && data[slice_offset+offset]; offset++)
if (data[slice_offset+offset] == ',')
i++;
}
pkt = av_mallocz(sizeof(AVPacket));
if (av_new_packet(pkt, slice_size-offset) < 0) {
res = AVERROR(ENOMEM);
n = laces-1;
break;
}
memcpy (pkt->data, data+slice_offset+offset, slice_size-offset);
if (n == 0)
pkt->flags = is_keyframe;
pkt->stream_index = matroska->tracks[track]->stream_index;
pkt->pts = timecode;
pkt->pos = pos;
pkt->duration = duration;
matroska_queue_packet(matroska, pkt);
}
if (timecode != AV_NOPTS_VALUE)
timecode = duration ? timecode + duration : AV_NOPTS_VALUE;
}
data += lace_size[n];
}
}
av_free(lace_size);
av_free(origdata);
return res;
}
| {
"code": [],
"line_no": []
} | FUNC_0(MatroskaDemuxContext *VAR_0, uint8_t *VAR_1, int VAR_2,
int64_t VAR_3, uint64_t VAR_4, uint64_t VAR_5,
int VAR_6, int VAR_7)
{
int VAR_8 = 0;
int VAR_9;
AVStream *st;
AVPacket *pkt;
uint8_t *origdata = VAR_1;
int16_t block_time;
uint32_t *lace_size = NULL;
int VAR_10, VAR_11, VAR_12 = 0;
uint64_t num;
if ((VAR_10 = matroska_ebmlnum_uint(VAR_1, VAR_2, &num)) < 0) {
av_log(VAR_0->ctx, AV_LOG_ERROR, "EBML block VAR_1 error\VAR_10");
av_free(origdata);
return VAR_8;
}
VAR_1 += VAR_10;
VAR_2 -= VAR_10;
VAR_9 = matroska_find_track_by_num(VAR_0, num);
if (VAR_2 <= 3 || VAR_9 < 0 || VAR_9 >= VAR_0->num_tracks) {
av_log(VAR_0->ctx, AV_LOG_INFO,
"Invalid stream %d or VAR_2 %u\VAR_10", VAR_9, VAR_2);
av_free(origdata);
return VAR_8;
}
if (VAR_0->tracks[VAR_9]->stream_index < 0)
return VAR_8;
st = VAR_0->ctx->streams[VAR_0->tracks[VAR_9]->stream_index];
if (st->discard >= AVDISCARD_ALL) {
av_free(origdata);
return VAR_8;
}
if (VAR_5 == AV_NOPTS_VALUE)
VAR_5 = VAR_0->tracks[VAR_9]->default_duration;
block_time = AV_RB16(VAR_1);
VAR_1 += 2;
VAR_11 = *VAR_1++;
VAR_2 -= 3;
if (VAR_6 == -1)
VAR_6 = VAR_11 & 1 ? PKT_FLAG_KEY : 0;
if (VAR_0->skip_to_keyframe) {
if (!VAR_6 || st != VAR_0->skip_to_stream)
return VAR_8;
VAR_0->skip_to_keyframe = 0;
}
switch ((VAR_11 & 0x06) >> 1) {
case 0x0:
VAR_12 = 1;
lace_size = av_mallocz(sizeof(int));
lace_size[0] = VAR_2;
break;
case 0x1:
case 0x2:
case 0x3:
if (VAR_2 == 0) {
VAR_8 = -1;
break;
}
VAR_12 = (*VAR_1) + 1;
VAR_1 += 1;
VAR_2 -= 1;
lace_size = av_mallocz(VAR_12 * sizeof(int));
switch ((VAR_11 & 0x06) >> 1) {
case 0x1: {
uint8_t temp;
uint32_t total = 0;
for (VAR_10 = 0; VAR_8 == 0 && VAR_10 < VAR_12 - 1; VAR_10++) {
while (1) {
if (VAR_2 == 0) {
VAR_8 = -1;
break;
}
temp = *VAR_1;
lace_size[VAR_10] += temp;
VAR_1 += 1;
VAR_2 -= 1;
if (temp != 0xff)
break;
}
total += lace_size[VAR_10];
}
lace_size[VAR_10] = VAR_2 - total;
break;
}
case 0x2:
for (VAR_10 = 0; VAR_10 < VAR_12; VAR_10++)
lace_size[VAR_10] = VAR_2 / VAR_12;
break;
case 0x3: {
uint32_t total;
VAR_10 = matroska_ebmlnum_uint(VAR_1, VAR_2, &num);
if (VAR_10 < 0) {
av_log(VAR_0->ctx, AV_LOG_INFO,
"EBML block VAR_1 error\VAR_10");
break;
}
VAR_1 += VAR_10;
VAR_2 -= VAR_10;
total = lace_size[0] = num;
for (VAR_10 = 1; VAR_8 == 0 && VAR_10 < VAR_12 - 1; VAR_10++) {
int64_t snum;
int VAR_13;
VAR_13 = matroska_ebmlnum_sint (VAR_1, VAR_2, &snum);
if (VAR_13 < 0) {
av_log(VAR_0->ctx, AV_LOG_INFO,
"EBML block VAR_1 error\VAR_10");
break;
}
VAR_1 += VAR_13;
VAR_2 -= VAR_13;
lace_size[VAR_10] = lace_size[VAR_10 - 1] + snum;
total += lace_size[VAR_10];
}
lace_size[VAR_10] = VAR_2 - total;
break;
}
}
break;
}
if (VAR_8 == 0) {
int VAR_14 = VAR_0->tracks[VAR_9]->VAR_11 & MATROSKA_TRACK_REAL_V;
uint64_t timecode = AV_NOPTS_VALUE;
if (VAR_4 != (uint64_t)-1 && VAR_4 + block_time >= 0)
timecode = VAR_4 + block_time;
for (VAR_10 = 0; VAR_10 < VAR_12; VAR_10++) {
int VAR_15, VAR_16 = 1;
if (VAR_14) {
VAR_16 = *VAR_1++ + 1;
lace_size[VAR_10]--;
}
for (VAR_15=0; VAR_15<VAR_16; VAR_15++) {
int VAR_17, VAR_18 = 0;
if (VAR_14)
VAR_18 = rv_offset(VAR_1, VAR_15, VAR_16);
if (VAR_15+1 == VAR_16)
VAR_17 = lace_size[VAR_10] - VAR_18;
else
VAR_17 = rv_offset(VAR_1, VAR_15+1, VAR_16) - VAR_18;
if (st->codec->codec_id == CODEC_ID_RA_288 ||
st->codec->codec_id == CODEC_ID_COOK ||
st->codec->codec_id == CODEC_ID_ATRAC3) {
MatroskaAudioTrack *audiotrack = (MatroskaAudioTrack *)VAR_0->tracks[VAR_9];
int VAR_19 = st->codec->block_align;
int VAR_20 = audiotrack->sub_packet_size;
int VAR_21 = audiotrack->coded_framesize;
int VAR_22 = audiotrack->sub_packet_h;
int VAR_23 = audiotrack->sub_packet_cnt;
int VAR_24 = audiotrack->frame_size;
int VAR_25;
if (!audiotrack->pkt_cnt) {
if (st->codec->codec_id == CODEC_ID_RA_288)
for (VAR_25=0; VAR_25<VAR_22/2; VAR_25++)
memcpy(audiotrack->buf+VAR_25*2*VAR_24+VAR_23*VAR_21,
VAR_1+VAR_25*VAR_21, VAR_21);
else
for (VAR_25=0; VAR_25<VAR_24/VAR_20; VAR_25++)
memcpy(audiotrack->buf+VAR_20*(VAR_22*VAR_25+((VAR_22+1)/2)*(VAR_23&1)+(VAR_23>>1)), VAR_1+VAR_25*VAR_20, VAR_20);
if (++audiotrack->sub_packet_cnt >= VAR_22) {
audiotrack->sub_packet_cnt = 0;
audiotrack->pkt_cnt = VAR_22*VAR_24 / VAR_19;
}
}
while (audiotrack->pkt_cnt) {
pkt = av_mallocz(sizeof(AVPacket));
av_new_packet(pkt, VAR_19);
memcpy(pkt->VAR_1, audiotrack->buf
+ VAR_19 * (VAR_22*VAR_24 / VAR_19 - audiotrack->pkt_cnt--), VAR_19);
pkt->VAR_3 = VAR_3;
pkt->stream_index = VAR_0->tracks[VAR_9]->stream_index;
matroska_queue_packet(VAR_0, pkt);
}
} else {
int VAR_26 = 0;
if (st->codec->codec_id == CODEC_ID_TEXT
&& ((MatroskaSubtitleTrack *)(VAR_0->tracks[VAR_9]))->ass) {
int VAR_27;
for (VAR_27=0; VAR_27<8 && VAR_1[VAR_18+VAR_26]; VAR_26++)
if (VAR_1[VAR_18+VAR_26] == ',')
VAR_27++;
}
pkt = av_mallocz(sizeof(AVPacket));
if (av_new_packet(pkt, VAR_17-VAR_26) < 0) {
VAR_8 = AVERROR(ENOMEM);
VAR_10 = VAR_12-1;
break;
}
memcpy (pkt->VAR_1, VAR_1+VAR_18+VAR_26, VAR_17-VAR_26);
if (VAR_10 == 0)
pkt->VAR_11 = VAR_6;
pkt->stream_index = VAR_0->tracks[VAR_9]->stream_index;
pkt->pts = timecode;
pkt->VAR_3 = VAR_3;
pkt->VAR_5 = VAR_5;
matroska_queue_packet(VAR_0, pkt);
}
if (timecode != AV_NOPTS_VALUE)
timecode = VAR_5 ? timecode + VAR_5 : AV_NOPTS_VALUE;
}
VAR_1 += lace_size[VAR_10];
}
}
av_free(lace_size);
av_free(origdata);
return VAR_8;
}
| [
"FUNC_0(MatroskaDemuxContext *VAR_0, uint8_t *VAR_1, int VAR_2,\nint64_t VAR_3, uint64_t VAR_4, uint64_t VAR_5,\nint VAR_6, int VAR_7)\n{",
"int VAR_8 = 0;",
"int VAR_9;",
"AVStream *st;",
"AVPacket *pkt;",
"uint8_t *origdata = VAR_1;",
"int16_t block_time;",
"uint32_t *lace_size = NULL;",
"int VAR_10, VAR_11, VAR_12 = 0;",
"uint64_t num;",
"if ((VAR_10 = matroska_ebmlnum_uint(VAR_1, VAR_2, &num)) < 0) {",
"av_log(VAR_0->ctx, AV_LOG_ERROR, \"EBML block VAR_1 error\\VAR_10\");",
"av_free(origdata);",
"return VAR_8;",
"}",
"VAR_1 += VAR_10;",
"VAR_2 -= VAR_10;",
"VAR_9 = matroska_find_track_by_num(VAR_0, num);",
"if (VAR_2 <= 3 || VAR_9 < 0 || VAR_9 >= VAR_0->num_tracks) {",
"av_log(VAR_0->ctx, AV_LOG_INFO,\n\"Invalid stream %d or VAR_2 %u\\VAR_10\", VAR_9, VAR_2);",
"av_free(origdata);",
"return VAR_8;",
"}",
"if (VAR_0->tracks[VAR_9]->stream_index < 0)\nreturn VAR_8;",
"st = VAR_0->ctx->streams[VAR_0->tracks[VAR_9]->stream_index];",
"if (st->discard >= AVDISCARD_ALL) {",
"av_free(origdata);",
"return VAR_8;",
"}",
"if (VAR_5 == AV_NOPTS_VALUE)\nVAR_5 = VAR_0->tracks[VAR_9]->default_duration;",
"block_time = AV_RB16(VAR_1);",
"VAR_1 += 2;",
"VAR_11 = *VAR_1++;",
"VAR_2 -= 3;",
"if (VAR_6 == -1)\nVAR_6 = VAR_11 & 1 ? PKT_FLAG_KEY : 0;",
"if (VAR_0->skip_to_keyframe) {",
"if (!VAR_6 || st != VAR_0->skip_to_stream)\nreturn VAR_8;",
"VAR_0->skip_to_keyframe = 0;",
"}",
"switch ((VAR_11 & 0x06) >> 1) {",
"case 0x0:\nVAR_12 = 1;",
"lace_size = av_mallocz(sizeof(int));",
"lace_size[0] = VAR_2;",
"break;",
"case 0x1:\ncase 0x2:\ncase 0x3:\nif (VAR_2 == 0) {",
"VAR_8 = -1;",
"break;",
"}",
"VAR_12 = (*VAR_1) + 1;",
"VAR_1 += 1;",
"VAR_2 -= 1;",
"lace_size = av_mallocz(VAR_12 * sizeof(int));",
"switch ((VAR_11 & 0x06) >> 1) {",
"case 0x1: {",
"uint8_t temp;",
"uint32_t total = 0;",
"for (VAR_10 = 0; VAR_8 == 0 && VAR_10 < VAR_12 - 1; VAR_10++) {",
"while (1) {",
"if (VAR_2 == 0) {",
"VAR_8 = -1;",
"break;",
"}",
"temp = *VAR_1;",
"lace_size[VAR_10] += temp;",
"VAR_1 += 1;",
"VAR_2 -= 1;",
"if (temp != 0xff)\nbreak;",
"}",
"total += lace_size[VAR_10];",
"}",
"lace_size[VAR_10] = VAR_2 - total;",
"break;",
"}",
"case 0x2:\nfor (VAR_10 = 0; VAR_10 < VAR_12; VAR_10++)",
"lace_size[VAR_10] = VAR_2 / VAR_12;",
"break;",
"case 0x3: {",
"uint32_t total;",
"VAR_10 = matroska_ebmlnum_uint(VAR_1, VAR_2, &num);",
"if (VAR_10 < 0) {",
"av_log(VAR_0->ctx, AV_LOG_INFO,\n\"EBML block VAR_1 error\\VAR_10\");",
"break;",
"}",
"VAR_1 += VAR_10;",
"VAR_2 -= VAR_10;",
"total = lace_size[0] = num;",
"for (VAR_10 = 1; VAR_8 == 0 && VAR_10 < VAR_12 - 1; VAR_10++) {",
"int64_t snum;",
"int VAR_13;",
"VAR_13 = matroska_ebmlnum_sint (VAR_1, VAR_2, &snum);",
"if (VAR_13 < 0) {",
"av_log(VAR_0->ctx, AV_LOG_INFO,\n\"EBML block VAR_1 error\\VAR_10\");",
"break;",
"}",
"VAR_1 += VAR_13;",
"VAR_2 -= VAR_13;",
"lace_size[VAR_10] = lace_size[VAR_10 - 1] + snum;",
"total += lace_size[VAR_10];",
"}",
"lace_size[VAR_10] = VAR_2 - total;",
"break;",
"}",
"}",
"break;",
"}",
"if (VAR_8 == 0) {",
"int VAR_14 = VAR_0->tracks[VAR_9]->VAR_11 & MATROSKA_TRACK_REAL_V;",
"uint64_t timecode = AV_NOPTS_VALUE;",
"if (VAR_4 != (uint64_t)-1 && VAR_4 + block_time >= 0)\ntimecode = VAR_4 + block_time;",
"for (VAR_10 = 0; VAR_10 < VAR_12; VAR_10++) {",
"int VAR_15, VAR_16 = 1;",
"if (VAR_14) {",
"VAR_16 = *VAR_1++ + 1;",
"lace_size[VAR_10]--;",
"}",
"for (VAR_15=0; VAR_15<VAR_16; VAR_15++) {",
"int VAR_17, VAR_18 = 0;",
"if (VAR_14)\nVAR_18 = rv_offset(VAR_1, VAR_15, VAR_16);",
"if (VAR_15+1 == VAR_16)\nVAR_17 = lace_size[VAR_10] - VAR_18;",
"else\nVAR_17 = rv_offset(VAR_1, VAR_15+1, VAR_16) - VAR_18;",
"if (st->codec->codec_id == CODEC_ID_RA_288 ||\nst->codec->codec_id == CODEC_ID_COOK ||\nst->codec->codec_id == CODEC_ID_ATRAC3) {",
"MatroskaAudioTrack *audiotrack = (MatroskaAudioTrack *)VAR_0->tracks[VAR_9];",
"int VAR_19 = st->codec->block_align;",
"int VAR_20 = audiotrack->sub_packet_size;",
"int VAR_21 = audiotrack->coded_framesize;",
"int VAR_22 = audiotrack->sub_packet_h;",
"int VAR_23 = audiotrack->sub_packet_cnt;",
"int VAR_24 = audiotrack->frame_size;",
"int VAR_25;",
"if (!audiotrack->pkt_cnt) {",
"if (st->codec->codec_id == CODEC_ID_RA_288)\nfor (VAR_25=0; VAR_25<VAR_22/2; VAR_25++)",
"memcpy(audiotrack->buf+VAR_25*2*VAR_24+VAR_23*VAR_21,\nVAR_1+VAR_25*VAR_21, VAR_21);",
"else\nfor (VAR_25=0; VAR_25<VAR_24/VAR_20; VAR_25++)",
"memcpy(audiotrack->buf+VAR_20*(VAR_22*VAR_25+((VAR_22+1)/2)*(VAR_23&1)+(VAR_23>>1)), VAR_1+VAR_25*VAR_20, VAR_20);",
"if (++audiotrack->sub_packet_cnt >= VAR_22) {",
"audiotrack->sub_packet_cnt = 0;",
"audiotrack->pkt_cnt = VAR_22*VAR_24 / VAR_19;",
"}",
"}",
"while (audiotrack->pkt_cnt) {",
"pkt = av_mallocz(sizeof(AVPacket));",
"av_new_packet(pkt, VAR_19);",
"memcpy(pkt->VAR_1, audiotrack->buf\n+ VAR_19 * (VAR_22*VAR_24 / VAR_19 - audiotrack->pkt_cnt--), VAR_19);",
"pkt->VAR_3 = VAR_3;",
"pkt->stream_index = VAR_0->tracks[VAR_9]->stream_index;",
"matroska_queue_packet(VAR_0, pkt);",
"}",
"} else {",
"int VAR_26 = 0;",
"if (st->codec->codec_id == CODEC_ID_TEXT\n&& ((MatroskaSubtitleTrack *)(VAR_0->tracks[VAR_9]))->ass) {",
"int VAR_27;",
"for (VAR_27=0; VAR_27<8 && VAR_1[VAR_18+VAR_26]; VAR_26++)",
"if (VAR_1[VAR_18+VAR_26] == ',')\nVAR_27++;",
"}",
"pkt = av_mallocz(sizeof(AVPacket));",
"if (av_new_packet(pkt, VAR_17-VAR_26) < 0) {",
"VAR_8 = AVERROR(ENOMEM);",
"VAR_10 = VAR_12-1;",
"break;",
"}",
"memcpy (pkt->VAR_1, VAR_1+VAR_18+VAR_26, VAR_17-VAR_26);",
"if (VAR_10 == 0)\npkt->VAR_11 = VAR_6;",
"pkt->stream_index = VAR_0->tracks[VAR_9]->stream_index;",
"pkt->pts = timecode;",
"pkt->VAR_3 = VAR_3;",
"pkt->VAR_5 = VAR_5;",
"matroska_queue_packet(VAR_0, pkt);",
"}",
"if (timecode != AV_NOPTS_VALUE)\ntimecode = VAR_5 ? timecode + VAR_5 : AV_NOPTS_VALUE;",
"}",
"VAR_1 += lace_size[VAR_10];",
"}",
"}",
"av_free(lace_size);",
"av_free(origdata);",
"return VAR_8;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
31
],
[
33
],
[
35
],
[
37
],
[
39
],
[
41
],
[
43
],
[
49
],
[
51
],
[
53,
55
],
[
57
],
[
59
],
[
61
],
[
63,
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77,
79
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93,
95
],
[
99
],
[
101,
103
],
[
105
],
[
107
],
[
111
],
[
113,
115
],
[
117
],
[
119
],
[
121
],
[
125,
127,
129,
131
],
[
133
],
[
135
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157
],
[
159
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
173
],
[
175
],
[
177,
179
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
191
],
[
195,
197
],
[
199
],
[
201
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213,
215
],
[
217
],
[
219
],
[
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
231
],
[
233
],
[
235
],
[
237,
239
],
[
241
],
[
243
],
[
245
],
[
247
],
[
249
],
[
251
],
[
253
],
[
255
],
[
257
],
[
259
],
[
261
],
[
263
],
[
265
],
[
269
],
[
271
],
[
273
],
[
277,
279
],
[
283
],
[
285
],
[
289
],
[
291
],
[
293
],
[
295
],
[
299
],
[
301
],
[
303,
305
],
[
307,
309
],
[
311,
313
],
[
317,
319,
321
],
[
323
],
[
325
],
[
327
],
[
329
],
[
331
],
[
333
],
[
335
],
[
337
],
[
341
],
[
343,
345
],
[
347,
349
],
[
351,
353
],
[
355
],
[
359
],
[
361
],
[
363
],
[
365
],
[
367
],
[
369
],
[
371
],
[
373
],
[
375,
377
],
[
379
],
[
381
],
[
383
],
[
385
],
[
387
],
[
389
],
[
393,
395
],
[
397
],
[
399
],
[
401,
403
],
[
405
],
[
409
],
[
413
],
[
415
],
[
417
],
[
419
],
[
421
],
[
423
],
[
427,
429
],
[
431
],
[
435
],
[
437
],
[
439
],
[
443
],
[
445
],
[
449,
451
],
[
453
],
[
455
],
[
457
],
[
459
],
[
463
],
[
465
],
[
467
],
[
469
]
] |
1,587 | static void vfio_listener_region_add(MemoryListener *listener,
MemoryRegionSection *section)
{
VFIOContainer *container = container_of(listener, VFIOContainer,
iommu_data.listener);
hwaddr iova, end;
void *vaddr;
int ret;
assert(!memory_region_is_iommu(section->mr));
if (vfio_listener_skipped_section(section)) {
DPRINTF("SKIPPING region_add %"HWADDR_PRIx" - %"PRIx64"\n",
section->offset_within_address_space,
section->offset_within_address_space +
int128_get64(int128_sub(section->size, int128_one())));
return;
}
if (unlikely((section->offset_within_address_space & ~TARGET_PAGE_MASK) !=
(section->offset_within_region & ~TARGET_PAGE_MASK))) {
error_report("%s received unaligned region", __func__);
return;
}
iova = TARGET_PAGE_ALIGN(section->offset_within_address_space);
end = (section->offset_within_address_space + int128_get64(section->size)) &
TARGET_PAGE_MASK;
if (iova >= end) {
return;
}
vaddr = memory_region_get_ram_ptr(section->mr) +
section->offset_within_region +
(iova - section->offset_within_address_space);
DPRINTF("region_add %"HWADDR_PRIx" - %"HWADDR_PRIx" [%p]\n",
iova, end - 1, vaddr);
memory_region_ref(section->mr);
ret = vfio_dma_map(container, iova, end - iova, vaddr, section->readonly);
if (ret) {
error_report("vfio_dma_map(%p, 0x%"HWADDR_PRIx", "
"0x%"HWADDR_PRIx", %p) = %d (%m)",
container, iova, end - iova, vaddr, ret);
}
}
| true | qemu | 87ca1f77b1c406137fe36ab73b2dc91fb75f8d0a | static void vfio_listener_region_add(MemoryListener *listener,
MemoryRegionSection *section)
{
VFIOContainer *container = container_of(listener, VFIOContainer,
iommu_data.listener);
hwaddr iova, end;
void *vaddr;
int ret;
assert(!memory_region_is_iommu(section->mr));
if (vfio_listener_skipped_section(section)) {
DPRINTF("SKIPPING region_add %"HWADDR_PRIx" - %"PRIx64"\n",
section->offset_within_address_space,
section->offset_within_address_space +
int128_get64(int128_sub(section->size, int128_one())));
return;
}
if (unlikely((section->offset_within_address_space & ~TARGET_PAGE_MASK) !=
(section->offset_within_region & ~TARGET_PAGE_MASK))) {
error_report("%s received unaligned region", __func__);
return;
}
iova = TARGET_PAGE_ALIGN(section->offset_within_address_space);
end = (section->offset_within_address_space + int128_get64(section->size)) &
TARGET_PAGE_MASK;
if (iova >= end) {
return;
}
vaddr = memory_region_get_ram_ptr(section->mr) +
section->offset_within_region +
(iova - section->offset_within_address_space);
DPRINTF("region_add %"HWADDR_PRIx" - %"HWADDR_PRIx" [%p]\n",
iova, end - 1, vaddr);
memory_region_ref(section->mr);
ret = vfio_dma_map(container, iova, end - iova, vaddr, section->readonly);
if (ret) {
error_report("vfio_dma_map(%p, 0x%"HWADDR_PRIx", "
"0x%"HWADDR_PRIx", %p) = %d (%m)",
container, iova, end - iova, vaddr, ret);
}
}
| {
"code": [
" iommu_data.listener);",
" iommu_data.listener);"
],
"line_no": [
9,
9
]
} | static void FUNC_0(MemoryListener *VAR_0,
MemoryRegionSection *VAR_1)
{
VFIOContainer *container = container_of(VAR_0, VFIOContainer,
iommu_data.VAR_0);
hwaddr iova, end;
void *VAR_2;
int VAR_3;
assert(!memory_region_is_iommu(VAR_1->mr));
if (vfio_listener_skipped_section(VAR_1)) {
DPRINTF("SKIPPING region_add %"HWADDR_PRIx" - %"PRIx64"\n",
VAR_1->offset_within_address_space,
VAR_1->offset_within_address_space +
int128_get64(int128_sub(VAR_1->size, int128_one())));
return;
}
if (unlikely((VAR_1->offset_within_address_space & ~TARGET_PAGE_MASK) !=
(VAR_1->offset_within_region & ~TARGET_PAGE_MASK))) {
error_report("%s received unaligned region", __func__);
return;
}
iova = TARGET_PAGE_ALIGN(VAR_1->offset_within_address_space);
end = (VAR_1->offset_within_address_space + int128_get64(VAR_1->size)) &
TARGET_PAGE_MASK;
if (iova >= end) {
return;
}
VAR_2 = memory_region_get_ram_ptr(VAR_1->mr) +
VAR_1->offset_within_region +
(iova - VAR_1->offset_within_address_space);
DPRINTF("region_add %"HWADDR_PRIx" - %"HWADDR_PRIx" [%p]\n",
iova, end - 1, VAR_2);
memory_region_ref(VAR_1->mr);
VAR_3 = vfio_dma_map(container, iova, end - iova, VAR_2, VAR_1->readonly);
if (VAR_3) {
error_report("vfio_dma_map(%p, 0x%"HWADDR_PRIx", "
"0x%"HWADDR_PRIx", %p) = %d (%m)",
container, iova, end - iova, VAR_2, VAR_3);
}
}
| [
"static void FUNC_0(MemoryListener *VAR_0,\nMemoryRegionSection *VAR_1)\n{",
"VFIOContainer *container = container_of(VAR_0, VFIOContainer,\niommu_data.VAR_0);",
"hwaddr iova, end;",
"void *VAR_2;",
"int VAR_3;",
"assert(!memory_region_is_iommu(VAR_1->mr));",
"if (vfio_listener_skipped_section(VAR_1)) {",
"DPRINTF(\"SKIPPING region_add %\"HWADDR_PRIx\" - %\"PRIx64\"\\n\",\nVAR_1->offset_within_address_space,\nVAR_1->offset_within_address_space +\nint128_get64(int128_sub(VAR_1->size, int128_one())));",
"return;",
"}",
"if (unlikely((VAR_1->offset_within_address_space & ~TARGET_PAGE_MASK) !=\n(VAR_1->offset_within_region & ~TARGET_PAGE_MASK))) {",
"error_report(\"%s received unaligned region\", __func__);",
"return;",
"}",
"iova = TARGET_PAGE_ALIGN(VAR_1->offset_within_address_space);",
"end = (VAR_1->offset_within_address_space + int128_get64(VAR_1->size)) &\nTARGET_PAGE_MASK;",
"if (iova >= end) {",
"return;",
"}",
"VAR_2 = memory_region_get_ram_ptr(VAR_1->mr) +\nVAR_1->offset_within_region +\n(iova - VAR_1->offset_within_address_space);",
"DPRINTF(\"region_add %\"HWADDR_PRIx\" - %\"HWADDR_PRIx\" [%p]\\n\",\niova, end - 1, VAR_2);",
"memory_region_ref(VAR_1->mr);",
"VAR_3 = vfio_dma_map(container, iova, end - iova, VAR_2, VAR_1->readonly);",
"if (VAR_3) {",
"error_report(\"vfio_dma_map(%p, 0x%\"HWADDR_PRIx\", \"\n\"0x%\"HWADDR_PRIx\", %p) = %d (%m)\",\ncontainer, iova, end - iova, VAR_2, VAR_3);",
"}",
"}"
] | [
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5
],
[
7,
9
],
[
11
],
[
13
],
[
15
],
[
19
],
[
23
],
[
25,
27,
29,
31
],
[
33
],
[
35
],
[
39,
41
],
[
43
],
[
45
],
[
47
],
[
51
],
[
53,
55
],
[
59
],
[
61
],
[
63
],
[
67,
69,
71
],
[
75,
77
],
[
81
],
[
83
],
[
85
],
[
87,
89,
91
],
[
93
],
[
95
]
] |
1,588 | static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
{
AVStream *st = c->fc->streams[c->fc->nb_streams-1];
int len = 0;
uint8_t *buf;
uint32_t type;
uint32_t ctype;
print_atom("hdlr", atom);
get_byte(pb); /* version */
get_byte(pb); get_byte(pb); get_byte(pb); /* flags */
/* component type */
ctype = get_le32(pb);
type = get_le32(pb); /* component subtype */
#ifdef DEBUG
printf("ctype= %c%c%c%c (0x%08lx)\n", *((char *)&ctype), ((char *)&ctype)[1], ((char *)&ctype)[2], ((char *)&ctype)[3], (long) ctype);
printf("stype= %c%c%c%c\n", *((char *)&type), ((char *)&type)[1], ((char *)&type)[2], ((char *)&type)[3]);
#endif
#ifdef DEBUG
/* XXX: yeah this is ugly... */
if(ctype == MKTAG('m', 'h', 'l', 'r')) { /* MOV */
if(type == MKTAG('v', 'i', 'd', 'e'))
puts("hdlr: vide");
else if(type == MKTAG('s', 'o', 'u', 'n'))
puts("hdlr: soun");
} else if(ctype == 0) { /* MP4 */
if(type == MKTAG('v', 'i', 'd', 'e'))
puts("hdlr: vide");
else if(type == MKTAG('s', 'o', 'u', 'n'))
puts("hdlr: soun");
else if(type == MKTAG('o', 'd', 's', 'm'))
puts("hdlr: odsm");
else if(type == MKTAG('s', 'd', 's', 'm'))
puts("hdlr: sdsm");
} else puts("hdlr: meta");
#endif
if(ctype == MKTAG('m', 'h', 'l', 'r')) { /* MOV */
/* helps parsing the string hereafter... */
c->mp4 = 0;
if(type == MKTAG('v', 'i', 'd', 'e'))
st->codec.codec_type = CODEC_TYPE_VIDEO;
else if(type == MKTAG('s', 'o', 'u', 'n'))
st->codec.codec_type = CODEC_TYPE_AUDIO;
} else if(ctype == 0) { /* MP4 */
/* helps parsing the string hereafter... */
c->mp4 = 1;
if(type == MKTAG('v', 'i', 'd', 'e'))
st->codec.codec_type = CODEC_TYPE_VIDEO;
else if(type == MKTAG('s', 'o', 'u', 'n'))
st->codec.codec_type = CODEC_TYPE_AUDIO;
}
get_be32(pb); /* component manufacture */
get_be32(pb); /* component flags */
get_be32(pb); /* component flags mask */
if(atom.size <= 24)
return 0; /* nothing left to read */
/* XXX: MP4 uses a C string, not a pascal one */
/* component name */
if(c->mp4) {
/* .mp4: C string */
while(get_byte(pb) && (++len < (atom.size - 24)));
} else {
/* .mov: PASCAL string */
len = get_byte(pb);
#ifdef DEBUG
buf = (uint8_t*) av_malloc(len+1);
if (buf) {
get_buffer(pb, buf, len);
buf[len] = '\0';
printf("**buf='%s'\n", buf);
av_free(buf);
} else
#endif
url_fskip(pb, len);
}
return 0;
}
| true | FFmpeg | fd6e513ee1dc13174256de8adaeeb2c2691eee95 | static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
{
AVStream *st = c->fc->streams[c->fc->nb_streams-1];
int len = 0;
uint8_t *buf;
uint32_t type;
uint32_t ctype;
print_atom("hdlr", atom);
get_byte(pb);
get_byte(pb); get_byte(pb); get_byte(pb);
ctype = get_le32(pb);
type = get_le32(pb);
#ifdef DEBUG
printf("ctype= %c%c%c%c (0x%08lx)\n", *((char *)&ctype), ((char *)&ctype)[1], ((char *)&ctype)[2], ((char *)&ctype)[3], (long) ctype);
printf("stype= %c%c%c%c\n", *((char *)&type), ((char *)&type)[1], ((char *)&type)[2], ((char *)&type)[3]);
#endif
#ifdef DEBUG
if(ctype == MKTAG('m', 'h', 'l', 'r')) {
if(type == MKTAG('v', 'i', 'd', 'e'))
puts("hdlr: vide");
else if(type == MKTAG('s', 'o', 'u', 'n'))
puts("hdlr: soun");
} else if(ctype == 0) {
if(type == MKTAG('v', 'i', 'd', 'e'))
puts("hdlr: vide");
else if(type == MKTAG('s', 'o', 'u', 'n'))
puts("hdlr: soun");
else if(type == MKTAG('o', 'd', 's', 'm'))
puts("hdlr: odsm");
else if(type == MKTAG('s', 'd', 's', 'm'))
puts("hdlr: sdsm");
} else puts("hdlr: meta");
#endif
if(ctype == MKTAG('m', 'h', 'l', 'r')) {
c->mp4 = 0;
if(type == MKTAG('v', 'i', 'd', 'e'))
st->codec.codec_type = CODEC_TYPE_VIDEO;
else if(type == MKTAG('s', 'o', 'u', 'n'))
st->codec.codec_type = CODEC_TYPE_AUDIO;
} else if(ctype == 0) {
c->mp4 = 1;
if(type == MKTAG('v', 'i', 'd', 'e'))
st->codec.codec_type = CODEC_TYPE_VIDEO;
else if(type == MKTAG('s', 'o', 'u', 'n'))
st->codec.codec_type = CODEC_TYPE_AUDIO;
}
get_be32(pb);
get_be32(pb);
get_be32(pb);
if(atom.size <= 24)
return 0;
if(c->mp4) {
while(get_byte(pb) && (++len < (atom.size - 24)));
} else {
len = get_byte(pb);
#ifdef DEBUG
buf = (uint8_t*) av_malloc(len+1);
if (buf) {
get_buffer(pb, buf, len);
buf[len] = '\0';
printf("**buf='%s'\n", buf);
av_free(buf);
} else
#endif
url_fskip(pb, len);
}
return 0;
}
| {
"code": [
" uint8_t *buf;",
" AVStream *st = c->fc->streams[c->fc->nb_streams-1];",
" uint32_t type;"
],
"line_no": [
9,
5,
11
]
} | static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOV_atom_t VAR_2)
{
AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];
int VAR_3 = 0;
uint8_t *buf;
uint32_t type;
uint32_t ctype;
print_atom("hdlr", VAR_2);
get_byte(VAR_1);
get_byte(VAR_1); get_byte(VAR_1); get_byte(VAR_1);
ctype = get_le32(VAR_1);
type = get_le32(VAR_1);
#ifdef DEBUG
printf("ctype= %VAR_0%VAR_0%VAR_0%VAR_0 (0x%08lx)\n", *((char *)&ctype), ((char *)&ctype)[1], ((char *)&ctype)[2], ((char *)&ctype)[3], (long) ctype);
printf("stype= %VAR_0%VAR_0%VAR_0%VAR_0\n", *((char *)&type), ((char *)&type)[1], ((char *)&type)[2], ((char *)&type)[3]);
#endif
#ifdef DEBUG
if(ctype == MKTAG('m', 'h', 'l', 'r')) {
if(type == MKTAG('v', 'i', 'd', 'e'))
puts("hdlr: vide");
else if(type == MKTAG('s', 'o', 'u', 'n'))
puts("hdlr: soun");
} else if(ctype == 0) {
if(type == MKTAG('v', 'i', 'd', 'e'))
puts("hdlr: vide");
else if(type == MKTAG('s', 'o', 'u', 'n'))
puts("hdlr: soun");
else if(type == MKTAG('o', 'd', 's', 'm'))
puts("hdlr: odsm");
else if(type == MKTAG('s', 'd', 's', 'm'))
puts("hdlr: sdsm");
} else puts("hdlr: meta");
#endif
if(ctype == MKTAG('m', 'h', 'l', 'r')) {
VAR_0->mp4 = 0;
if(type == MKTAG('v', 'i', 'd', 'e'))
st->codec.codec_type = CODEC_TYPE_VIDEO;
else if(type == MKTAG('s', 'o', 'u', 'n'))
st->codec.codec_type = CODEC_TYPE_AUDIO;
} else if(ctype == 0) {
VAR_0->mp4 = 1;
if(type == MKTAG('v', 'i', 'd', 'e'))
st->codec.codec_type = CODEC_TYPE_VIDEO;
else if(type == MKTAG('s', 'o', 'u', 'n'))
st->codec.codec_type = CODEC_TYPE_AUDIO;
}
get_be32(VAR_1);
get_be32(VAR_1);
get_be32(VAR_1);
if(VAR_2.size <= 24)
return 0;
if(VAR_0->mp4) {
while(get_byte(VAR_1) && (++VAR_3 < (VAR_2.size - 24)));
} else {
VAR_3 = get_byte(VAR_1);
#ifdef DEBUG
buf = (uint8_t*) av_malloc(VAR_3+1);
if (buf) {
get_buffer(VAR_1, buf, VAR_3);
buf[VAR_3] = '\0';
printf("**buf='%s'\n", buf);
av_free(buf);
} else
#endif
url_fskip(VAR_1, VAR_3);
}
return 0;
}
| [
"static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOV_atom_t VAR_2)\n{",
"AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];",
"int VAR_3 = 0;",
"uint8_t *buf;",
"uint32_t type;",
"uint32_t ctype;",
"print_atom(\"hdlr\", VAR_2);",
"get_byte(VAR_1);",
"get_byte(VAR_1); get_byte(VAR_1); get_byte(VAR_1);",
"ctype = get_le32(VAR_1);",
"type = get_le32(VAR_1);",
"#ifdef DEBUG\nprintf(\"ctype= %VAR_0%VAR_0%VAR_0%VAR_0 (0x%08lx)\\n\", *((char *)&ctype), ((char *)&ctype)[1], ((char *)&ctype)[2], ((char *)&ctype)[3], (long) ctype);",
"printf(\"stype= %VAR_0%VAR_0%VAR_0%VAR_0\\n\", *((char *)&type), ((char *)&type)[1], ((char *)&type)[2], ((char *)&type)[3]);",
"#endif\n#ifdef DEBUG\nif(ctype == MKTAG('m', 'h', 'l', 'r')) {",
"if(type == MKTAG('v', 'i', 'd', 'e'))\nputs(\"hdlr: vide\");",
"else if(type == MKTAG('s', 'o', 'u', 'n'))\nputs(\"hdlr: soun\");",
"} else if(ctype == 0) {",
"if(type == MKTAG('v', 'i', 'd', 'e'))\nputs(\"hdlr: vide\");",
"else if(type == MKTAG('s', 'o', 'u', 'n'))\nputs(\"hdlr: soun\");",
"else if(type == MKTAG('o', 'd', 's', 'm'))\nputs(\"hdlr: odsm\");",
"else if(type == MKTAG('s', 'd', 's', 'm'))\nputs(\"hdlr: sdsm\");",
"} else puts(\"hdlr: meta\");",
"#endif\nif(ctype == MKTAG('m', 'h', 'l', 'r')) {",
"VAR_0->mp4 = 0;",
"if(type == MKTAG('v', 'i', 'd', 'e'))\nst->codec.codec_type = CODEC_TYPE_VIDEO;",
"else if(type == MKTAG('s', 'o', 'u', 'n'))\nst->codec.codec_type = CODEC_TYPE_AUDIO;",
"} else if(ctype == 0) {",
"VAR_0->mp4 = 1;",
"if(type == MKTAG('v', 'i', 'd', 'e'))\nst->codec.codec_type = CODEC_TYPE_VIDEO;",
"else if(type == MKTAG('s', 'o', 'u', 'n'))\nst->codec.codec_type = CODEC_TYPE_AUDIO;",
"}",
"get_be32(VAR_1);",
"get_be32(VAR_1);",
"get_be32(VAR_1);",
"if(VAR_2.size <= 24)\nreturn 0;",
"if(VAR_0->mp4) {",
"while(get_byte(VAR_1) && (++VAR_3 < (VAR_2.size - 24)));",
"} else {",
"VAR_3 = get_byte(VAR_1);",
"#ifdef DEBUG\nbuf = (uint8_t*) av_malloc(VAR_3+1);",
"if (buf) {",
"get_buffer(VAR_1, buf, VAR_3);",
"buf[VAR_3] = '\\0';",
"printf(\"**buf='%s'\\n\", buf);",
"av_free(buf);",
"} else",
"#endif\nurl_fskip(VAR_1, VAR_3);",
"}",
"return 0;",
"}"
] | [
0,
1,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
21
],
[
23
],
[
29
],
[
31
],
[
35,
37
],
[
39
],
[
41,
43,
47
],
[
49,
51
],
[
53,
55
],
[
57
],
[
59,
61
],
[
63,
65
],
[
67,
69
],
[
71,
73
],
[
75
],
[
77,
81
],
[
85
],
[
87,
89
],
[
91,
93
],
[
95
],
[
99
],
[
101,
103
],
[
105,
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
119,
121
],
[
129
],
[
133
],
[
135
],
[
139
],
[
141,
143
],
[
145
],
[
147
],
[
149
],
[
151
],
[
153
],
[
155
],
[
157,
159
],
[
161
],
[
165
],
[
167
]
] |
1,589 | static void qemu_rdma_dump_gid(const char *who, struct rdma_cm_id *id)
{
char sgid[33];
char dgid[33];
inet_ntop(AF_INET6, &id->route.addr.addr.ibaddr.sgid, sgid, sizeof sgid);
inet_ntop(AF_INET6, &id->route.addr.addr.ibaddr.dgid, dgid, sizeof dgid);
DPRINTF("%s Source GID: %s, Dest GID: %s\n", who, sgid, dgid);
}
| true | qemu | 60fe637bf0e4d7989e21e50f52526444765c63b4 | static void qemu_rdma_dump_gid(const char *who, struct rdma_cm_id *id)
{
char sgid[33];
char dgid[33];
inet_ntop(AF_INET6, &id->route.addr.addr.ibaddr.sgid, sgid, sizeof sgid);
inet_ntop(AF_INET6, &id->route.addr.addr.ibaddr.dgid, dgid, sizeof dgid);
DPRINTF("%s Source GID: %s, Dest GID: %s\n", who, sgid, dgid);
}
| {
"code": [],
"line_no": []
} | static void FUNC_0(const char *VAR_0, struct rdma_cm_id *VAR_1)
{
char VAR_2[33];
char VAR_3[33];
inet_ntop(AF_INET6, &VAR_1->route.addr.addr.ibaddr.VAR_2, VAR_2, sizeof VAR_2);
inet_ntop(AF_INET6, &VAR_1->route.addr.addr.ibaddr.VAR_3, VAR_3, sizeof VAR_3);
DPRINTF("%s Source GID: %s, Dest GID: %s\n", VAR_0, VAR_2, VAR_3);
}
| [
"static void FUNC_0(const char *VAR_0, struct rdma_cm_id *VAR_1)\n{",
"char VAR_2[33];",
"char VAR_3[33];",
"inet_ntop(AF_INET6, &VAR_1->route.addr.addr.ibaddr.VAR_2, VAR_2, sizeof VAR_2);",
"inet_ntop(AF_INET6, &VAR_1->route.addr.addr.ibaddr.VAR_3, VAR_3, sizeof VAR_3);",
"DPRINTF(\"%s Source GID: %s, Dest GID: %s\\n\", VAR_0, VAR_2, VAR_3);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
],
[
13
],
[
15
]
] |
1,590 | static int v410_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
{
AVFrame *pic = avctx->coded_frame;
uint8_t *src = avpkt->data;
uint16_t *y, *u, *v;
uint32_t val;
int i, j;
if (pic->data[0])
avctx->release_buffer(avctx, pic);
pic->reference = 0;
if (avctx->get_buffer(avctx, pic) < 0) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n");
return AVERROR(ENOMEM);
pic->key_frame = 1;
pic->pict_type = FF_I_TYPE;
y = (uint16_t *)pic->data[0];
u = (uint16_t *)pic->data[1];
v = (uint16_t *)pic->data[2];
for (i = 0; i < avctx->height; i++) {
for (j = 0; j < avctx->width; j++) {
val = AV_RL32(src);
u[j] = (val >> 2) & 0x3FF;
y[j] = (val >> 12) & 0x3FF;
v[j] = (val >> 22);
src += 4;
y += pic->linesize[0] >> 1;
u += pic->linesize[1] >> 1;
v += pic->linesize[2] >> 1;
*data_size = sizeof(AVFrame);
*(AVFrame *)data = *pic;
return avpkt->size; | true | FFmpeg | 11ca3416f92744f376c08e5f31bcbe5d9b44acb2 | static int v410_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
{
AVFrame *pic = avctx->coded_frame;
uint8_t *src = avpkt->data;
uint16_t *y, *u, *v;
uint32_t val;
int i, j;
if (pic->data[0])
avctx->release_buffer(avctx, pic);
pic->reference = 0;
if (avctx->get_buffer(avctx, pic) < 0) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n");
return AVERROR(ENOMEM);
pic->key_frame = 1;
pic->pict_type = FF_I_TYPE;
y = (uint16_t *)pic->data[0];
u = (uint16_t *)pic->data[1];
v = (uint16_t *)pic->data[2];
for (i = 0; i < avctx->height; i++) {
for (j = 0; j < avctx->width; j++) {
val = AV_RL32(src);
u[j] = (val >> 2) & 0x3FF;
y[j] = (val >> 12) & 0x3FF;
v[j] = (val >> 22);
src += 4;
y += pic->linesize[0] >> 1;
u += pic->linesize[1] >> 1;
v += pic->linesize[2] >> 1;
*data_size = sizeof(AVFrame);
*(AVFrame *)data = *pic;
return avpkt->size; | {
"code": [],
"line_no": []
} | static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,
int *VAR_2, AVPacket *VAR_3)
{
AVFrame *pic = VAR_0->coded_frame;
uint8_t *src = VAR_3->VAR_1;
uint16_t *y, *u, *v;
uint32_t val;
int VAR_4, VAR_5;
if (pic->VAR_1[0])
VAR_0->release_buffer(VAR_0, pic);
pic->reference = 0;
if (VAR_0->get_buffer(VAR_0, pic) < 0) {
av_log(VAR_0, AV_LOG_ERROR, "Could not allocate buffer.\n");
return AVERROR(ENOMEM);
pic->key_frame = 1;
pic->pict_type = FF_I_TYPE;
y = (uint16_t *)pic->VAR_1[0];
u = (uint16_t *)pic->VAR_1[1];
v = (uint16_t *)pic->VAR_1[2];
for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) {
for (VAR_5 = 0; VAR_5 < VAR_0->width; VAR_5++) {
val = AV_RL32(src);
u[VAR_5] = (val >> 2) & 0x3FF;
y[VAR_5] = (val >> 12) & 0x3FF;
v[VAR_5] = (val >> 22);
src += 4;
y += pic->linesize[0] >> 1;
u += pic->linesize[1] >> 1;
v += pic->linesize[2] >> 1;
*VAR_2 = sizeof(AVFrame);
*(AVFrame *)VAR_1 = *pic;
return VAR_3->size; | [
"static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{",
"AVFrame *pic = VAR_0->coded_frame;",
"uint8_t *src = VAR_3->VAR_1;",
"uint16_t *y, *u, *v;",
"uint32_t val;",
"int VAR_4, VAR_5;",
"if (pic->VAR_1[0])\nVAR_0->release_buffer(VAR_0, pic);",
"pic->reference = 0;",
"if (VAR_0->get_buffer(VAR_0, pic) < 0) {",
"av_log(VAR_0, AV_LOG_ERROR, \"Could not allocate buffer.\\n\");",
"return AVERROR(ENOMEM);",
"pic->key_frame = 1;",
"pic->pict_type = FF_I_TYPE;",
"y = (uint16_t *)pic->VAR_1[0];",
"u = (uint16_t *)pic->VAR_1[1];",
"v = (uint16_t *)pic->VAR_1[2];",
"for (VAR_4 = 0; VAR_4 < VAR_0->height; VAR_4++) {",
"for (VAR_5 = 0; VAR_5 < VAR_0->width; VAR_5++) {",
"val = AV_RL32(src);",
"u[VAR_5] = (val >> 2) & 0x3FF;",
"y[VAR_5] = (val >> 12) & 0x3FF;",
"v[VAR_5] = (val >> 22);",
"src += 4;",
"y += pic->linesize[0] >> 1;",
"u += pic->linesize[1] >> 1;",
"v += pic->linesize[2] >> 1;",
"*VAR_2 = sizeof(AVFrame);",
"*(AVFrame *)VAR_1 = *pic;",
"return VAR_3->size;"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
2,
3
],
[
4
],
[
5
],
[
6
],
[
7
],
[
8
],
[
9,
10
],
[
11
],
[
12
],
[
13
],
[
14
],
[
15
],
[
16
],
[
17
],
[
18
],
[
19
],
[
20
],
[
21
],
[
22
],
[
23
],
[
24
],
[
25
],
[
26
],
[
27
],
[
28
],
[
29
],
[
30
],
[
31
],
[
32
]
] |
1,591 | static void host_memory_backend_init(Object *obj)
{
HostMemoryBackend *backend = MEMORY_BACKEND(obj);
backend->merge = qemu_opt_get_bool(qemu_get_machine_opts(),
"mem-merge", true);
backend->dump = qemu_opt_get_bool(qemu_get_machine_opts(),
"dump-guest-core", true);
backend->prealloc = mem_prealloc;
object_property_add_bool(obj, "merge",
host_memory_backend_get_merge,
host_memory_backend_set_merge, NULL);
object_property_add_bool(obj, "dump",
host_memory_backend_get_dump,
host_memory_backend_set_dump, NULL);
object_property_add_bool(obj, "prealloc",
host_memory_backend_get_prealloc,
host_memory_backend_set_prealloc, NULL);
object_property_add(obj, "size", "int",
host_memory_backend_get_size,
host_memory_backend_set_size, NULL, NULL, NULL);
object_property_add(obj, "host-nodes", "int",
host_memory_backend_get_host_nodes,
host_memory_backend_set_host_nodes, NULL, NULL, NULL);
object_property_add_enum(obj, "policy", "HostMemPolicy",
HostMemPolicy_lookup,
host_memory_backend_get_policy,
host_memory_backend_set_policy, NULL);
}
| true | qemu | 6b2699672d5b56f8c2902fb9db9879e8cafb2afe | static void host_memory_backend_init(Object *obj)
{
HostMemoryBackend *backend = MEMORY_BACKEND(obj);
backend->merge = qemu_opt_get_bool(qemu_get_machine_opts(),
"mem-merge", true);
backend->dump = qemu_opt_get_bool(qemu_get_machine_opts(),
"dump-guest-core", true);
backend->prealloc = mem_prealloc;
object_property_add_bool(obj, "merge",
host_memory_backend_get_merge,
host_memory_backend_set_merge, NULL);
object_property_add_bool(obj, "dump",
host_memory_backend_get_dump,
host_memory_backend_set_dump, NULL);
object_property_add_bool(obj, "prealloc",
host_memory_backend_get_prealloc,
host_memory_backend_set_prealloc, NULL);
object_property_add(obj, "size", "int",
host_memory_backend_get_size,
host_memory_backend_set_size, NULL, NULL, NULL);
object_property_add(obj, "host-nodes", "int",
host_memory_backend_get_host_nodes,
host_memory_backend_set_host_nodes, NULL, NULL, NULL);
object_property_add_enum(obj, "policy", "HostMemPolicy",
HostMemPolicy_lookup,
host_memory_backend_get_policy,
host_memory_backend_set_policy, NULL);
}
| {
"code": [
" backend->merge = qemu_opt_get_bool(qemu_get_machine_opts(),",
" \"mem-merge\", true);",
" backend->dump = qemu_opt_get_bool(qemu_get_machine_opts(),",
" \"dump-guest-core\", true);"
],
"line_no": [
9,
11,
13,
15
]
} | static void FUNC_0(Object *VAR_0)
{
HostMemoryBackend *backend = MEMORY_BACKEND(VAR_0);
backend->merge = qemu_opt_get_bool(qemu_get_machine_opts(),
"mem-merge", true);
backend->dump = qemu_opt_get_bool(qemu_get_machine_opts(),
"dump-guest-core", true);
backend->prealloc = mem_prealloc;
object_property_add_bool(VAR_0, "merge",
host_memory_backend_get_merge,
host_memory_backend_set_merge, NULL);
object_property_add_bool(VAR_0, "dump",
host_memory_backend_get_dump,
host_memory_backend_set_dump, NULL);
object_property_add_bool(VAR_0, "prealloc",
host_memory_backend_get_prealloc,
host_memory_backend_set_prealloc, NULL);
object_property_add(VAR_0, "size", "int",
host_memory_backend_get_size,
host_memory_backend_set_size, NULL, NULL, NULL);
object_property_add(VAR_0, "host-nodes", "int",
host_memory_backend_get_host_nodes,
host_memory_backend_set_host_nodes, NULL, NULL, NULL);
object_property_add_enum(VAR_0, "policy", "HostMemPolicy",
HostMemPolicy_lookup,
host_memory_backend_get_policy,
host_memory_backend_set_policy, NULL);
}
| [
"static void FUNC_0(Object *VAR_0)\n{",
"HostMemoryBackend *backend = MEMORY_BACKEND(VAR_0);",
"backend->merge = qemu_opt_get_bool(qemu_get_machine_opts(),\n\"mem-merge\", true);",
"backend->dump = qemu_opt_get_bool(qemu_get_machine_opts(),\n\"dump-guest-core\", true);",
"backend->prealloc = mem_prealloc;",
"object_property_add_bool(VAR_0, \"merge\",\nhost_memory_backend_get_merge,\nhost_memory_backend_set_merge, NULL);",
"object_property_add_bool(VAR_0, \"dump\",\nhost_memory_backend_get_dump,\nhost_memory_backend_set_dump, NULL);",
"object_property_add_bool(VAR_0, \"prealloc\",\nhost_memory_backend_get_prealloc,\nhost_memory_backend_set_prealloc, NULL);",
"object_property_add(VAR_0, \"size\", \"int\",\nhost_memory_backend_get_size,\nhost_memory_backend_set_size, NULL, NULL, NULL);",
"object_property_add(VAR_0, \"host-nodes\", \"int\",\nhost_memory_backend_get_host_nodes,\nhost_memory_backend_set_host_nodes, NULL, NULL, NULL);",
"object_property_add_enum(VAR_0, \"policy\", \"HostMemPolicy\",\nHostMemPolicy_lookup,\nhost_memory_backend_get_policy,\nhost_memory_backend_set_policy, NULL);",
"}"
] | [
0,
0,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9,
11
],
[
13,
15
],
[
17
],
[
21,
23,
25
],
[
27,
29,
31
],
[
33,
35,
37
],
[
39,
41,
43
],
[
45,
47,
49
],
[
51,
53,
55,
57
],
[
59
]
] |
1,592 | static void adaptive_gain_control(float *out, const float *in,
const float *speech_synth,
int size, float alpha, float *gain_mem)
{
int i;
float speech_energy = 0.0, postfilter_energy = 0.0, gain_scale_factor;
float mem = *gain_mem;
for (i = 0; i < size; i++) {
speech_energy += fabsf(speech_synth[i]);
postfilter_energy += fabsf(in[i]);
}
gain_scale_factor = (1.0 - alpha) * speech_energy / postfilter_energy;
for (i = 0; i < size; i++) {
mem = alpha * mem + gain_scale_factor;
out[i] = in[i] * mem;
}
*gain_mem = mem;
}
| true | FFmpeg | 33d7f822f8ed2d1870babc1d04d4d48cf8b6f240 | static void adaptive_gain_control(float *out, const float *in,
const float *speech_synth,
int size, float alpha, float *gain_mem)
{
int i;
float speech_energy = 0.0, postfilter_energy = 0.0, gain_scale_factor;
float mem = *gain_mem;
for (i = 0; i < size; i++) {
speech_energy += fabsf(speech_synth[i]);
postfilter_energy += fabsf(in[i]);
}
gain_scale_factor = (1.0 - alpha) * speech_energy / postfilter_energy;
for (i = 0; i < size; i++) {
mem = alpha * mem + gain_scale_factor;
out[i] = in[i] * mem;
}
*gain_mem = mem;
}
| {
"code": [
" gain_scale_factor = (1.0 - alpha) * speech_energy / postfilter_energy;"
],
"line_no": [
25
]
} | static void FUNC_0(float *VAR_0, const float *VAR_1,
const float *VAR_2,
int VAR_3, float VAR_4, float *VAR_5)
{
int VAR_6;
float VAR_7 = 0.0, VAR_8 = 0.0, VAR_9;
float VAR_10 = *VAR_5;
for (VAR_6 = 0; VAR_6 < VAR_3; VAR_6++) {
VAR_7 += fabsf(VAR_2[VAR_6]);
VAR_8 += fabsf(VAR_1[VAR_6]);
}
VAR_9 = (1.0 - VAR_4) * VAR_7 / VAR_8;
for (VAR_6 = 0; VAR_6 < VAR_3; VAR_6++) {
VAR_10 = VAR_4 * VAR_10 + VAR_9;
VAR_0[VAR_6] = VAR_1[VAR_6] * VAR_10;
}
*VAR_5 = VAR_10;
}
| [
"static void FUNC_0(float *VAR_0, const float *VAR_1,\nconst float *VAR_2,\nint VAR_3, float VAR_4, float *VAR_5)\n{",
"int VAR_6;",
"float VAR_7 = 0.0, VAR_8 = 0.0, VAR_9;",
"float VAR_10 = *VAR_5;",
"for (VAR_6 = 0; VAR_6 < VAR_3; VAR_6++) {",
"VAR_7 += fabsf(VAR_2[VAR_6]);",
"VAR_8 += fabsf(VAR_1[VAR_6]);",
"}",
"VAR_9 = (1.0 - VAR_4) * VAR_7 / VAR_8;",
"for (VAR_6 = 0; VAR_6 < VAR_3; VAR_6++) {",
"VAR_10 = VAR_4 * VAR_10 + VAR_9;",
"VAR_0[VAR_6] = VAR_1[VAR_6] * VAR_10;",
"}",
"*VAR_5 = VAR_10;",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7
],
[
9
],
[
11
],
[
13
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
29
],
[
31
],
[
33
],
[
35
],
[
39
],
[
41
]
] |
1,593 | void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL pqxl, int group_id)
{
uint64_t phys = le64_to_cpu(pqxl);
uint32_t slot = (phys >> (64 - 8)) & 0xff;
uint64_t offset = phys & 0xffffffffffff;
switch (group_id) {
case MEMSLOT_GROUP_HOST:
return (void *)(intptr_t)offset;
case MEMSLOT_GROUP_GUEST:
PANIC_ON(slot >= NUM_MEMSLOTS);
PANIC_ON(!qxl->guest_slots[slot].active);
PANIC_ON(offset < qxl->guest_slots[slot].delta);
offset -= qxl->guest_slots[slot].delta;
PANIC_ON(offset > qxl->guest_slots[slot].size)
return qxl->guest_slots[slot].ptr + offset;
default:
PANIC_ON(1);
}
}
| true | qemu | 4b635c59b04cae594f49d9aa45d31b3f318def8f | void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL pqxl, int group_id)
{
uint64_t phys = le64_to_cpu(pqxl);
uint32_t slot = (phys >> (64 - 8)) & 0xff;
uint64_t offset = phys & 0xffffffffffff;
switch (group_id) {
case MEMSLOT_GROUP_HOST:
return (void *)(intptr_t)offset;
case MEMSLOT_GROUP_GUEST:
PANIC_ON(slot >= NUM_MEMSLOTS);
PANIC_ON(!qxl->guest_slots[slot].active);
PANIC_ON(offset < qxl->guest_slots[slot].delta);
offset -= qxl->guest_slots[slot].delta;
PANIC_ON(offset > qxl->guest_slots[slot].size)
return qxl->guest_slots[slot].ptr + offset;
default:
PANIC_ON(1);
}
}
| {
"code": [
" PANIC_ON(slot >= NUM_MEMSLOTS);",
" PANIC_ON(!qxl->guest_slots[slot].active);",
" PANIC_ON(offset < qxl->guest_slots[slot].delta);",
" PANIC_ON(offset > qxl->guest_slots[slot].size)",
" default:",
" PANIC_ON(1);"
],
"line_no": [
21,
23,
25,
29,
33,
35
]
} | void *FUNC_0(PCIQXLDevice *VAR_0, QXLPHYSICAL VAR_1, int VAR_2)
{
uint64_t phys = le64_to_cpu(VAR_1);
uint32_t slot = (phys >> (64 - 8)) & 0xff;
uint64_t offset = phys & 0xffffffffffff;
switch (VAR_2) {
case MEMSLOT_GROUP_HOST:
return (void *)(intptr_t)offset;
case MEMSLOT_GROUP_GUEST:
PANIC_ON(slot >= NUM_MEMSLOTS);
PANIC_ON(!VAR_0->guest_slots[slot].active);
PANIC_ON(offset < VAR_0->guest_slots[slot].delta);
offset -= VAR_0->guest_slots[slot].delta;
PANIC_ON(offset > VAR_0->guest_slots[slot].size)
return VAR_0->guest_slots[slot].ptr + offset;
default:
PANIC_ON(1);
}
}
| [
"void *FUNC_0(PCIQXLDevice *VAR_0, QXLPHYSICAL VAR_1, int VAR_2)\n{",
"uint64_t phys = le64_to_cpu(VAR_1);",
"uint32_t slot = (phys >> (64 - 8)) & 0xff;",
"uint64_t offset = phys & 0xffffffffffff;",
"switch (VAR_2) {",
"case MEMSLOT_GROUP_HOST:\nreturn (void *)(intptr_t)offset;",
"case MEMSLOT_GROUP_GUEST:\nPANIC_ON(slot >= NUM_MEMSLOTS);",
"PANIC_ON(!VAR_0->guest_slots[slot].active);",
"PANIC_ON(offset < VAR_0->guest_slots[slot].delta);",
"offset -= VAR_0->guest_slots[slot].delta;",
"PANIC_ON(offset > VAR_0->guest_slots[slot].size)\nreturn VAR_0->guest_slots[slot].ptr + offset;",
"default:\nPANIC_ON(1);",
"}",
"}"
] | [
0,
0,
0,
0,
0,
0,
1,
1,
1,
0,
1,
1,
0,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
13
],
[
15,
17
],
[
19,
21
],
[
23
],
[
25
],
[
27
],
[
29,
31
],
[
33,
35
],
[
37
],
[
39
]
] |
1,594 | static void ps_add_squares_c(INTFLOAT *dst, const INTFLOAT (*src)[2], int n)
{
int i;
for (i = 0; i < n; i++)
dst[i] += AAC_MADD28(src[i][0], src[i][0], src[i][1], src[i][1]);
}
| true | FFmpeg | 0181b202cc42133eacd74bad33745cf1ba699e6b | static void ps_add_squares_c(INTFLOAT *dst, const INTFLOAT (*src)[2], int n)
{
int i;
for (i = 0; i < n; i++)
dst[i] += AAC_MADD28(src[i][0], src[i][0], src[i][1], src[i][1]);
}
| {
"code": [
" dst[i] += AAC_MADD28(src[i][0], src[i][0], src[i][1], src[i][1]);"
],
"line_no": [
9
]
} | static void FUNC_0(VAR_1 *VAR_0, const VAR_1 (*src)[2], int VAR_2)
{
int VAR_3;
for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++)
VAR_0[VAR_3] += AAC_MADD28(src[VAR_3][0], src[VAR_3][0], src[VAR_3][1], src[VAR_3][1]);
}
| [
"static void FUNC_0(VAR_1 *VAR_0, const VAR_1 (*src)[2], int VAR_2)\n{",
"int VAR_3;",
"for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++)",
"VAR_0[VAR_3] += AAC_MADD28(src[VAR_3][0], src[VAR_3][0], src[VAR_3][1], src[VAR_3][1]);",
"}"
] | [
0,
0,
0,
1,
0
] | [
[
1,
3
],
[
5
],
[
7
],
[
9
],
[
11
]
] |
1,595 | static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPRMachineState *spapr,
uint32_t token, uint32_t nargs,
target_ulong args, uint32_t nret,
target_ulong rets)
{
uint32_t config_addr = rtas_ld(args, 0);
uint64_t buid = rtas_ldq(args, 1);
unsigned int func = rtas_ld(args, 3);
unsigned int req_num = rtas_ld(args, 4); /* 0 == remove all */
unsigned int seq_num = rtas_ld(args, 5);
unsigned int ret_intr_type;
unsigned int irq, max_irqs = 0;
sPAPRPHBState *phb = NULL;
PCIDevice *pdev = NULL;
spapr_pci_msi *msi;
int *config_addr_key;
switch (func) {
case RTAS_CHANGE_MSI_FN:
case RTAS_CHANGE_FN:
ret_intr_type = RTAS_TYPE_MSI;
break;
case RTAS_CHANGE_MSIX_FN:
ret_intr_type = RTAS_TYPE_MSIX;
break;
default:
error_report("rtas_ibm_change_msi(%u) is not implemented", func);
rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
return;
}
/* Fins sPAPRPHBState */
phb = spapr_pci_find_phb(spapr, buid);
if (phb) {
pdev = spapr_pci_find_dev(spapr, buid, config_addr);
}
if (!phb || !pdev) {
rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
return;
}
/* Releasing MSIs */
if (!req_num) {
msi = (spapr_pci_msi *) g_hash_table_lookup(phb->msi, &config_addr);
if (!msi) {
trace_spapr_pci_msi("Releasing wrong config", config_addr);
rtas_st(rets, 0, RTAS_OUT_HW_ERROR);
return;
}
xics_free(spapr->icp, msi->first_irq, msi->num);
if (msi_present(pdev)) {
spapr_msi_setmsg(pdev, 0, false, 0, 0);
}
if (msix_present(pdev)) {
spapr_msi_setmsg(pdev, 0, true, 0, 0);
}
g_hash_table_remove(phb->msi, &config_addr);
trace_spapr_pci_msi("Released MSIs", config_addr);
rtas_st(rets, 0, RTAS_OUT_SUCCESS);
rtas_st(rets, 1, 0);
return;
}
/* Enabling MSI */
/* Check if the device supports as many IRQs as requested */
if (ret_intr_type == RTAS_TYPE_MSI) {
max_irqs = msi_nr_vectors_allocated(pdev);
} else if (ret_intr_type == RTAS_TYPE_MSIX) {
max_irqs = pdev->msix_entries_nr;
}
if (!max_irqs) {
error_report("Requested interrupt type %d is not enabled for device %x",
ret_intr_type, config_addr);
rtas_st(rets, 0, -1); /* Hardware error */
return;
}
/* Correct the number if the guest asked for too many */
if (req_num > max_irqs) {
trace_spapr_pci_msi_retry(config_addr, req_num, max_irqs);
req_num = max_irqs;
irq = 0; /* to avoid misleading trace */
goto out;
}
/* Allocate MSIs */
irq = xics_alloc_block(spapr->icp, 0, req_num, false,
ret_intr_type == RTAS_TYPE_MSI);
if (!irq) {
error_report("Cannot allocate MSIs for device %x", config_addr);
rtas_st(rets, 0, RTAS_OUT_HW_ERROR);
return;
}
/* Setup MSI/MSIX vectors in the device (via cfgspace or MSIX BAR) */
spapr_msi_setmsg(pdev, SPAPR_PCI_MSI_WINDOW, ret_intr_type == RTAS_TYPE_MSIX,
irq, req_num);
/* Add MSI device to cache */
msi = g_new(spapr_pci_msi, 1);
msi->first_irq = irq;
msi->num = req_num;
config_addr_key = g_new(int, 1);
*config_addr_key = config_addr;
g_hash_table_insert(phb->msi, config_addr_key, msi);
out:
rtas_st(rets, 0, RTAS_OUT_SUCCESS);
rtas_st(rets, 1, req_num);
rtas_st(rets, 2, ++seq_num);
if (nret > 3) {
rtas_st(rets, 3, ret_intr_type);
}
trace_spapr_pci_rtas_ibm_change_msi(config_addr, func, req_num, irq);
}
| true | qemu | ce266b75febdeee5b91ab630a7158ddff3e002fb | static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPRMachineState *spapr,
uint32_t token, uint32_t nargs,
target_ulong args, uint32_t nret,
target_ulong rets)
{
uint32_t config_addr = rtas_ld(args, 0);
uint64_t buid = rtas_ldq(args, 1);
unsigned int func = rtas_ld(args, 3);
unsigned int req_num = rtas_ld(args, 4);
unsigned int seq_num = rtas_ld(args, 5);
unsigned int ret_intr_type;
unsigned int irq, max_irqs = 0;
sPAPRPHBState *phb = NULL;
PCIDevice *pdev = NULL;
spapr_pci_msi *msi;
int *config_addr_key;
switch (func) {
case RTAS_CHANGE_MSI_FN:
case RTAS_CHANGE_FN:
ret_intr_type = RTAS_TYPE_MSI;
break;
case RTAS_CHANGE_MSIX_FN:
ret_intr_type = RTAS_TYPE_MSIX;
break;
default:
error_report("rtas_ibm_change_msi(%u) is not implemented", func);
rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
return;
}
phb = spapr_pci_find_phb(spapr, buid);
if (phb) {
pdev = spapr_pci_find_dev(spapr, buid, config_addr);
}
if (!phb || !pdev) {
rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
return;
}
if (!req_num) {
msi = (spapr_pci_msi *) g_hash_table_lookup(phb->msi, &config_addr);
if (!msi) {
trace_spapr_pci_msi("Releasing wrong config", config_addr);
rtas_st(rets, 0, RTAS_OUT_HW_ERROR);
return;
}
xics_free(spapr->icp, msi->first_irq, msi->num);
if (msi_present(pdev)) {
spapr_msi_setmsg(pdev, 0, false, 0, 0);
}
if (msix_present(pdev)) {
spapr_msi_setmsg(pdev, 0, true, 0, 0);
}
g_hash_table_remove(phb->msi, &config_addr);
trace_spapr_pci_msi("Released MSIs", config_addr);
rtas_st(rets, 0, RTAS_OUT_SUCCESS);
rtas_st(rets, 1, 0);
return;
}
if (ret_intr_type == RTAS_TYPE_MSI) {
max_irqs = msi_nr_vectors_allocated(pdev);
} else if (ret_intr_type == RTAS_TYPE_MSIX) {
max_irqs = pdev->msix_entries_nr;
}
if (!max_irqs) {
error_report("Requested interrupt type %d is not enabled for device %x",
ret_intr_type, config_addr);
rtas_st(rets, 0, -1);
return;
}
if (req_num > max_irqs) {
trace_spapr_pci_msi_retry(config_addr, req_num, max_irqs);
req_num = max_irqs;
irq = 0;
goto out;
}
irq = xics_alloc_block(spapr->icp, 0, req_num, false,
ret_intr_type == RTAS_TYPE_MSI);
if (!irq) {
error_report("Cannot allocate MSIs for device %x", config_addr);
rtas_st(rets, 0, RTAS_OUT_HW_ERROR);
return;
}
spapr_msi_setmsg(pdev, SPAPR_PCI_MSI_WINDOW, ret_intr_type == RTAS_TYPE_MSIX,
irq, req_num);
msi = g_new(spapr_pci_msi, 1);
msi->first_irq = irq;
msi->num = req_num;
config_addr_key = g_new(int, 1);
*config_addr_key = config_addr;
g_hash_table_insert(phb->msi, config_addr_key, msi);
out:
rtas_st(rets, 0, RTAS_OUT_SUCCESS);
rtas_st(rets, 1, req_num);
rtas_st(rets, 2, ++seq_num);
if (nret > 3) {
rtas_st(rets, 3, ret_intr_type);
}
trace_spapr_pci_rtas_ibm_change_msi(config_addr, func, req_num, irq);
}
| {
"code": [
" msi = (spapr_pci_msi *) g_hash_table_lookup(phb->msi, &config_addr);"
],
"line_no": [
87
]
} | static void FUNC_0(PowerPCCPU *VAR_0, sPAPRMachineState *VAR_1,
uint32_t VAR_2, uint32_t VAR_3,
target_ulong VAR_4, uint32_t VAR_5,
target_ulong VAR_6)
{
uint32_t config_addr = rtas_ld(VAR_4, 0);
uint64_t buid = rtas_ldq(VAR_4, 1);
unsigned int VAR_7 = rtas_ld(VAR_4, 3);
unsigned int VAR_8 = rtas_ld(VAR_4, 4);
unsigned int VAR_9 = rtas_ld(VAR_4, 5);
unsigned int VAR_10;
unsigned int VAR_11, VAR_12 = 0;
sPAPRPHBState *phb = NULL;
PCIDevice *pdev = NULL;
spapr_pci_msi *msi;
int *VAR_13;
switch (VAR_7) {
case RTAS_CHANGE_MSI_FN:
case RTAS_CHANGE_FN:
VAR_10 = RTAS_TYPE_MSI;
break;
case RTAS_CHANGE_MSIX_FN:
VAR_10 = RTAS_TYPE_MSIX;
break;
default:
error_report("FUNC_0(%u) is not implemented", VAR_7);
rtas_st(VAR_6, 0, RTAS_OUT_PARAM_ERROR);
return;
}
phb = spapr_pci_find_phb(VAR_1, buid);
if (phb) {
pdev = spapr_pci_find_dev(VAR_1, buid, config_addr);
}
if (!phb || !pdev) {
rtas_st(VAR_6, 0, RTAS_OUT_PARAM_ERROR);
return;
}
if (!VAR_8) {
msi = (spapr_pci_msi *) g_hash_table_lookup(phb->msi, &config_addr);
if (!msi) {
trace_spapr_pci_msi("Releasing wrong config", config_addr);
rtas_st(VAR_6, 0, RTAS_OUT_HW_ERROR);
return;
}
xics_free(VAR_1->icp, msi->first_irq, msi->num);
if (msi_present(pdev)) {
spapr_msi_setmsg(pdev, 0, false, 0, 0);
}
if (msix_present(pdev)) {
spapr_msi_setmsg(pdev, 0, true, 0, 0);
}
g_hash_table_remove(phb->msi, &config_addr);
trace_spapr_pci_msi("Released MSIs", config_addr);
rtas_st(VAR_6, 0, RTAS_OUT_SUCCESS);
rtas_st(VAR_6, 1, 0);
return;
}
if (VAR_10 == RTAS_TYPE_MSI) {
VAR_12 = msi_nr_vectors_allocated(pdev);
} else if (VAR_10 == RTAS_TYPE_MSIX) {
VAR_12 = pdev->msix_entries_nr;
}
if (!VAR_12) {
error_report("Requested interrupt type %d is not enabled for device %x",
VAR_10, config_addr);
rtas_st(VAR_6, 0, -1);
return;
}
if (VAR_8 > VAR_12) {
trace_spapr_pci_msi_retry(config_addr, VAR_8, VAR_12);
VAR_8 = VAR_12;
VAR_11 = 0;
goto out;
}
VAR_11 = xics_alloc_block(VAR_1->icp, 0, VAR_8, false,
VAR_10 == RTAS_TYPE_MSI);
if (!VAR_11) {
error_report("Cannot allocate MSIs for device %x", config_addr);
rtas_st(VAR_6, 0, RTAS_OUT_HW_ERROR);
return;
}
spapr_msi_setmsg(pdev, SPAPR_PCI_MSI_WINDOW, VAR_10 == RTAS_TYPE_MSIX,
VAR_11, VAR_8);
msi = g_new(spapr_pci_msi, 1);
msi->first_irq = VAR_11;
msi->num = VAR_8;
VAR_13 = g_new(int, 1);
*VAR_13 = config_addr;
g_hash_table_insert(phb->msi, VAR_13, msi);
out:
rtas_st(VAR_6, 0, RTAS_OUT_SUCCESS);
rtas_st(VAR_6, 1, VAR_8);
rtas_st(VAR_6, 2, ++VAR_9);
if (VAR_5 > 3) {
rtas_st(VAR_6, 3, VAR_10);
}
trace_spapr_pci_rtas_ibm_change_msi(config_addr, VAR_7, VAR_8, VAR_11);
}
| [
"static void FUNC_0(PowerPCCPU *VAR_0, sPAPRMachineState *VAR_1,\nuint32_t VAR_2, uint32_t VAR_3,\ntarget_ulong VAR_4, uint32_t VAR_5,\ntarget_ulong VAR_6)\n{",
"uint32_t config_addr = rtas_ld(VAR_4, 0);",
"uint64_t buid = rtas_ldq(VAR_4, 1);",
"unsigned int VAR_7 = rtas_ld(VAR_4, 3);",
"unsigned int VAR_8 = rtas_ld(VAR_4, 4);",
"unsigned int VAR_9 = rtas_ld(VAR_4, 5);",
"unsigned int VAR_10;",
"unsigned int VAR_11, VAR_12 = 0;",
"sPAPRPHBState *phb = NULL;",
"PCIDevice *pdev = NULL;",
"spapr_pci_msi *msi;",
"int *VAR_13;",
"switch (VAR_7) {",
"case RTAS_CHANGE_MSI_FN:\ncase RTAS_CHANGE_FN:\nVAR_10 = RTAS_TYPE_MSI;",
"break;",
"case RTAS_CHANGE_MSIX_FN:\nVAR_10 = RTAS_TYPE_MSIX;",
"break;",
"default:\nerror_report(\"FUNC_0(%u) is not implemented\", VAR_7);",
"rtas_st(VAR_6, 0, RTAS_OUT_PARAM_ERROR);",
"return;",
"}",
"phb = spapr_pci_find_phb(VAR_1, buid);",
"if (phb) {",
"pdev = spapr_pci_find_dev(VAR_1, buid, config_addr);",
"}",
"if (!phb || !pdev) {",
"rtas_st(VAR_6, 0, RTAS_OUT_PARAM_ERROR);",
"return;",
"}",
"if (!VAR_8) {",
"msi = (spapr_pci_msi *) g_hash_table_lookup(phb->msi, &config_addr);",
"if (!msi) {",
"trace_spapr_pci_msi(\"Releasing wrong config\", config_addr);",
"rtas_st(VAR_6, 0, RTAS_OUT_HW_ERROR);",
"return;",
"}",
"xics_free(VAR_1->icp, msi->first_irq, msi->num);",
"if (msi_present(pdev)) {",
"spapr_msi_setmsg(pdev, 0, false, 0, 0);",
"}",
"if (msix_present(pdev)) {",
"spapr_msi_setmsg(pdev, 0, true, 0, 0);",
"}",
"g_hash_table_remove(phb->msi, &config_addr);",
"trace_spapr_pci_msi(\"Released MSIs\", config_addr);",
"rtas_st(VAR_6, 0, RTAS_OUT_SUCCESS);",
"rtas_st(VAR_6, 1, 0);",
"return;",
"}",
"if (VAR_10 == RTAS_TYPE_MSI) {",
"VAR_12 = msi_nr_vectors_allocated(pdev);",
"} else if (VAR_10 == RTAS_TYPE_MSIX) {",
"VAR_12 = pdev->msix_entries_nr;",
"}",
"if (!VAR_12) {",
"error_report(\"Requested interrupt type %d is not enabled for device %x\",\nVAR_10, config_addr);",
"rtas_st(VAR_6, 0, -1);",
"return;",
"}",
"if (VAR_8 > VAR_12) {",
"trace_spapr_pci_msi_retry(config_addr, VAR_8, VAR_12);",
"VAR_8 = VAR_12;",
"VAR_11 = 0;",
"goto out;",
"}",
"VAR_11 = xics_alloc_block(VAR_1->icp, 0, VAR_8, false,\nVAR_10 == RTAS_TYPE_MSI);",
"if (!VAR_11) {",
"error_report(\"Cannot allocate MSIs for device %x\", config_addr);",
"rtas_st(VAR_6, 0, RTAS_OUT_HW_ERROR);",
"return;",
"}",
"spapr_msi_setmsg(pdev, SPAPR_PCI_MSI_WINDOW, VAR_10 == RTAS_TYPE_MSIX,\nVAR_11, VAR_8);",
"msi = g_new(spapr_pci_msi, 1);",
"msi->first_irq = VAR_11;",
"msi->num = VAR_8;",
"VAR_13 = g_new(int, 1);",
"*VAR_13 = config_addr;",
"g_hash_table_insert(phb->msi, VAR_13, msi);",
"out:\nrtas_st(VAR_6, 0, RTAS_OUT_SUCCESS);",
"rtas_st(VAR_6, 1, VAR_8);",
"rtas_st(VAR_6, 2, ++VAR_9);",
"if (VAR_5 > 3) {",
"rtas_st(VAR_6, 3, VAR_10);",
"}",
"trace_spapr_pci_rtas_ibm_change_msi(config_addr, VAR_7, VAR_8, VAR_11);",
"}"
] | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
[
1,
3,
5,
7,
9
],
[
11
],
[
13
],
[
15
],
[
17
],
[
19
],
[
21
],
[
23
],
[
25
],
[
27
],
[
29
],
[
31
],
[
35
],
[
37,
39,
41
],
[
43
],
[
45,
47
],
[
49
],
[
51,
53
],
[
55
],
[
57
],
[
59
],
[
65
],
[
67
],
[
69
],
[
71
],
[
73
],
[
75
],
[
77
],
[
79
],
[
85
],
[
87
],
[
89
],
[
91
],
[
93
],
[
95
],
[
97
],
[
101
],
[
103
],
[
105
],
[
107
],
[
109
],
[
111
],
[
113
],
[
115
],
[
119
],
[
121
],
[
123
],
[
125
],
[
127
],
[
137
],
[
139
],
[
141
],
[
143
],
[
145
],
[
147
],
[
149,
151
],
[
153
],
[
155
],
[
157
],
[
161
],
[
163
],
[
165
],
[
167
],
[
169
],
[
171
],
[
177,
179
],
[
181
],
[
183
],
[
185
],
[
187
],
[
189
],
[
195,
197
],
[
203
],
[
205
],
[
207
],
[
209
],
[
211
],
[
213
],
[
217,
219
],
[
221
],
[
223
],
[
225
],
[
227
],
[
229
],
[
233
],
[
235
]
] |
1,596 | static inline TCGv gen_extend(TCGv val, int opsize, int sign)
{
TCGv tmp;
switch (opsize) {
case OS_BYTE:
tmp = tcg_temp_new();
if (sign)
tcg_gen_ext8s_i32(tmp, val);
else
tcg_gen_ext8u_i32(tmp, val);
break;
case OS_WORD:
tmp = tcg_temp_new();
if (sign)
tcg_gen_ext16s_i32(tmp, val);
else
tcg_gen_ext16u_i32(tmp, val);
break;
case OS_LONG:
case OS_SINGLE:
tmp = val;
break;
default:
qemu_assert(0, "Bad operand size");
}
return tmp;
}
| true | qemu | 7372c2b926200db295412efbb53f93773b7f1754 | static inline TCGv gen_extend(TCGv val, int opsize, int sign)
{
TCGv tmp;
switch (opsize) {
case OS_BYTE:
tmp = tcg_temp_new();
if (sign)
tcg_gen_ext8s_i32(tmp, val);
else
tcg_gen_ext8u_i32(tmp, val);
break;
case OS_WORD:
tmp = tcg_temp_new();
if (sign)
tcg_gen_ext16s_i32(tmp, val);
else
tcg_gen_ext16u_i32(tmp, val);
break;
case OS_LONG:
case OS_SINGLE:
tmp = val;
break;
default:
qemu_assert(0, "Bad operand size");
}
return tmp;
}
| {
"code": [
" qemu_assert(0, \"Bad operand size\");",
" break;",
" qemu_assert(0, \"Bad operand size\");"
],
"line_no": [
49,
23,
49
]
} | static inline TCGv FUNC_0(TCGv val, int opsize, int sign)
{
TCGv tmp;
switch (opsize) {
case OS_BYTE:
tmp = tcg_temp_new();
if (sign)
tcg_gen_ext8s_i32(tmp, val);
else
tcg_gen_ext8u_i32(tmp, val);
break;
case OS_WORD:
tmp = tcg_temp_new();
if (sign)
tcg_gen_ext16s_i32(tmp, val);
else
tcg_gen_ext16u_i32(tmp, val);
break;
case OS_LONG:
case OS_SINGLE:
tmp = val;
break;
default:
qemu_assert(0, "Bad operand size");
}
return tmp;
}
| [
"static inline TCGv FUNC_0(TCGv val, int opsize, int sign)\n{",
"TCGv tmp;",
"switch (opsize) {",
"case OS_BYTE:\ntmp = tcg_temp_new();",
"if (sign)\ntcg_gen_ext8s_i32(tmp, val);",
"else\ntcg_gen_ext8u_i32(tmp, val);",
"break;",
"case OS_WORD:\ntmp = tcg_temp_new();",
"if (sign)\ntcg_gen_ext16s_i32(tmp, val);",
"else\ntcg_gen_ext16u_i32(tmp, val);",
"break;",
"case OS_LONG:\ncase OS_SINGLE:\ntmp = val;",
"break;",
"default:\nqemu_assert(0, \"Bad operand size\");",
"}",
"return tmp;",
"}"
] | [
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0
] | [
[
1,
3
],
[
5
],
[
9
],
[
11,
13
],
[
15,
17
],
[
19,
21
],
[
23
],
[
25,
27
],
[
29,
31
],
[
33,
35
],
[
37
],
[
39,
41,
43
],
[
45
],
[
47,
49
],
[
51
],
[
53
],
[
55
]
] |