Click here to Skip to main content
11,583,859 members (63,321 online)
Click here to Skip to main content
Add your own
alternative version

Introduction to SSE Programming

, 10 Jul 2003 CPOL 433.7K 7.6K 121
An article describes programming floating-point calculations using Streaming SIMD Extensions
// SSESampleDlg.h : header file

#pragma once
#include "afxwin.h"

#include <xmmintrin.h>      // __m128 data type and SSE functions

#define ARRAY_SIZE 100000

#pragma warning(disable : 4324)

// CSSESampleDlg dialog
class CSSESampleDlg : public CDialog
// Construction
	CSSESampleDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data

	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support

// Implementation
	HICON m_hIcon;

    // Arrays processed by SSE should have 16 bytes alignment:
    __declspec(align(16)) float m_fInitialArray[ARRAY_SIZE];
    __declspec(align(16)) float m_fResultArray[ARRAY_SIZE];

    // minimum and maximum values in the result array
    float m_fMin;
    float m_fMax;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
    afx_msg void OnBnClickedButtonCplusplus();
    afx_msg void OnBnClickedButtonReset();
    afx_msg void OnBnClickedButtonSseAssembly();
    afx_msg void OnBnClickedButtonSseC();

    CStatic m_static_minimum;
    CStatic m_static_time;
    CStatic m_static_maximum;
    CListBox m_list_box;

    void InitArray();
    void ShowMinMax();
    void AddString(LPCTSTR s);
    void ClearList();
    void ShowArray(float* pArray);
    void ConvertFloatToString(CString& s, float f);
    void ShowTime(__int64 nTime);


#pragma warning(default : 4324)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer
Israel Israel
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150603.1 | Last Updated 11 Jul 2003
Article Copyright 2003 by 5678901234
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid